Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Functions declaration #49

Closed
labraxoid opened this issue Dec 15, 2018 · 6 comments
Closed

Functions declaration #49

labraxoid opened this issue Dec 15, 2018 · 6 comments

Comments

@labraxoid
Copy link

labraxoid commented Dec 15, 2018

BUG in v.2.2.5 ( macOS 10.13.6 )

I am currently creating Corona completions to add it to LuaCoderAssist like added Love compilations and discovered strange symbols behavior when declaring and defining functions.

In the first case problem with adding new fields to returned table (CASE 1):

bug002

In the second case problem is inclusion all fields in one object, but in Lua it is not true (CASE 2):

bug003

Alternative definition of the function (CASE 3):

bug004

And once I caught this bug:

bug005

Thanks for LuaCoderAssist!
I hope my report will help make it better.

@liwangqian
Copy link
Owner

well, your issue is really detailed, thanks again, I will try to fix it later.

@labraxoid
Copy link
Author

@liwangqian CASE 1 and CASE 2 are resolved but CASE 3 partially:

bug007

Thank you for your efforts.

@labraxoid
Copy link
Author

about CASE 2
now all fields and methods for simple tables are defined specifically, but for namedTypes from completions it works wrong, this is important because, as I noted above, I make the Corona completions, for Corona community. I attached edited love.json. You can replace original with it and check next situation:

bug009

love.json.zip

@liwangqian
Copy link
Owner

@labraxoid For the Case 3 you describe up, we use the first definition of a symbol and will not change it's definition even thought we redefined it after some codes, so this case will not be resolved.

And, for the second case, the API description file xxx.json, should add "kind": "constructor" to the function to help figuring out that, it's a constructor, and we will create a new instance instead.

For example:
image

@labraxoid
Copy link
Author

in CASE 3 is not about redefining, it is about different ways of function definition in Lua. The variable 'foo' is nil, we do not define it, we only declare. If we use way function foo() ... end LCA defines that variable 'foo' is function and we can see in outline all variables inside function but if we use foo = function() ... end LCA defines that variable 'foo' is function, defines type of function return but without definition variables inside. This is not a common situation, so if the implementation is difficult, then it can be omitted.

Thank you for extension of API completions. I will try it in next version.

liwangqian added a commit that referenced this issue Jan 20, 2019
@liwangqian
Copy link
Owner

@labraxoid Try the Ver2.2.8, CASE 3 is fixed in this version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants