Skip to content

Conversation

tomlau10
Copy link
Contributor

closes #2862 (feature request), fixes #2863


This adds supports for using ---@class on rawset(_G, "key", {}) to specify the type of the created global variable:

---@class Test
rawset(_G, "Test", {})
print(Test) -- type: `Test`, instead of just `table`

Implementation details: #2862 (comment)
While implementing this, a bug related to rawset() was discovered and fixed as well: #2863 (comment)

@tomlau10 tomlau10 force-pushed the feat/rawset_with_class branch from 3aa2251 to aa2c2f0 Compare September 25, 2024 03:08
@sumneko sumneko merged commit 6ba0c93 into LuaLS:master Sep 25, 2024
11 checks passed
@sumneko
Copy link
Collaborator

sumneko commented Sep 25, 2024

Thank you!

@tomlau10 tomlau10 deleted the feat/rawset_with_class branch September 25, 2024 12:26
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.

Globals set with rawset are always parsed as a table rawset does not support ---@class annotations

2 participants