diff options
author | AlexCai2019 <89138532+AlexCai2019@users.noreply.github.com> | 2022-05-08 01:43:28 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-08 01:43:28 +0800 |
commit | 0fd83c4ca9f82a02becab6c304a8a7de75098507 (patch) | |
tree | be9790d9d4823fe728c5b36e94093fe5f42b7725 /script/provider/provider.lua | |
parent | 89203efad8c9b5513e05ca4d5696107924865b10 (diff) | |
parent | 67b4c574849d1667e0ecb39c51aeed8e30b43056 (diff) | |
download | lua-language-server-0fd83c4ca9f82a02becab6c304a8a7de75098507.zip |
Merge branch 'sumneko:master' into master
Diffstat (limited to 'script/provider/provider.lua')
-rw-r--r-- | script/provider/provider.lua | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/script/provider/provider.lua b/script/provider/provider.lua index b8b101ed..08b6ca93 100644 --- a/script/provider/provider.lua +++ b/script/provider/provider.lua @@ -42,8 +42,9 @@ local function updateConfig(uri) end local rc = cfgLoader.loadRCConfig(folder.uri, '.luarc.json') + or cfgLoader.loadRCConfig(folder.uri, '.luarc.jsonc') if rc then - log.info('Load config from luarc.json', folder.uri) + log.info('Load config from .luarc.json/.luarc.jsonc', folder.uri) log.debug(inspect(rc)) end @@ -91,6 +92,14 @@ filewatch.event(function (ev, path) ---@async end end end + if util.stringEndWith(path, '.luarc.jsonc') then + for _, scp in ipairs(workspace.folders) do + local rcPath = workspace.getAbsolutePath(scp.uri, '.luarc.jsonc') + if path == rcPath then + updateConfig(scp.uri) + end + end + end end) m.register 'initialize' { @@ -226,7 +235,6 @@ m.register 'workspace/didRenameFiles' { } m.register 'textDocument/didOpen' { - ---@async function (params) local doc = params.textDocument local scheme = furi.split(doc.uri) @@ -235,7 +243,6 @@ m.register 'textDocument/didOpen' { end local uri = files.getRealUri(doc.uri) log.debug('didOpen', uri) - workspace.awaitReady(uri) local text = doc.text files.setText(uri, text, true, function (file) file.version = doc.version @@ -257,13 +264,14 @@ m.register 'textDocument/didClose' { } m.register 'textDocument/didChange' { - ---@async function (params) local doc = params.textDocument + local scheme = furi.split(doc.uri) + if scheme ~= 'file' then + return + end local changes = params.contentChanges local uri = files.getRealUri(doc.uri) - workspace.awaitReady(uri) - --log.debug('changes', util.dump(changes)) local text = files.getOriginText(uri) or '' local rows = files.getCachedRows(uri) text, rows = tm(text, rows, changes) @@ -521,7 +529,8 @@ m.register 'textDocument/completion' { local count, max = workspace.getLoadingProcess(uri) return { { - label = lang.script('HOVER_WS_LOADING', count, max),textEdit = { + label = lang.script('HOVER_WS_LOADING', count, max), + textEdit = { range = { start = params.position, ['end'] = params.position, |