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

Infer correct types from custom include functions #3919

Merged

Conversation

rhys-vdw
Copy link
Contributor

@rhys-vdw rhys-vdw commented Nov 10, 2024

Work done

Configure lua language server to treat VFS.Include, include and shard_include as aliases of require, meaning that the correct types are applied to the return value.

Note that this only affects type inference in IDE and does not have any impact on execution.

Suggested by @saurtron here: #3905 (comment)

Approach advised by lua language server contributor here: LuaLS/lua-language-server#2947

Test steps

  • Open project in VSCode.
  • Hover the return value from a VFS.Include and see that it is correctly typed.

Screenshots:

BEFORE:

image

AFTER:

image

Udpate settings for lua lanugage server so that it treats VFS.Include as require and correctly types the return value.
@rhys-vdw rhys-vdw changed the title Infer correct types from VFS.Include Infer correct types from custom include functions Nov 11, 2024
@Ruwetuin Ruwetuin merged commit 20fc81f into beyond-all-reason:master Nov 13, 2024
@rhys-vdw rhys-vdw deleted the rhys/vfs-include-module-types branch November 14, 2024 22:48
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.

3 participants