lua-language-server icon indicating copy to clipboard operation
lua-language-server copied to clipboard

A language server that offers Lua language support - programmed in Lua

Results 496 lua-language-server issues
Sort by recently updated
recently updated
newest added

Cannot type for-loop variable

[{"_id":"66c84f4ca5570c2d1504c7e2","body":"You can use `@cast` annotation for a workaround, but I think this will be a better alternative to that.","issue_id":1708973900456,"origin_id":1900133305,"user_origin_id":71205197,"create_time":1705659627,"update_time":1705659627,"id":1724403532169,"updated_at":"2024-08-23T08:58:52.169000Z","created_at":"2024-08-23T08:58:52.169000Z"},{"_id":"66c84f4ca5570c2d1504c7e3","body":"`---@param s string`","issue_id":1708973900456,"origin_id":1900207315,"user_origin_id":40318218,"create_time":1705662527,"update_time":1705662527,"id":1724403532173,"updated_at":"2024-08-23T08:58:52.173000Z","created_at":"2024-08-23T08:58:52.173000Z"},{"_id":"66c84f4ca5570c2d1504c7e4","body":"Is that documented somewhere? I feel like it's somewhat unintuitive\n\nMaybe `@type` could also be supported (or even be used instead), since I feel like it's more in line with a variable assignment than a function definition.","issue_id":1708973900456,"origin_id":1900495368,"user_origin_id":43008152,"create_time":1705673606,"update_time":1705673882,"id":1724403532177,"updated_at":"2024-08-23T08:58:52.177000Z","created_at":"2024-08-23T08:58:52.177000Z"}] comment

### How are you using the lua-language-server? NeoVim ### Which OS are you using? Linux ### What is the issue affecting? Type Checking, Diagnostics/Syntax Checking ### Expected Behaviour The variables...

use with craftos-pc indexes PC root dir

[{"_id":"664c73944ecfda50de17c495","body":"So, opening a CraftOS workspace causes **your** computer to be scanned? I thought it already supported other schemes like `craftos-pc:`, but maybe not? It may be that the language server is simply working off the path in the URI and is not receiving the contents of virtual file systems from VS Code.","issue_id":1708973900461,"origin_id":1712524793,"user_origin_id":61925890,"create_time":1694269747,"update_time":1694269747,"id":1716286356992,"updated_at":"2024-05-21T10:12:36.992000Z","created_at":"2024-05-21T10:12:36.992000Z"},{"_id":"664c73944ecfda50de17c496","body":"> So, opening a CraftOS workspace causes **your** computer to be scanned? I thought it already supported other schemes like `craftos-pc:`, but maybe not? It may be that the language server is simply working off the path in the URI and is not receiving the contents of virtual file systems from VS Code.\r\n\r\nYes, exactly - it works off the path in the URI and doesn't actually go through the VFS files. I'm not sure if the language server spec even supports virtual file systems or if it can be correctly implemented - if it can't be, I would much rather it just ignore the VFS (or there be a way for me to ignore it, since there doesn't seem to be a way to configure it as such) than index the whole PC.","issue_id":1708973900461,"origin_id":1712526234,"user_origin_id":19525688,"create_time":1694270108,"update_time":1694270108,"id":1716286356997,"updated_at":"2024-05-21T10:12:36.996000Z","created_at":"2024-05-21T10:12:36.996000Z"},{"_id":"664c73954ecfda50de17c497","body":"I have done some CC:Tweaked remote development stuff in VS Code as well, and as far as I remember, using my own custom scheme for the remote files meant they were not diagnosed. Like you said, though, [it appears to not be supported by the protocol](https:\/\/github.com\/microsoft\/language-server-protocol\/issues\/1264).\r\n\r\nThe language server should only be operating on [allowed schemes](https:\/\/luals.github.io\/wiki\/settings\/#workspacesupportscheme), though.","issue_id":1708973900461,"origin_id":1712533143,"user_origin_id":61925890,"create_time":1694272101,"update_time":1694272101,"id":1716286357003,"updated_at":"2024-05-21T10:12:37.002000Z","created_at":"2024-05-21T10:12:37.002000Z"},{"_id":"664c73954ecfda50de17c498","body":"> The language server should only be operating on [allowed schemes](https:\/\/luals.github.io\/wiki\/settings\/#workspacesupportscheme), though.\r\n\r\nThe documentation is outdated. supportScheme was removed https:\/\/github.com\/LuaLS\/lua-language-server\/blob\/16b9ce9bafbf0f432ab7d1d063e2f18b1ed0c947\/changelog.md?plain=1#L196\r\nSeems like this caused a regression for this particular use-case!","issue_id":1708973900461,"origin_id":1712665846,"user_origin_id":19525688,"create_time":1694304174,"update_time":1694304174,"id":1716286357007,"updated_at":"2024-05-21T10:12:37.006000Z","created_at":"2024-05-21T10:12:37.006000Z"},{"_id":"664c73954ecfda50de17c499","body":"I was able to hotfix it for my local use by basically locally re-adding supportScheme and checking the URI scheme against craftos-pc, but of course this isn't ideal for any updates of the extension. Root dir is not indexed after doing this.\r\n\r\nAs an aside, diagnostics.disableScheme may be a setting that could work around this issue, but I'm not quite sure.","issue_id":1708973900461,"origin_id":1741918351,"user_origin_id":19525688,"create_time":1696124411,"update_time":1696124411,"id":1716286357012,"updated_at":"2024-05-21T10:12:37.012000Z","created_at":"2024-05-21T10:12:37.012000Z"},{"_id":"664c73954ecfda50de17c49a","body":"Hi, I'm the dev of the CraftOS-PC extension. I have known about issues like this for a while, and have never supported using the LLS with the extension. But let me know if there's anything I can do to improve support, though it sounds like the LSP doesn't work with remote filesystems.","issue_id":1708973900461,"origin_id":1742402086,"user_origin_id":6236912,"create_time":1696222824,"update_time":1696222824,"id":1716286357017,"updated_at":"2024-05-21T10:12:37.017000Z","created_at":"2024-05-21T10:12:37.017000Z"},{"_id":"664c73954ecfda50de17c49b","body":"> Hi, I'm the dev of the CraftOS-PC extension. I have known about issues like this for a while, and have never supported using the LLS with the extension. But let me know if there's anything I can do to improve support, though it sounds like the LSP doesn't work with remote filesystems.\r\n\r\nI think the easiest fix for this issue is just for the LSP to **not index** the VFS. The LSP won't work on files in the CraftOS PC. sure. but that means I can still use the LSP for the stuff I am developing without it scanning every Lua file on my PC. I think bringing back supported schemes or some other workaround will probably work best on the LSP side of things, not much you can do from your extension I think.","issue_id":1708973900461,"origin_id":1742462405,"user_origin_id":19525688,"create_time":1696228154,"update_time":1696228154,"id":1716286357022,"updated_at":"2024-05-21T10:12:37.021000Z","created_at":"2024-05-21T10:12:37.021000Z"},{"_id":"664c73954ecfda50de17c49c","body":"This is still an issue and a significant incompatibility.","issue_id":1708973900461,"origin_id":1918735205,"user_origin_id":19525688,"create_time":1706694013,"update_time":1706694013,"id":1716286357026,"updated_at":"2024-05-21T10:12:37.026000Z","created_at":"2024-05-21T10:12:37.026000Z"},{"_id":"66c84f4165e3f042b807be5c","body":"I can confirm this is still an issue.","issue_id":1708973900461,"origin_id":2179419103,"user_origin_id":22381811,"create_time":1718828861,"update_time":1718828861,"id":1724403521828,"updated_at":"2024-08-23T08:58:41.828000Z","created_at":"2024-08-23T08:58:41.828000Z"},{"_id":"66c84f4165e3f042b807be5e","body":"Hi, I fixed it temporary with setting below (inside of my _workspace.json_ in visual studio code):\r\n\r\n```\r\n\"settings\": {\r\n\"Lua.workspace.ignoreDir\": [\"\/**\"]\r\n}\r\n```\r\n\r\nLua extension will still work inside of remote craftos directories and files, however autocompletion from ComputerCraft not. It's still better to use local folder in the same time, work there and eventually drag and drop files to craftos remote directory. ","issue_id":1708973900461,"origin_id":2184053410,"user_origin_id":67278195,"create_time":1719066400,"update_time":1719066400,"id":1724403521834,"updated_at":"2024-08-23T08:58:41.834000Z","created_at":"2024-08-23T08:58:41.834000Z"}] comment

