Skip to content

Conversation

@b0mbie
Copy link
Contributor

@b0mbie b0mbie commented Jan 16, 2024

Closes #32.

Changes Lua.runtime.special in the language server addon config to make the functions include and IncludeCS be represented by Lua 5.1's dofile.

This was done because using require instead will yield incorrect code completion for the path, as the language server will think you're filling in a require path, which will not work at all. dofile will offer much better completion for paths, and the language server will be able to correctly identify the return type(s) from the function call.

@luttje
Copy link
Owner

luttje commented Jan 16, 2024

Great PR, thanks for helping out.

I take it from your PR that you tested this configuration locally? Does LuaLS indeed function better with this change?

If so let me know and I'll merge it ASAP 😁

@b0mbie
Copy link
Contributor Author

b0mbie commented Jan 16, 2024

image
Using dofile here does provide path completion.

Unfortunately...
image
image
The return type of the call is always ...any, so I made a very incorrect claim about the language server filling in the type. Sorry.
(I could've sworn I had the type be correct at some point...)

@luttje luttje merged commit dcc1d54 into luttje:lua-language-server-addon Jan 16, 2024
@luttje
Copy link
Owner

luttje commented Jan 16, 2024

Ah well that's a shame, but a useful contribution nonetheless thanks to helpful path completion. Thanks again!

@luttje
Copy link
Owner

luttje commented Jan 16, 2024

Hmm oops, I only now noticed the commit is directly to the lua-language-server-addon branch. That branch is automatically kept up to date by a GitHub workflow. I'll update the main to reflect your changes for you

luttje added a commit that referenced this pull request Jan 16, 2024
luttje added a commit that referenced this pull request Jan 16, 2024
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

Successfully merging this pull request may close these issues.

2 participants