LuaLS / LuaLS/lua-language-server
`[meta]` annotations should be loaded instead of just reading the file
Nobody has claimed this yet.
- Dominant language
- Lua
- Stars
- 4.4k
- Forks
- 442
- PR merge metrics
- No merged PRs in 30d
Description
### How are you using the lua-language-server?
Visual Studio Code Extension (sumneko.lua)
### Which OS are you using?
MacOS
### What is the issue affecting?
Annotations, Libraries
### Expected Behaviour
```json
{
"Lua.workspace.checkThirdParty": false,
"diagnostics.groupSeverity": {
"ambiguity": "Error",
"await": "Error",
"codestyle": "Error",
"duplicate": "Hint",
"global": "Error",
"luadoc": "Error",
"redefined": "Information",
"strict": "Error",
"strong": "Error",
"type-check": "Error",
"unbalanced": "Error",
"unused": "Hint",
"conventions": "Error"
},
"diagnostics.disable": [
"duplicate-doc-alias",
"duplicate-doc-field"
],
// "runtime.path": [
// "?.lua",
// "?/init.lua",
// ],
"runtime.pathStrict": true,
"runtime.version": "LuaJIT",
"workspace.ignoreDir": [
".vscode",
".luarocks"
],
"workspace.library": [
"/Users/frityet/Library/Application Support/Code/User/globalStorage/sumneko.lua/addonManager/addons/penlight/module/library",
"${3rd}/lfs/library",
"lua_modules/lib/lua/5.1/",
"lua_modules/share/lua/5.1/",
"/Users/frityet/Library/Application Support/Code/User/globalStorage/sumneko.lua/addonManager/addons/openresty/module/library"
],
"diagnostics.globals": [
"ngx"
],
}
```
```lua
local stringio = require("pl.stringio")
```
`stringio` should use the definition from `meta`
### Actual Behaviour
it reads the real `pl.stringio` and uses that (which does have't luaLS annotations, etc)
### Reproduction steps
1. Download and load penlight into a directory
2. Add the penlight addon
3. `require` a penlight file
### Additional Notes
_No response_
### Log File
[file_Users_frityet_Documents_ChatGPT-Plugins_Lua.log](https://github.com/LuaLS/lua-language-server/files/12778338/file_Users_frityet_Documents_ChatGPT-Plugins_Lua.log)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing how require("pl.stringio") resolves the penlight addon and how [meta] annotations are handled, comparing that path with the real pl.stringio file. Done means the require uses the definition from meta annotations, including their LuaLS annotations, rather than the unannotated runtime file.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- lua
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100