### 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? Other ### Expected Behaviour not...

Generics Super Issue

[{"_id":"66c84f4518409968dc0cfb1c","body":"thanks for putting all these in one place. i found some more edge cases; maybe some of them are listed here already but i'll try to document them more diligently.","issue_id":1708973900464,"origin_id":1410990967,"user_origin_id":18533407,"create_time":1675195484,"update_time":1675195484,"id":1724403525666,"updated_at":"2024-08-23T08:58:45.666000Z","created_at":"2024-08-23T08:58:45.666000Z"},{"_id":"66c84f4518409968dc0cfb1d","body":"When will it get done?","issue_id":1708973900464,"origin_id":1837133184,"user_origin_id":18480287,"create_time":1701518945,"update_time":1701518945,"id":1724403525671,"updated_at":"2024-08-23T08:58:45.670000Z","created_at":"2024-08-23T08:58:45.670000Z"},{"_id":"66c84f4518409968dc0cfb1e","body":"Here's another issue with generics that I don't believe has been documented yet?\r\n\r\n```lua\r\n---@class A\r\n---@field k string\r\n\r\n---@generic T: A\r\n---@param p1 T\r\nfunction f(p1) local m = p1.k end\r\n```\r\n\r\n^^^ here `p1` should have a type of `A` within the function, but it doesn't, therefore `m` receives the type `unknown`","issue_id":1708973900464,"origin_id":1915572121,"user_origin_id":45028928,"create_time":1706562552,"update_time":1721169068,"id":1724403525674,"updated_at":"2024-08-23T08:58:45.673000Z","created_at":"2024-08-23T08:58:45.673000Z"},{"_id":"66c84f4518409968dc0cfb1f","body":"> Here's another issue with generics that I don't believe has been documented yet?\r\n> \r\n> ```lua\r\n> ---@class A\r\n> ---@field k string\r\n> \r\n> ---@generic T: A\r\n> ---@param p1 T\r\n> function f(p1) local m = p1.k end\r\n> ```\r\n> \r\n> ^^^ here `p1` should have a type of `A` within the function, but it doesn't, so `m` receives the type `unknown`\r\n\r\nThis is odd since this use case works **but** you have to use the parameter capture for the generic to get its type and it also only works with base Lua types and not custom classes\r\nsee #2355 description","issue_id":1708973900464,"origin_id":2193697914,"user_origin_id":19525688,"create_time":1719464229,"update_time":1719464229,"id":1724403525677,"updated_at":"2024-08-23T08:58:45.676000Z","created_at":"2024-08-23T08:58:45.676000Z"},{"_id":"66c84f4518409968dc0cfb20","body":"> > Here's another issue with generics that I don't believe has been documented yet?\r\n> > ```lua\r\n> > ---@class A\r\n> > ---@field k string\r\n> > \r\n> > ---@generic T: A\r\n> > ---@param p1 T\r\n> > function f(p1) local m = p1.k end\r\n> > ```\r\n> > \r\n> > \r\n> > \r\n> > \r\n> > \r\n> > \r\n> > \r\n> > \r\n> > \r\n> > \r\n> > \r\n> > ^^^ here `p1` should have a type of `A` within the function, but it doesn't, so `m` receives the type `unknown`\r\n> \r\n> This is odd since this use case works **but** you have to use the parameter capture for the generic to get its type and it also only works with base Lua types and not custom classes see #2355 description\r\n\r\nI wouldn't really consider that to be \"working\". Passing strings at runtime just to get the LSP to work correctly is awkward. In theory this should be an easy fix, as the concrete type is literally right there and apart of the function's signature. It's not much different than getting\/substituting the type of a concrete `@param`, there's just an extra layer of indirection (i.e. `p1` -> `T` -> `A` instead of `p1` -> `T`).","issue_id":1708973900464,"origin_id":2220908112,"user_origin_id":45028928,"create_time":1720627132,"update_time":1720627440,"id":1724403525680,"updated_at":"2024-08-23T08:58:45.679000Z","created_at":"2024-08-23T08:58:45.679000Z"},{"_id":"66c84f4518409968dc0cfb21","body":"> > > Here's another issue with generics that I don't believe has been documented yet?\r\n> > > ```lua\r\n> > > ---@class A\r\n> > > ---@field k string\r\n> > > \r\n> > > ---@generic T: A\r\n> > > ---@param p1 T\r\n> > > function f(p1) local m = p1.k end\r\n> > > ```\r\n> > > \r\n> > > \r\n> > > \r\n> > > \r\n> > > \r\n> > > \r\n> > > \r\n> > > \r\n> > > \r\n> > > \r\n> > > \r\n> > > ^^^ here `p1` should have a type of `A` within the function, but it doesn't, so `m` receives the type `unknown`\r\n> > \r\n> > \r\n> > This is odd since this use case works **but** you have to use the parameter capture for the generic to get its type and it also only works with base Lua types and not custom classes see #2355 description\r\n> \r\n> I wouldn't really consider that to be \"working\". Passing strings at runtime just to get the LSP to work correctly is awkward. In theory this should be an easy fix, as the concrete type is literally right there and apart of the function's signature. It's not much different than getting\/substituting the type of a concrete `@param`, there's just an extra layer of indirection (i.e. `p1` -> `T` -> `A` instead of `p1` -> `T`).\r\n\r\nOh yeah, definitely not \"working\" per se but very odd that it works with strings and only base Lua types. I would think it would literally be easier to implement the other way code wise","issue_id":1708973900464,"origin_id":2221689992,"user_origin_id":19525688,"create_time":1720653607,"update_time":1720653607,"id":1724403525682,"updated_at":"2024-08-23T08:58:45.682000Z","created_at":"2024-08-23T08:58:45.682000Z"}] comment

This "super issue" serves to organize and track all the issues relating to the implementation of generics. Some of the following issues are likely duplicates, so some may just need...

feat/generic

When workspace folders are specified, two workspaces are loaded.

