vscode-wow-api
vscode-wow-api copied to clipboard
Automatic definition of globals always updates .vscode/settings.json instead of the config LuaLS uses
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
It looks like we need to directly configure .luarc.json
with the JSON library instead of via the LuaLS configuration.