vscode-wow-api icon indicating copy to clipboard operation
vscode-wow-api copied to clipboard

Automatic definition of globals always updates .vscode/settings.json instead of the config LuaLS uses

Open emmericp opened this issue 11 months ago • 1 comments

The recommended way to setup a config for LuaLS is to use the file .luarc.json because it is not specific to VS Code, see https://luals.github.io/wiki/configuration/

Your code to automatically add known globals will always write to .vscode/settings.json: https://github.com/Ketho/vscode-wow-api/blob/master/src/extension.ts#L129 -- which is ignored by LuaLS if .luarc.json is present.

LuaLS has a "lua.setConfig" command which updates the correct config file, it's for example used for the "define global" quick fix. I think you should be able to just call this function, but I have no idea about vs code extensions: https://github.com/LuaLS/vscode-lua/blob/master/client/src/languageserver.ts#L334

emmericp avatar Mar 09 '24 14:03 emmericp

It looks like we need to directly configure .luarc.json with the JSON library instead of via the LuaLS configuration.

Ketho avatar Aug 12 '24 04:08 Ketho