[{"_id":"66c84f45d340b986da0e9c0c","body":"Related to #1089 ","issue_id":1708973900469,"origin_id":1259826316,"user_origin_id":292349,"create_time":1664299679,"update_time":1664299679,"id":1724403525770,"updated_at":"2024-08-23T08:58:45.770000Z","created_at":"2024-08-23T08:58:45.770000Z"},{"_id":"66c84f45d340b986da0e9c0d","body":"Can be improved to lazyload","issue_id":1708973900469,"origin_id":1260722357,"user_origin_id":5213431,"create_time":1664361800,"update_time":1664361800,"id":1724403525774,"updated_at":"2024-08-23T08:58:45.774000Z","created_at":"2024-08-23T08:58:45.774000Z"},{"_id":"66c84f45d340b986da0e9c0e","body":"@carsakiller I once wrote a wiki explaining why there are multiple progress bars, but I can't find it now","issue_id":1708973900469,"origin_id":1260861702,"user_origin_id":5213431,"create_time":1664369524,"update_time":1664369524,"id":1724403525778,"updated_at":"2024-08-23T08:58:45.777000Z","created_at":"2024-08-23T08:58:45.777000Z"},{"_id":"66c84f45d340b986da0e9c0f","body":"I think that got combined into the [Why is the Server Scanning the Wrong Folder?](https:\/\/github.com\/sumneko\/lua-language-server\/wiki\/FAQ#why-is-the-server-scanning-the-wrong-folder) FAQ answer.","issue_id":1708973900469,"origin_id":1260866349,"user_origin_id":61925890,"create_time":1664369692,"update_time":1664369692,"id":1724403525780,"updated_at":"2024-08-23T08:58:45.779000Z","created_at":"2024-08-23T08:58:45.779000Z"},{"_id":"66c84f45d340b986da0e9c10","body":"I don't really remember seeing a progress bar section, but I'll take a look through the history","issue_id":1708973900469,"origin_id":1260867609,"user_origin_id":61925890,"create_time":1664369755,"update_time":1664369755,"id":1724403525782,"updated_at":"2024-08-23T08:58:45.782000Z","created_at":"2024-08-23T08:58:45.782000Z"},{"_id":"66c84f45d340b986da0e9c11","body":"I found this section from the old `How-to-improve-startup-speed.md` file. Is this what you are referring to?\r\n\r\n<details>\r\n<summary>Excerpt<\/summary>\r\n\r\n# \u591a\u8fdb\u5ea6\u6761\/\u5355\u6587\u4ef6\u6a21\u5f0f|Multi progress bar\/Single file mode\r\n\u5728\u9605\u8bfb\u63a5\u4e0b\u6765\u7684\u5185\u5bb9\u4e4b\u524d\uff0c\u8bf7\u5148\u770b\u4e00\u4e0b https:\/\/github.com\/sumneko\/lua-language-server\/wiki\/Multi-workspace-supports\r\n\r\n\u5f53\u4f60\u4ee5\u5355\u6587\u4ef6\u6a21\u5f0f\u542f\u52a8\u670d\u52a1\u5668\u65f6\uff0c\u670d\u52a1\u5668\u53ea\u4f1a\u521b\u5efa `<fallback>` Scope\uff0c\u6240\u6709\u7684Lua\u6587\u4ef6\u90fd\u5728\u6b64\u5904\u7406\u3002\r\n\r\n\u5f53\u4f60\u4ee5\u5de5\u4f5c\u533a\u6a21\u5f0f\u542f\u52a8\u670d\u52a1\u5668\u65f6\uff0c\u670d\u52a1\u5668\u5b9e\u9645\u4e0a\u4f1a\u521b\u5efa2\u4e2aScope\uff0c\u4e00\u4e2a\u662f\u4f60\u7684\u5de5\u4f5c\u533a\uff0c\u53e6\u4e00\u4e2a\u5219\u662f `<fallback>` \u3002\u5f53\u4f60\u6253\u5f00\u4e00\u4e2a\u4e0d\u5c5e\u4e8e\u5de5\u4f5c\u533a\u7684Lua\u6587\u4ef6\u65f6\uff0c\u8be5\u6587\u4ef6\u4f1a\u88ab\u653e\u7f6e\u5230 `<fallback>` \u4e2d\uff0c\u4ee5\u514d\u8be5\u6587\u4ef6\u7684\u5168\u5c40\u53d8\u91cf\u6c61\u67d3\u4f60\u7684\u5de5\u4f5c\u533a\u73af\u5883\u3002\r\n\r\n\u7531\u4e8e\u6211\u7684\u5f00\u53d1\u73af\u5883\u662fVSCode\uff0c\u800cVSCode\u53ef\u4ee5\u7b80\u5355\u7684\u4e3a\u4e0d\u540c\u7684\u5de5\u4f5c\u533a\u8fdb\u884c\u4e0d\u540c\u7684\u8bbe\u7f6e\uff0c\u56e0\u6b64\u6211\u505a\u51fa\u4e86\u4ee5\u4e0b\u5047\u8bbe\uff1a\r\n* \u7528\u6237\u4f1a\u7ed9\u5de5\u4f5c\u533a\u5355\u72ec\u8bbe\u7f6e `workspace.library`\uff0c\u56e0\u4e3aLua\u7684\u80fd\u529b\u4e3b\u8981\u7531\u5bbf\u4e3b\u63d0\u4f9b\uff0c\u800c\u4e0d\u540c\u7684\u5de5\u4f5c\u533a\u4e00\u822c\u4f1a\u5bf9\u5e94\u4e0d\u540c\u7684\u5bbf\u4e3b\r\n* \u7528\u6237\u4e0d\u4f1a\u7ed9\u5168\u5c40\u8bbe\u7f6e `workspace.library` \uff0c\u56e0\u4e3a\u5b83\u7684\u4e3b\u8981\u76ee\u7684\u662f\u5feb\u901f\u7684\u770b\u4e00\u4e0b\u67d0\u4e2a\u73af\u5883\u672a\u77e5\/\u4e0d\u9700\u8981\u73af\u5883\u7684Lua\u4ee3\u7801\u3002\r\n\r\n\u4f46\u6700\u8fd1\u7684\u7528\u6237\u53cd\u9988\u8ba9\u6211\u53d1\u73b0\u4e86\u4e00\u4e2a\u95ee\u9898\uff0c\u5728\u975eVSCode\u73af\u5883\u4e2d\u7528\u6237\u4e0d\u65b9\u4fbf\u7ed9\u6bcf\u4e2a\u5de5\u4f5c\u533a\u8fdb\u884c\u5355\u72ec\u8bbe\u7f6e\uff08\u867d\u7136\u6211\u4e5f\u63d0\u4f9b\u4e86 `.luarc.json` \u7684\u65b9\u5f0f\uff09\uff0c\u5f88\u591a\u4eba\u76f4\u63a5\u4f1a\u5728\u5168\u5c40\u8bbe\u7f6e\u4e2d\u8bbe\u7f6e `workspace.library`\uff0c\u5f53 library \u8f83\u5927\u65f6\u5bfc\u81f4\u4e86\u4e00\u4e9b\u95ee\u9898\uff1a\r\n* \u4ee5\u5355\u6587\u4ef6\u6a21\u5f0f\u542f\u52a8\u670d\u52a1\u5668\u65f6\uff0c\u542f\u52a8\u901f\u5ea6\u4f1a\u88ab library \u5f71\u54cd\uff0c\u5bfc\u81f4\u4f60\u660e\u660e\u53ea\u662f\u60f3\u5feb\u901f\u7684\u770b\u4e00\u4e0b\u67d0\u4e00\u6bb5Lua\u4ee3\u7801\uff0c\u5374\u9700\u8981\u7b49\u5f85\u6f2b\u957f\u7684\u52a0\u8f7d\u65f6\u95f4\u3002\r\n* \u4ee5\u5de5\u4f5c\u533a\u6a21\u5f0f\u542f\u52a8\u670d\u52a1\u5668\u65f6\uff0c\u4f1a\u770b\u5230\u591a\u4e2a\u8fdb\u5ea6\u6761\u3002\u5982\u679c `<fallback>` \u53ea\u9700\u8981\u52a0\u8f7d\u57fa\u7840\u7684Lua API\u901a\u5e38\u53ef\u4ee5\u57280.5\u79d2\u5185\u5b8c\u6210\uff08\u8fdb\u5ea6\u6761\u67090.5\u79d2\u7684\u663e\u793a\u5ef6\u8fdf\uff09\uff0c\u8fd9\u4f7f\u5f97\u4f60\u4e0d\u4f1a\u770b\u5230 `<fallback>` \u7684\u52a0\u8f7d\u8fdb\u5ea6\u6761\u3002\u4f46 `<fallback>` \u53d7\u5230 library \u5f71\u54cd\u540e\u4e5f\u9700\u8981\u52a0\u8f7d\u5f88\u591a\u6587\u4ef6\uff0c\u8fd9\u5bfc\u81f4\u4f60\u4f1a\u770b\u5230\u591a\u4e2a\u8fdb\u5ea6\u6761\u3002\u4e0d\u8fc7\u8fd9\u4e0d\u4f1a\u5f71\u54cd\u5b9e\u9645\u7684\u52a0\u8f7d\u901f\u5ea6\uff0c\u56e0\u4e3a\u540c\u4e00\u4e2a\u6587\u4ef6\u53ea\u4f1a\u88ab\u52a0\u8f7d\u4e00\u6b21\u3002\r\n\r\n\u4ecb\u4e8e\u8fd9\u4e2a\u60c5\u51b5\uff0c\u6211\u5728\u8003\u8651\u6dfb\u52a0\u4e00\u4e2a\u9ed8\u8ba4\u5f00\u542f\u7684\u8bbe\u7f6e\uff0c\u4f7f\u5f97 `<fallback>` \u53ef\u4ee5\u5ffd\u7565 `workspace.library` \u3002\r\n\r\n-----------------------------------------------\r\n\r\nPlease take a look before reading the following content: https:\/\/github.com\/sumneko\/lua-language-server\/wiki\/Multi-workspace-supports\r\n\r\nWhen you start the server in single file mode, the server will only create a `<fallback>` scope, and all Lua files will be processed here.\r\n\r\nWhen you start the server in workspace mode, the server will actually create two scopes, one is your workspace, and the other is the `<fallback>`. When you open a Lua file that does not belong to the workspace, the file will be placed in `<fallback>` to prevent the global variables of the file from polluting your workspace environment.\r\n\r\nSince my development environment is VSCode, and VSCode can simply set different settings for different workspaces, I make the following assumptions:\r\n* The user will set the `workspace.library` separately for workspaces, because Lua's capabilities are mainly provided by the host, and different workspaces generally correspond to different hosts.\r\n* The user will not set global `workspace.library`, because its main purpose is to quickly look at the Lua code of an unknown\/unnecessary environment.\r\n\r\nHowever, I found a problem in the recent user feedback. In the non VSCode client, it is not convenient for users to set each workspace separately (although I provided `.luarc.json`), many people directly set `workspace.library` in the global setting, which causes some problems when the library is very large:\r\n* When you start the server in single file mode, the startup speed will be affected by the library, so you just want to take a quick look at Lua code, but you need to wait for a long loading time.\r\n* When you start the server in workspace mode, you will see multiple progress bars. If `<fallback>` only needs to load the basic Lua API, it can usually be completed in 0.5 sec (the progress bar has a display delay of 0.5 sec), so you won't see the loading progress bar of `<fallback>` at all. But `<fallback>` also need to load many files after affecting by the library, which leads you to see multiple progress bars. Fortunately this will not affect the actual loading speed, because the same file will only be loaded once.\r\n\r\nIn this case, I'm considering adding a setting enabled by default, witch makes `<fallback>` ignore `workspace.library`.\r\n\r\n<\/details>\r\n\r\nIt looks like I forgot to include the progress bar part. This could be its own FAQ question.","issue_id":1708973900469,"origin_id":1260881130,"user_origin_id":61925890,"create_time":1664370216,"update_time":1664370241,"id":1724403525785,"updated_at":"2024-08-23T08:58:45.785000Z","created_at":"2024-08-23T08:58:45.785000Z"},{"_id":"66c84f45d340b986da0e9c12","body":"Yes","issue_id":1708973900469,"origin_id":1260882847,"user_origin_id":5213431,"create_time":1664370305,"update_time":1664370305,"id":1724403525788,"updated_at":"2024-08-23T08:58:45.787000Z","created_at":"2024-08-23T08:58:45.787000Z"},{"_id":"66c84f45d340b986da0e9c13","body":"Added as a new [FAQ question](https:\/\/github.com\/sumneko\/lua-language-server\/wiki\/FAQ#why-are-there-two-workspacesprogress-bars) \ud83d\ude42","issue_id":1708973900469,"origin_id":1260935726,"user_origin_id":61925890,"create_time":1664372534,"update_time":1664372534,"id":1724403525791,"updated_at":"2024-08-23T08:58:45.791000Z","created_at":"2024-08-23T08:58:45.791000Z"},{"_id":"66c84f45d340b986da0e9c14","body":"Awesome, thank you for the FAQ :)\r\n\r\nI'm looking to see how I can fix this in Neovim\/lspconfig.\r\n\r\nIt seems that the fallback (single file) config still indexes all files in the rootDir.","issue_id":1708973900469,"origin_id":1261083295,"user_origin_id":292349,"create_time":1664378889,"update_time":1664378889,"id":1724403525865,"updated_at":"2024-08-23T08:58:45.865000Z","created_at":"2024-08-23T08:58:45.865000Z"},{"_id":"66c84f45d340b986da0e9c15","body":"But reading the FAQ, this is likely not a problem, since it will actually index every file only once?","issue_id":1708973900469,"origin_id":1261094547,"user_origin_id":292349,"create_time":1664379415,"update_time":1664379415,"id":1724403525868,"updated_at":"2024-08-23T08:58:45.868000Z","created_at":"2024-08-23T08:58:45.868000Z"},{"_id":"66c84f45d340b986da0e9c16","body":"> But reading the FAQ, this is likely not a problem, since it will actually index every file only once?\r\n\r\nYes, but I can consider changing into lazy loading or loading in turn, try not to show multiple progress bars.","issue_id":1708973900469,"origin_id":1261234489,"user_origin_id":5213431,"create_time":1664386270,"update_time":1664386270,"id":1724403525873,"updated_at":"2024-08-23T08:58:45.872000Z","created_at":"2024-08-23T08:58:45.872000Z"},{"_id":"66c84f45d340b986da0e9c17","body":"> I'm looking to see how I can fix this in Neovim\/lspconfig.\r\n> \r\n> It seems that the fallback (single file) config still indexes all files in the rootDir.\r\n\r\nMy understanding is that lua-language-server sends two `workspace\/configuration` requests to the LSP client: one with `scopeUri` being the workspace folder, and another with `scopeUri` being absent (or `nil`). The latter is for settings of the fallback scope. Unfortunately neovim's LSP implementation completely ignores `scopeUri` and responds with the same settings to both, and this is what causes lua-l-s to show two progress bars.\r\n\r\nA possible workaround is to teach neovim to look at `scopeUri`:\r\n\r\n```lua\r\nlocal lspconfig = require 'lspconfig'\r\nlspconfig.util.on_setup = lspconfig.util.add_hook_after(lspconfig.util.on_setup, function(config)\r\n\tif config.name == 'lua_ls' then\r\n\t\t-- workaround for nvim's incorrect handling of scopes in the workspace\/configuration handler\r\n\t\t-- https:\/\/github.com\/folke\/neodev.nvim\/issues\/41\r\n\t\t-- https:\/\/github.com\/LuaLS\/lua-language-server\/issues\/1089\r\n\t\t-- https:\/\/github.com\/LuaLS\/lua-language-server\/issues\/1596\r\n\t\tconfig.handlers = vim.tbl_extend('error', {}, config.handlers)\r\n\t\tconfig.handlers['workspace\/configuration'] = function(...)\r\n\t\t\tlocal _, result, ctx = ...\r\n\t\t\tlocal client_id = ctx.client_id\r\n\t\t\tlocal client = vim.lsp.get_client_by_id(client_id)\r\n\t\t\tif client and client.workspace_folders and #client.workspace_folders then\r\n\t\t\t\tif result.items and #result.items > 0 then\r\n\t\t\t\t\tif not result.items[1].scopeUri then\r\n\t\t\t\t\t\treturn vim.tbl_map(function(_) return nil end, result.items)\r\n\t\t\t\t\tend\r\n\t\t\t\tend\r\n\t\t\tend\r\n\r\n\t\t\treturn vim.lsp.handlers['workspace\/configuration'](...)\r\n\t\tend\r\n\tend\r\nend)\r\n```\r\n\r\nBut yeah, if lua-l-s could optionally ignore `workspace.library` for the fallback scope if there's at least one workspace folder, that would greatly improve compatibility with non VS Code clients \ud83d\ude42","issue_id":1708973900469,"origin_id":1855087288,"user_origin_id":300342,"create_time":1702526039,"update_time":1706004325,"id":1724403525876,"updated_at":"2024-08-23T08:58:45.876000Z","created_at":"2024-08-23T08:58:45.876000Z"},{"_id":"66c84f45d340b986da0e9c18","body":"> But yeah, if lua-l-s could optionally ignore `workspace.library` for the fallback scope if there's at least one workspace folder, that would greatly improve compatibility with non VS Code clients \ud83d\ude42\r\n\r\n@liskin thank you for this workaround! In your opinion is this something we should apply for performance (or any other) reasons? Or is the only problem with the double loader the fact that the loader is shown twice in UI? as opposed to any actual performance impact?","issue_id":1708973900469,"origin_id":1905488345,"user_origin_id":64155612,"create_time":1705997060,"update_time":1705997060,"id":1724403525879,"updated_at":"2024-08-23T08:58:45.879000Z","created_at":"2024-08-23T08:58:45.879000Z"},{"_id":"66c84f45d340b986da0e9c19","body":"> @liskin thank you for this workaround!\r\n\r\nI just updated the workaround to a better version that only overrides the handlers for lua_ls to avoid interfering with other language servers.\r\n\r\n> In your opinion is this something we should apply for performance (or any other) reasons? Or is the only problem with the double loader the fact that the loader is shown twice in UI? as opposed to any actual performance impact?\r\n\r\nHm, I just tested this and it seems that there isn't actually any performance difference. I wouldn't have expected that :-)\r\nSo it's probably more of a confusion than an actual performance\/behaviour issue.","issue_id":1708973900469,"origin_id":1905716942,"user_origin_id":300342,"create_time":1706004677,"update_time":1706004677,"id":1724403525883,"updated_at":"2024-08-23T08:58:45.882000Z","created_at":"2024-08-23T08:58:45.882000Z"},{"_id":"66c84f45d340b986da0e9c1a","body":"I just added something based on this to neodev: https:\/\/github.com\/folke\/neodev.nvim\/commit\/c6be05aab078827e51aabdc64cc9fba7c06d27b7\r\n\r\nBut indeed it probably doesn't make a difference performance wise, since luals won't index files multiple times.\r\n\r\nEither way, it will at least stop people reporting this issue for LazyVim, neodev etc....","issue_id":1708973900469,"origin_id":1905757027,"user_origin_id":292349,"create_time":1706006130,"update_time":1706006130,"id":1724403525885,"updated_at":"2024-08-23T08:58:45.884000Z","created_at":"2024-08-23T08:58:45.884000Z"},{"_id":"66c84f45d340b986da0e9c1b","body":"@folke I still am having the problem with losing some of the global vim references after peeking a different file. I opened a new issue as requested here: https:\/\/github.com\/folke\/neodev.nvim\/issues\/178 (repeating this message here as I find it hard sometimes to find comments within commits which is where I pinged you a few minutes ago here: https:\/\/github.com\/folke\/neodev.nvim\/commit\/c6be05aab078827e51aabdc64cc9fba7c06d27b7#r137715953).","issue_id":1708973900469,"origin_id":1908175534,"user_origin_id":64155612,"create_time":1706104661,"update_time":1706104704,"id":1724403525962,"updated_at":"2024-08-23T08:58:45.962000Z","created_at":"2024-08-23T08:58:45.962000Z"},{"_id":"66c84f45d340b986da0e9c1c","body":"the same issue . I think this need to solve ","issue_id":1708973900469,"origin_id":1913981826,"user_origin_id":44041710,"create_time":1706505614,"update_time":1706505614,"id":1724403525966,"updated_at":"2024-08-23T08:58:45.966000Z","created_at":"2024-08-23T08:58:45.966000Z"}] comment

