-
-
Notifications
You must be signed in to change notification settings - Fork 338
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
Autocompletion is not offered for a parameter with a @class
type
#1439
Comments
That is only after manually requesting completions by pressing Ctrl + Space, I am not receiving them automatically, as you can see in Sumneko's GIF. |
Did you check |
I removed all of my settings and disabled all of my extensions in VS Code so that it was running in its default state + this extension, I am still not automatically receiving completions using the sample code... 🤔 |
You can only debug by yourself, start from |
Sorry for the delay, I have experienced a few issues while debugging.
|
|
I'm facing the same problem. No fields are offered when entering { |
I traced in debugger what happens when calling auto-completion by symbol ---@class A
---@field p1 integer
---@field p2 integer
---comment
---@param p A
local function f(p) end
f{} I have set two breakpoints in If If I'm not sure if there should be a transition to completion.lua if
|
I commented out the line f{ p1 = 1,
p2 = 2 } IMO, the literal table looks much prettier with spaces next to curly braces. 😄 Therefore, I suggest leaving the behavior of the program as it is now. |
Right, it is caused by |
Thank you ❤️ I am able to get completions by pressing space after starting a table literal. Is there a way to get suggestions when not pressing space though? I agree tables look better with a leading space, it is just that I let my code formatter handle that. Also, apologies I could not debug this - I just kept having problems with getting it to work. I am still unable to set a breakpoint due to "the source file is not loaded"... not sure what it is talking about since I have gotten the debugging to work before. |
You need to set |
Yup, that does the trick. That isn't very intuitive though... I am trying to think of how/where this can be documented... |
Copying over some of my thoughts from elsewhere: I don't really like the solution of turning off I would like to see it fixed in a way that doesn't require an entry in the wiki to use. It is also a weird one to document:
All other completions are intuitive and easy to get and use, why do I have to modify my global settings to receive completions in a table? |
It's hard to describe, you can try to remove |
At moment, you can accept suggestions by pressing enter, but not get suggestion. |
Add a config
|
How are you using the lua-language-server?
Visual Studio Code Extension (sumneko.lua)
Which OS are you using?
Windows
What is the issue affecting?
Completion
Expected Behaviour
When using a defined class as the type for a parameter, the fields of that table should be offered as an autocompletion when calling the function.
For an example, using

@alias
works like so:Actual Behaviour
No autocompletion is automatically offered when using
@class
as the type for a parameter. If you press CTRL + Space, you can make the completions appear, but they will not appear automatically.Nothing is offered:


Until I press CTRL + Space:
Reproduction steps
acceptOptions()
) and place it between the parentheses{
to start a table literalOptions
class. These should automatically be offered.Additional Notes
No response
Log File
No response
The text was updated successfully, but these errors were encountered: