diff options
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, |