https://github.com/sumneko/lua-language-server/blob/25acc18ff5ec25d5cf4a052dfba11c777847f86e/script/provider/provider.lua#L55 Shouldn't the `fallback` config **only** be loaded when `#scope.folders == 0`?

enhancement

### How are you using the lua-language-server? Visual Studio Code Extension (sumneko.lua) ### Which OS are you using? Linux ### What is the issue affecting? Diagnostics/Syntax Checking ### Expected Behaviour...

Feature Request: Error When Using Non-Existant Enum Value

[{"_id":"66c84f3165e3f042b807be4f","body":"yesss exactly that would be amazing","issue_id":1708973900483,"origin_id":1913179438,"user_origin_id":30127664,"create_time":1706367392,"update_time":1706367392,"id":1724403505020,"updated_at":"2024-08-23T08:58:25.020000Z","created_at":"2024-08-23T08:58:25.020000Z"}] comment

It would be nice when trying to use a non-extistant enum value in a function there was a warning. Ex: ``` ---@enum TestEnum TestEnum = { ONE = "ONE", TWO...

enhancement

enum error

[{"_id":"66c84f4865e3f042b807be63","body":"related #2377","issue_id":1708973900490,"origin_id":1883132979,"user_origin_id":43112758,"create_time":1704809951,"update_time":1704809951,"id":1724403528780,"updated_at":"2024-08-23T08:58:48.779000Z","created_at":"2024-08-23T08:58:48.779000Z"},{"_id":"66c84f4865e3f042b807be64","body":"I use enums generated at runtime and since there is no way to annotate a variable as `@enum`\r\nI generate additional `@class` like this:\r\n\r\n```lua\r\n---@diagnostic disable: unused-local\r\n--luacheck: ignore\r\n\r\n---@enum Status\r\nlocal _ = {\r\n\tUNKNOWN = 0,\r\n\tNEW = 1,\r\n\tOLD = 2,\r\n}\r\n\r\n---@class Status.enum: {}\r\n---@field UNKNOWN Status|Status.UNKNOWN: 0\r\n---@field NEW Status|Status.NEW: 1\r\n---@field OLD Status|Status.OLD: 2\r\n\r\n---@return Status.enum\r\nlocal function generate_enum()\r\n\treturn {}\r\nend\r\n\r\nlocal Status = generate_enum()\r\n\r\n---@type Status.OLD\r\nlocal s_old = Status.OLD\r\n\r\n---@type Status\r\nlocal s = Status.UNKNOWN\r\ns = Status.NEW\r\ns = Status.OLD\r\ns = Status.QWE -- Undefined field `QWE`\r\n\r\ns = 0\r\n\r\n```\r\n\r\nI would also like `= 0` to throw warning","issue_id":1708973900490,"origin_id":1883225485,"user_origin_id":43112758,"create_time":1704812867,"update_time":1704812867,"id":1724403528783,"updated_at":"2024-08-23T08:58:48.782000Z","created_at":"2024-08-23T08:58:48.782000Z"},{"_id":"66c84f4865e3f042b807be65","body":"yes. Its kinda pointless to have enum if no errors are thrown when you use invalid values\r\n\r\ni'm having to use a class instead\r\n\r\n```\r\n---@class sfxChar\r\n---@field jump string\r\n---@field get_item string\r\n\r\nsfxChar = {\r\n jump = 'jump',\r\n get_item = 'get_item',\r\n}\r\n\r\nfunction lol()\r\n print(sfxChar.blaaaa); -- throws error\r\nend\r\n\r\n```","issue_id":1708973900490,"origin_id":1913141102,"user_origin_id":30127664,"create_time":1706358197,"update_time":1706358197,"id":1724403528785,"updated_at":"2024-08-23T08:58:48.784000Z","created_at":"2024-08-23T08:58:48.784000Z"},{"_id":"66c84f4865e3f042b807be66","body":"Simpler example which also fails:\r\n\r\n```lua\r\n ---@enum NPBehaveNodeState\r\n NPBehaveNodeState = {\r\n Inactive = 'Inactive',\r\n Active = 'Active',\r\n StopRequested = 'StopRequested',\r\n }\r\n\r\n ---@type NPBehaveNodeState\r\n local test\r\n\r\n -- this errors correctly\r\n test = 'Active123'\r\n\r\n -- this doesn't error, incorrect\r\n test = NPBehaveNodeState.Active123\r\n```\r\n\r\nBasically it only validates when passed a literal (string in this case)...","issue_id":1708973900490,"origin_id":2282732449,"user_origin_id":45028928,"create_time":1723377068,"update_time":1723377248,"id":1724403528788,"updated_at":"2024-08-23T08:58:48.787000Z","created_at":"2024-08-23T08:58:48.787000Z"},{"_id":"66c84f4865e3f042b807be67","body":"duplicate of https:\/\/github.com\/LuaLS\/lua-language-server\/issues\/2384\r\n\r\nAnd as I commented there:https:\/\/github.com\/LuaLS\/lua-language-server\/issues\/2384#issuecomment-2198052928, `undefined-field` diagnostics only check for typed tables (for performance reason I guess), but the **enum binded table** are not typed. If somehow the binded tables can be marked with some special flags, then maybe they can also be checked in the `undefined-field` diagnostics \ud83d\ude15 \r\n\r\n---\r\n\r\nCurrently my workaround is to **also annotate the table with `---@class`**:\r\n```lua\r\n---@enum TestEnum.*\r\nlocal TestEnum = { ---@class TestEnum\r\n a = 1,\r\n b = 2,\r\n c = 3,\r\n}\r\n\r\n---@type TestEnum.*\r\nlocal a = TestEnum.a --< ok\r\n\r\n---@type TestEnum.*\r\nlocal d = TestEnum.d --< undefined field\r\n```","issue_id":1708973900490,"origin_id":2282994269,"user_origin_id":16996876,"create_time":1723427539,"update_time":1723427539,"id":1724403528791,"updated_at":"2024-08-23T08:58:48.790000Z","created_at":"2024-08-23T08:58:48.790000Z"},{"_id":"66c84f4865e3f042b807be68","body":"> duplicate of #2384\r\n> \r\n> And as I commented there:[#2384 (comment)](https:\/\/github.com\/LuaLS\/lua-language-server\/issues\/2384#issuecomment-2198052928), `undefined-field` diagnostics only check for typed tables (for performance reason I guess), but the **enum binded table** are not typed. If somehow the binded tables can be marked with some special flags, then maybe they can also be checked in the `undefined-field` diagnostics \ud83d\ude15\r\n> \r\n> Currently my workaround is to **also annotate the table with `---@class`**:\r\n> \r\n> ```lua\r\n> ---@enum TestEnum.*\r\n> local TestEnum = { ---@class TestEnum\r\n> a = 1,\r\n> b = 2,\r\n> c = 3,\r\n> }\r\n> \r\n> ---@type TestEnum.*\r\n> local a = TestEnum.a --< ok\r\n> \r\n> ---@type TestEnum.*\r\n> local d = TestEnum.d --< undefined field\r\n> ```\r\n\r\nFUCK ME THIS WORKS THANSK\r\n\r\nU R THE HERO OF THE DAY\r\n\r\ngonna make a replace macro right now","issue_id":1708973900490,"origin_id":2289269041,"user_origin_id":30127664,"create_time":1723653412,"update_time":1723653412,"id":1724403528795,"updated_at":"2024-08-23T08:58:48.794000Z","created_at":"2024-08-23T08:58:48.794000Z"},{"_id":"66c84f4865e3f042b807be69","body":"```\r\n---@enum (.*)\r\n(.*)\\{\r\n\r\n---@enum $1.*\r\n$2{ ---@class $1\r\n```\r\n\r\nif anyone wants to replace","issue_id":1708973900490,"origin_id":2289285344,"user_origin_id":30127664,"create_time":1723653711,"update_time":1723653711,"id":1724403528798,"updated_at":"2024-08-23T08:58:48.797000Z","created_at":"2024-08-23T08:58:48.797000Z"},{"_id":"66c84f4865e3f042b807be6a","body":"Actually you don't need to follow my annotation practice exactly \ud83d\ude02 (I mean the TestEnum`.*`)\r\nYou can keep you enum type name as `TestEnum`, then name the underlying class to something like `_TestEnum`.\r\nThe key point is **also annotate the table with `---@class`** (with whichever name you want)\r\n\r\nMaybe that way you can modify less codes @dganzella \r\n\r\n---\r\n\r\nThe following should also work\r\n```lua\r\n---@enum TestEnum\r\nlocal TestEnum = { ---@class _TestEnum\r\n a = 1,\r\n b = 2,\r\n c = 3,\r\n}\r\n\r\n---@type TestEnum\r\nlocal a = TestEnum.a --< ok\r\n\r\n---@type TestEnum\r\nlocal d = TestEnum.d --< undefined field\r\n```","issue_id":1708973900490,"origin_id":2290448874,"user_origin_id":16996876,"create_time":1723690714,"update_time":1723690940,"id":1724403528800,"updated_at":"2024-08-23T08:58:48.799000Z","created_at":"2024-08-23T08:58:48.799000Z"},{"_id":"66c84f4865e3f042b807be6b","body":"> Actually you don't need to follow my annotation practice exactly \ud83d\ude02 (I mean the TestEnum`.*`)\n> You can keep you enum type name as `TestEnum`, then name the underlying class to something like `_TestEnum`.\n> The key point is **also annotate the table with `---@class`** (with whichever name you want)\n> \n> Maybe that way you can modify less codes @dganzella \n> \n> ---\n> \n> The following should also work\n> ```lua\n> ---@enum TestEnum\n> local TestEnum = { ---@class _TestEnum\n> a = 1,\n> b = 2,\n> c = 3,\n> }\n> \n> ---@type TestEnum\n> local a = TestEnum.a --< ok\n> \n> ---@type TestEnum\n> local d = TestEnum.d --< undefined field\n> ```\n\nhaha yes I noticed that and changed the replace macro to add the .* to the class annotation instead of the enum\n\nI did like the .*\n\nAnyway, I was INSTANTLY able to spot two snaeaky issues in my code. Thank you","issue_id":1708973900490,"origin_id":2290458612,"user_origin_id":30127664,"create_time":1723691156,"update_time":1723691209,"id":1724403528802,"updated_at":"2024-08-23T08:58:48.801000Z","created_at":"2024-08-23T08:58:48.801000Z"},{"_id":"66c84f4865e3f042b807be6c","body":"@sumneko please fix","issue_id":1708973900490,"origin_id":2290468236,"user_origin_id":90585805,"create_time":1723691590,"update_time":1723691590,"id":1724403528805,"updated_at":"2024-08-23T08:58:48.804000Z","created_at":"2024-08-23T08:58:48.804000Z"},{"_id":"66c84f4865e3f042b807be6d","body":"> @sumneko please fix\n\n@sumneko is quite the character\n\n- makes an amazing tool with just a simple missing feature\n- refuses to elaborate\n- leaves\n\ngigachad","issue_id":1708973900490,"origin_id":2290492419,"user_origin_id":30127664,"create_time":1723692778,"update_time":1723692828,"id":1724403528808,"updated_at":"2024-08-23T08:58:48.807000Z","created_at":"2024-08-23T08:58:48.807000Z"},{"_id":"66c84f4865e3f042b807be6e","body":"Like many of us, the author has a full time job. \ud83d\ude05 The amazing thing about open source projects is that **contributions are welcome**, and maybe we can fix something that we desperately want on our own. \ud83d\udc40 ","issue_id":1708973900490,"origin_id":2290514067,"user_origin_id":16996876,"create_time":1723693764,"update_time":1723693764,"id":1724403528810,"updated_at":"2024-08-23T08:58:48.809000Z","created_at":"2024-08-23T08:58:48.809000Z"},{"_id":"66c84f4865e3f042b807be6f","body":"> Like many of us, the author has a full time job. \ud83d\ude05 The amazing thing about open source projects is that **contributions are welcome**, and maybe we can fix something that we desperately want on our own. \ud83d\udc40 \n\n\ud83d\udc40 The amazing thing is that we would need to learn the entire thing just to make something that clearly can be easily done by him since the behaviour is present in other annotations. It's not a different feature or some kind of extension.\n\nOf course I know he is not obliged to do anything, I'm not retarded, the funny thing is just to run a marathon just to give up 2 meters from the goal. And its just a fun remark, not an actual complaint.","issue_id":1708973900490,"origin_id":2290712202,"user_origin_id":30127664,"create_time":1723701321,"update_time":1723701364,"id":1724403528812,"updated_at":"2024-08-23T08:58:48.812000Z","created_at":"2024-08-23T08:58:48.812000Z"},{"_id":"66c84f4865e3f042b807be70","body":"Temporary solution:\r\nModify` C:\\Users\\<UserName>\\.vscode\\extensions\\sumneko.lua-3.10.3-win32-x64\\server`\r\n```diff\r\nIndex: script\/vm\/compiler.lua\r\nIDEA additional info:\r\nSubsystem: com.intellij.openapi.diff.impl.patch.CharsetEP\r\n<+>UTF-8\r\n===================================================================\r\ndiff --git a\/script\/vm\/compiler.lua b\/script\/vm\/compiler.lua\r\n--- a\/script\/vm\/compiler.lua\t(revision 2fe2ff371a8d2ee97a46c1b48eb421d9f8ee65ad)\r\n+++ b\/script\/vm\/compiler.lua\t(date 1723768685862)\r\n@@ -73,6 +73,24 @@\r\n return false\r\n end\r\n \r\n+-- \u8be5\u51fd\u6570\u6709\u526f\u4f5c\u7528\uff0c\u4f1a\u7ed9source\u7ed1\u5b9anode\uff01\r\n+---@param source parser.object\r\n+---@return boolean\r\n+function vm.bindDocsEnum(source)\r\n+ local docs = source.value.bindDocs\r\n+ if not docs then\r\n+ return false\r\n+ end\r\n+ for i = #docs, 1, -1 do\r\n+ local doc = docs[i]\r\n+ if doc.type == 'doc.enum' then\r\n+ vm.setNode(source, vm.compileNode(doc))\r\n+ return true\r\n+ end\r\n+ end\r\n+ return false\r\n+end\r\n+\r\n ---@param source parser.object | vm.variable\r\n ---@param key string|vm.global|vm.ANY\r\n ---@param pushResult fun(res: parser.object, markDoc?: boolean)\r\n@@ -1105,6 +1123,8 @@\r\n local hasMarkDoc\r\n if source.bindDocs then\r\n hasMarkDoc = vm.bindDocs(source)\r\n+ elseif source.value and source.value.bindDocs then\r\n+ hasMarkDoc = vm.bindDocsEnum(source)\r\n end\r\n local hasMarkParam\r\n if not hasMarkDoc then\r\n```\r\n\r\n\r\nThe structure of Enum is not consistent with that of Class, but the error from Class was borrowed here, so this solution is temporary.\r\n\r\n@sumneko can pr?","issue_id":1708973900490,"origin_id":2292526232,"user_origin_id":90585805,"create_time":1723769613,"update_time":1723770298,"id":1724403528815,"updated_at":"2024-08-23T08:58:48.814000Z","created_at":"2024-08-23T08:58:48.814000Z"},{"_id":"66c84f4865e3f042b807be71","body":"I tested the patch and it works (can throw undefined error) \ud83c\udf89 .\r\nBut seems there is a **side effect**:\r\n- when hover preview over the table, the content is displayed **twice**\r\n![image](https:\/\/github.com\/user-attachments\/assets\/79dca885-864b-4c28-acb2-7c04aa3ea8df)\r\n\r\nI guess it's because now the **enum type** is injected into this table (through the `vm.setNode` in `vm.bindDocsEnum`) \ud83e\udd14 \r\n","issue_id":1708973900490,"origin_id":2292559659,"user_origin_id":16996876,"create_time":1723771920,"update_time":1723771920,"id":1724403528817,"updated_at":"2024-08-23T08:58:48.817000Z","created_at":"2024-08-23T08:58:48.817000Z"},{"_id":"66c84f4865e3f042b807be72","body":"I will look into it today","issue_id":1708973900490,"origin_id":2292904253,"user_origin_id":5213431,"create_time":1723789880,"update_time":1723789880,"id":1724403528819,"updated_at":"2024-08-23T08:58:48.819000Z","created_at":"2024-08-23T08:58:48.819000Z"},{"_id":"66c84f4865e3f042b807be73","body":"enum \u7684\u95ee\u9898\u6709\u70b9\u590d\u6742\uff0c\u89c1\u4e0b\u9762\u8fd9\u4e2a\u4f8b\u5b50\uff1a\r\n\r\n```lua\r\n---@enum A\r\nlocal t = {\r\n x = 1,\r\n y = 2,\r\n}\r\n\r\n---@param x A\r\nlocal function f(x) end\r\n```\r\n\r\n\u4ece\u4e0b\u9762\u7684\u7528\u6cd5\u6765\u770b\uff0c`A` \u5176\u5b9e\u7b49\u4ef7\u4e8e `---@alias A 1|2`\uff0c\u95ee\u9898\u662f `local t` \u662f\u4ec0\u4e48\uff1f\r\n\u76ee\u524d\u7684\u5b9e\u73b0\u91cc\uff0c`t` \u4ec0\u4e48\u90fd\u4e0d\u662f\uff0c\u76f4\u63a5\u6ca1\u6709\u548c\u4efb\u4f55 doc \u8fdb\u884c\u7ed1\u5b9a\uff0c\u8fd9\u5c31\u662f\u4e3a\u4ec0\u4e48\u4f7f\u7528 `t.z` \u4e0d\u4f1a\u51fa\u73b0\u8b66\u544a\u3002\r\n\r\n\u5982\u679c\u4e00\u5b9a\u8981\u7ed9 `t` \u4e00\u4e2a\u7c7b\u578b\uff0c\u90a3\u4e48\u5e94\u8be5\u662f `{ [any]: A }` \uff0c\u56e0\u6b64\u4f60\u4e0d\u80fd\u5c06 `A` \u76f4\u63a5\u7ed1\u5b9a\u7ed9 `t`\u3002\r\n\r\n\u6211\u76ee\u524d\u7684\u60f3\u6cd5\u662f\u751f\u6210\u4e00\u4e2a\u7279\u6b8a\u547d\u540d\u7684class\u7ed9 `t` \u3002","issue_id":1708973900490,"origin_id":2293222122,"user_origin_id":5213431,"create_time":1723802721,"update_time":1723802721,"id":1724403528822,"updated_at":"2024-08-23T08:58:48.821000Z","created_at":"2024-08-23T08:58:48.821000Z"},{"_id":"66c84f4865e3f042b807be74","body":"\u6539\u7684\u65f6\u5019\u5c31\u53d1\u73b0\u4e86, `enum`\u5e76\u4e0d\u662f\u72ec\u7acb\u7684\u7c7b\u578b, \u6211\u89c9\u5f97\u7ed9`enum`\u7c7b\u578b\u52a0\u4e2a\u72ec\u6709\u5b57\u6bb5\u7528\u4e8e\u8bca\u65ad\u672a\u5b9a\u4e49\u7684\u503c\u6700\u7b80\u5355","issue_id":1708973900490,"origin_id":2293241341,"user_origin_id":90585805,"create_time":1723803497,"update_time":1723803497,"id":1724403528824,"updated_at":"2024-08-23T08:58:48.824000Z","created_at":"2024-08-23T08:58:48.824000Z"},{"_id":"66c84f4865e3f042b807be75","body":"@sumneko (partial) \u5931\u6548","issue_id":1708973900490,"origin_id":2294830827,"user_origin_id":90585805,"create_time":1723893585,"update_time":1723893585,"id":1724403528827,"updated_at":"2024-08-23T08:58:48.826000Z","created_at":"2024-08-23T08:58:48.826000Z"},{"_id":"66c84f4865e3f042b807be76","body":"The following 2 related\/duplicated issues can also be closed:\r\n- https:\/\/github.com\/LuaLS\/lua-language-server\/issues\/1750\r\n- https:\/\/github.com\/LuaLS\/lua-language-server\/issues\/2384","issue_id":1708973900490,"origin_id":2295065693,"user_origin_id":16996876,"create_time":1723947191,"update_time":1723947191,"id":1724403528829,"updated_at":"2024-08-23T08:58:48.829000Z","created_at":"2024-08-23T08:58:48.829000Z"}] comment

