LuaLS / LuaLS/lua-language-server
`duplicate-set-field` is reading from CoreLibs even though `diagnostics.libraryFiles` is set to 'Disable'
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?
Windows
### What is the issue affecting?
Formatting
### Expected Behaviour
I do not see a warning for `duplicate-set-field` in my project.
### Actual Behaviour
Hi
Thanks for this plugin. I am getting warning for `duplicate-set-field` on this line:
`function playdate.update()`
and the duplicate is in the `CoreLibs` folder here:
`...\PlaydateSDK\CoreLibs\__stub.lua`
I have set the CoreLibs folder to be ignored by the code checker:
`"Lua.diagnostics.libraryFiles": "Disable",`
Is this the expected behaviour?
### Reproduction steps
1. Install Lua language server plugin
2. Set `"Lua.diagnostics.libraryFiles": "Disable",`
3. Create `main.lua`
4. Add the line `function playdate.update()` to `main.lua`
5. Observe warning:
```
"resource": "/e:/dev/miner/Source/main.lua",
"owner": "_generated_diagnostic_collection_name_#0",
"code": "duplicate-set-field",
"severity": 4,
"message": "Duplicate field `update`.",
"source": "Lua Diagnostics.",
"startLineNumber": 72,
"startColumn": 10,
"endLineNumber": 72,
"endColumn": 25,
"relatedInformation": [
{
"startLineNumber": 5,
"startColumn": 10,
"endLineNumber": 5,
"endColumn": 25,
"message": ".twopolefilter.s",
"resource": "/e:/devtools/PlaydateSDK/CoreLibs/__stub.lua"
}
]
}]
```
### Additional Notes
_No response_
### Log File
_No response_
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
Reproduce the warning using main.lua, the playdate.update() line, and the Lua.diagnostics.libraryFiles setting set to Disable; compare the diagnostic with CoreLibs/__stub.lua. Trace how duplicate-set-field diagnostics handle library files and verify the setting’s documented behavior. Done means the observed warning behavior is consistent with the intended configuration.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- lua
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100