`runtime.version` isn't applied from `.luarc.json`
Opened this issue · 1 comments
itaranto commented
How are you using the lua-language-server?
NeoVim
Which OS are you using?
Linux
What is the issue affecting?
Completion
Expected Behaviour
It should look up definitions for LuaJIT (Lua 5.1).
Actual Behaviour
It looks up definitions for Lua 5.4.
Reproduction steps
- Having the following
.luarc.json
in a project:
{
"$schema": "https://raw.githubusercontent.com/sumneko/vscode-lua/master/setting/schema.json",
"diagnostics": {
"globals": [ "after_each", "before_each", "describe", "it", "vim" ],
"disable": [ "redefined-local" ]
},
"runtime": {
"version": "LuaJIT"
},
"workspace": {
"library": [
"$VIMRUNTIME"
],
"checkThirdParty": false
}
}
- Open Neovim and edit a
.lua
file - Go to definition for any standard library function
- Notice the version of the standard library used
Additional Notes
I'm using Neovim v0.10.1 with the native LSP.
I can reproduce this with a very simple config (no settings):
lspconfig.lua_ls.setup({})
One important thing to mention is that other settings like diagnostics
are properly applied.
Log File
tomlau10 commented
Can confirm this on windows vscode too 🤔
.luarc.json
{
"$schema": "https://raw.githubusercontent.com/sumneko/vscode-lua/master/setting/schema.json",
"runtime.version": "LuaJIT"
}
- create an empty
test.lua
and open it - inside luals logs, it is preloading both
lua5.4
andluajit
built-in meta files - so when doing goto definition on built-in function (eg
print
), luals will displays both definitions fromlua5.4
andluajit
toggle to show luals logs
...
[10:14:46.689][info] [#0:script\provider\provider.lua:53]: Load config from .luarc.json/.luarc.jsonc file:///c%3A/Users/TomLau/test
[10:14:46.689][info] [#0:script\provider\provider.lua:54]: {
["$schema"] = "https://raw.githubusercontent.com/sumneko/vscode-lua/master/setting/schema.json",
runtime = {
version = "LuaJIT"
}
}
[10:14:46.691][info] [#0:script\provider\completion.lua:43]: Enable completion.
[10:14:46.793][info] [#0:script\provider\provider.lua:61]: Load config from client fallback
[10:14:46.795][info] [#0:script\provider\provider.lua:62]: {
Lua = {
addonManager = {
enable = true
},
codeLens = {
enable = false
},
completion = {
autoRequire = true,
callSnippet = "Disable",
displayContext = 0,
enable = true,
keywordSnippet = "Replace",
postfix = "@",
requireSeparator = ".",
showParams = true,
showWord = "Fallback",
workspaceWord = true
},
diagnostics = {
disable = { "need-check-nil" },
disableScheme = { "git" },
enable = true,
globals = {},
globalsRegex = {},
groupFileStatus = {},
groupSeverity = {},
ignoredFiles = "Opened",
libraryFiles = "Opened",
neededFileStatus = {
["redundant-parameter"] = "Any!",
["redundant-value"] = "Any!"
},
severity = {},
unusedLocalExclude = {},
workspaceDelay = -1,
workspaceEvent = "None",
workspaceRate = 100
},
doc = {
packageName = {},
privateName = {},
protectedName = {},
regengine = "glob"
},
docScriptPath = "",
format = {
defaultConfig = {},
enable = true
},
hint = {
arrayIndex = "Disable",
await = true,
enable = true,
paramName = "Literal",
paramType = true,
semicolon = "Disable",
setType = false
},
hover = {
enable = true,
enumsLimit = 5,
expandAlias = false,
previewFields = 50,
viewNumber = true,
viewString = true,
viewStringMax = 1000
},
misc = {
executablePath = "",
parameters = { "--showsource", "--shownode" }
},
nameStyle = {
config = {}
},
runtime = {
builtin = {},
fileEncoding = "utf8",
meta = "${version} ${language} ${encoding}",
nonstandardSymbol = {},
path = { "?.lua", "?/init.lua" },
pathStrict = true,
plugin = "",
pluginArgs = {},
special = {},
unicodeName = false,
version = "Lua 5.4"
},
semantic = {
annotation = true,
enable = true,
keyword = false,
variable = true
},
signatureHelp = {
enable = true
},
spell = {
dict = {}
},
type = {
castNumberToInteger = true,
checkTableShape = false,
inferParamType = true,
weakNilCheck = true,
weakUnionCheck = true
},
typeFormat = {
config = {}
},
window = {
progressBar = true,
statusBar = true
},
workspace = {
checkThirdParty = "",
ignoreDir = { ".vscode" },
ignoreSubmodules = true,
library = {},
maxPreload = 5000,
preloadFileSize = 500,
useGitIgnore = true,
userThirdParty = {}
}
},
["editor.acceptSuggestionOnEnter"] = "on",
["editor.semanticHighlighting.enabled"] = "configuredByTheme",
["files.associations"] = {},
["files.exclude"] = {
["**/.DS_Store"] = true,
["**/.git"] = true,
["**/.hg"] = true,
["**/.svn"] = true,
["**/CVS"] = true,
["**/Thumbs.db"] = true
}
}
[10:14:47.036][info] [#0:script\plugin.lua:169]: plugin path: C:\Users\TomLau\test
[10:14:47.036][warn] [#0:script\plugin.lua:184]: plugin not found: C:\Users\TomLau\test
[10:14:47.036][info] [#0:script\library.lua:212]: Init builtin library at: file:///c%3A/Users/TomLau/test
[10:14:47.059][info] [#0:script\library.lua:212]: Init builtin library at: nil
[10:14:47.195][info] [#0:script\workspace\workspace.lua:324]: Preload start: file:///c%3A/Users/TomLau/test
[10:14:47.199][info] [#0:script\workspace\workspace.lua:330]: Scan files at: file:///c%3A/Users/TomLau/test
[10:14:47.199][info] [#0:script\workspace\workspace.lua:324]: Preload start: <fallback>
[10:14:47.201][info] [#0:script\workspace\workspace.lua:353]: Scan library at: file:///c%3A/Users/TomLau/.vscode/extensions/sumneko.lua-3.10.6-win32-x64/server/meta/Lua%205.4%20en-us%20utf8/os.lua
[10:14:47.202][info] [#0:script\workspace\workspace.lua:353]: Scan library at: file:///c%3A/Users/TomLau/.vscode/extensions/sumneko.lua-3.10.6-win32-x64/server/meta/Lua%205.4%20en-us%20utf8/builtin.lua
[10:14:47.203][info] [#0:script\workspace\workspace.lua:353]: Scan library at: file:///c%3A/Users/TomLau/.vscode/extensions/sumneko.lua-3.10.6-win32-x64/server/meta/Lua%205.4%20en-us%20utf8/utf8.lua
[10:14:47.203][info] [#0:script\workspace\workspace.lua:353]: Scan library at: file:///c%3A/Users/TomLau/.vscode/extensions/sumneko.lua-3.10.6-win32-x64/server/meta/Lua%205.4%20en-us%20utf8/debug.lua
[10:14:47.204][info] [#0:script\workspace\workspace.lua:353]: Scan library at: file:///c%3A/Users/TomLau/.vscode/extensions/sumneko.lua-3.10.6-win32-x64/server/meta/Lua%205.4%20en-us%20utf8/table.lua
[10:14:47.204][info] [#0:script\workspace\workspace.lua:353]: Scan library at: file:///c%3A/Users/TomLau/.vscode/extensions/sumneko.lua-3.10.6-win32-x64/server/meta/LuaJIT%20en-us%20utf8/basic.lua
[10:14:47.204][info] [#0:script\workspace\workspace.lua:353]: Scan library at: file:///c%3A/Users/TomLau/.vscode/extensions/sumneko.lua-3.10.6-win32-x64/server/meta/Lua%205.4%20en-us%20utf8/basic.lua
[10:14:47.205][info] [#0:script\workspace\workspace.lua:353]: Scan library at: file:///c%3A/Users/TomLau/.vscode/extensions/sumneko.lua-3.10.6-win32-x64/server/meta/LuaJIT%20en-us%20utf8/math.lua
[10:14:47.205][info] [#0:script\workspace\workspace.lua:353]: Scan library at: file:///c%3A/Users/TomLau/.vscode/extensions/sumneko.lua-3.10.6-win32-x64/server/meta/Lua%205.4%20en-us%20utf8/io.lua
[10:14:47.205][info] [#0:script\workspace\workspace.lua:353]: Scan library at: file:///c%3A/Users/TomLau/.vscode/extensions/sumneko.lua-3.10.6-win32-x64/server/meta/LuaJIT%20en-us%20utf8/string/buffer.lua
[10:14:47.206][info] [#0:script\workspace\workspace.lua:353]: Scan library at: file:///c%3A/Users/TomLau/.vscode/extensions/sumneko.lua-3.10.6-win32-x64/server/meta/Lua%205.4%20en-us%20utf8/string.lua
[10:14:47.206][info] [#0:script\workspace\workspace.lua:353]: Scan library at: file:///c%3A/Users/TomLau/.vscode/extensions/sumneko.lua-3.10.6-win32-x64/server/meta/LuaJIT%20en-us%20utf8/debug.lua
[10:14:47.206][info] [#0:script\workspace\workspace.lua:353]: Scan library at: file:///c%3A/Users/TomLau/.vscode/extensions/sumneko.lua-3.10.6-win32-x64/server/meta/Lua%205.4%20en-us%20utf8/math.lua
[10:14:47.206][info] [#0:script\workspace\workspace.lua:353]: Scan library at: file:///c%3A/Users/TomLau/.vscode/extensions/sumneko.lua-3.10.6-win32-x64/server/meta/LuaJIT%20en-us%20utf8/package.lua
[10:14:47.207][info] [#0:script\workspace\workspace.lua:353]: Scan library at: file:///c%3A/Users/TomLau/.vscode/extensions/sumneko.lua-3.10.6-win32-x64/server/meta/Lua%205.4%20en-us%20utf8/package.lua
[10:14:47.207][info] [#0:script\workspace\workspace.lua:353]: Scan library at: file:///c%3A/Users/TomLau/.vscode/extensions/sumneko.lua-3.10.6-win32-x64/server/meta/LuaJIT%20en-us%20utf8/os.lua
[10:14:47.207][info] [#0:script\workspace\workspace.lua:353]: Scan library at: file:///c%3A/Users/TomLau/.vscode/extensions/sumneko.lua-3.10.6-win32-x64/server/meta/Lua%205.4%20en-us%20utf8/coroutine.lua
[10:14:47.208][info] [#0:script\workspace\workspace.lua:353]: Scan library at: file:///c%3A/Users/TomLau/.vscode/extensions/sumneko.lua-3.10.6-win32-x64/server/meta/LuaJIT%20en-us%20utf8/builtin.lua
[10:14:47.208][info] [#0:script\workspace\workspace.lua:353]: Scan library at: file:///c%3A/Users/TomLau/.vscode/extensions/sumneko.lua-3.10.6-win32-x64/server/meta/LuaJIT%20en-us%20utf8/jit.lua
[10:14:47.208][info] [#0:script\workspace\workspace.lua:353]: Scan library at: file:///c%3A/Users/TomLau/.vscode/extensions/sumneko.lua-3.10.6-win32-x64/server/meta/LuaJIT%20en-us%20utf8/jit/profile.lua
[10:14:47.209][info] [#0:script\workspace\workspace.lua:353]: Scan library at: file:///c%3A/Users/TomLau/.vscode/extensions/sumneko.lua-3.10.6-win32-x64/server/meta/LuaJIT%20en-us%20utf8/ffi.lua
[10:14:47.209][info] [#0:script\workspace\workspace.lua:353]: Scan library at: file:///c%3A/Users/TomLau/.vscode/extensions/sumneko.lua-3.10.6-win32-x64/server/meta/LuaJIT%20en-us%20utf8/table/clear.lua
[10:14:47.209][info] [#0:script\workspace\workspace.lua:353]: Scan library at: file:///c%3A/Users/TomLau/.vscode/extensions/sumneko.lua-3.10.6-win32-x64/server/meta/LuaJIT%20en-us%20utf8/table/new.lua
[10:14:47.210][info] [#0:script\workspace\workspace.lua:353]: Scan library at: file:///c%3A/Users/TomLau/.vscode/extensions/sumneko.lua-3.10.6-win32-x64/server/meta/LuaJIT%20en-us%20utf8/string.lua
[10:14:47.210][info] [#0:script\workspace\workspace.lua:353]: Scan library at: file:///c%3A/Users/TomLau/.vscode/extensions/sumneko.lua-3.10.6-win32-x64/server/meta/LuaJIT%20en-us%20utf8/coroutine.lua
[10:14:47.210][info] [#0:script\workspace\workspace.lua:353]: Scan library at: file:///c%3A/Users/TomLau/.vscode/extensions/sumneko.lua-3.10.6-win32-x64/server/meta/LuaJIT%20en-us%20utf8/bit.lua
[10:14:47.211][info] [#0:script\workspace\workspace.lua:353]: Scan library at: file:///c%3A/Users/TomLau/.vscode/extensions/sumneko.lua-3.10.6-win32-x64/server/meta/LuaJIT%20en-us%20utf8/io.lua
[10:14:47.211][info] [#0:script\workspace\workspace.lua:353]: Scan library at: file:///c%3A/Users/TomLau/.vscode/extensions/sumneko.lua-3.10.6-win32-x64/server/meta/LuaJIT%20en-us%20utf8/jit/util.lua
[10:14:47.211][info] [#0:script\workspace\workspace.lua:353]: Scan library at: file:///c%3A/Users/TomLau/.vscode/extensions/sumneko.lua-3.10.6-win32-x64/server/meta/LuaJIT%20en-us%20utf8/table.lua
[10:14:47.315][info] [#0:script\workspace\workspace.lua:379]: Found 11 files at: <fallback>
...