### 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? Type Checking ### Expected Behaviour...

Something not okay with enum types

[{"_id":"66c84f4518409968dc0cfb1b","body":"exactly my thoughts :| its not as useful if you can just make a typo \/ change values and not be warned about it","issue_id":1708973900493,"origin_id":1913139645,"user_origin_id":30127664,"create_time":1706357855,"update_time":1706357855,"id":1724403525392,"updated_at":"2024-08-23T08:58:45.391000Z","created_at":"2024-08-23T08:58:45.391000Z"}] comment

### How are you using the lua-language-server? Visual Studio Code Extension (sumneko.lua) ### Which OS are you using? Linux ### What is the issue affecting? Type Checking ### Expected Behaviour...

Invalid type diagnostic doesn't show when passing value from array directly to a function

[{"_id":"66c84f2d18409968dc0cfb08","body":"```lua\r\nif values[1] then\r\n receive(values[1]) --> dose not support narrow `integer?` to `integer` in this case\r\nend\r\n```\r\n\r\nSince the expression cannot be narrowed at present, I can only ignore nil type to prevent false warning.","issue_id":1708973900499,"origin_id":1284296104,"user_origin_id":5213431,"create_time":1666197864,"update_time":1666197864,"id":1724403501489,"updated_at":"2024-08-23T08:58:21.488000Z","created_at":"2024-08-23T08:58:21.488000Z"},{"_id":"66c84f2d18409968dc0cfb09","body":"Is the following an instance of the same issue or a different one? It would be really useful to get warnings about nil values when assigning an array (e.g. when using variables for array elements and mistyped a variable name: `local x = { a.first, a.seeecond, a.third }`)\r\n\r\n```lua\r\n---@type string[]\r\nlocal x = { 'a', nil, 'b' } -- no assign-type-mismatch\r\n\r\nlocal y = x[2] -- y is string, but can actually be nil\r\n```","issue_id":1708973900499,"origin_id":1909638426,"user_origin_id":756608,"create_time":1706170929,"update_time":1706170929,"id":1724403501492,"updated_at":"2024-08-23T08:58:21.491000Z","created_at":"2024-08-23T08:58:21.491000Z"}] comment

### How are you using the lua-language-server? Other ### Which OS are you using? Linux ### What is the issue affecting? Type Checking, Diagnostics/Syntax Checking ### Expected Behaviour When using...

enhancement

### How are you using the lua-language-server? NeoVim ### Which OS are you using? Windows ### What is the issue affecting? Diagnostics/Syntax Checking ### Expected Behaviour Running `lua-language-server --check` is...