LuaLS / LuaLS/lua-language-server

`duplicate-set-field` is reading from CoreLibs even though `diagnostics.libraryFiles` is set to 'Disable'

Open
#2,035 11 comments 6 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

question
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.