diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2022-03-04 14:24:48 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2022-03-04 14:24:48 +0800 |
commit | 659964c943c4b1e78c729318dd8537d0b8c4cbf0 (patch) | |
tree | 239beae82b8ed6cc3366b8423f6e60a2a014cc21 /script | |
parent | 1abeb31839780be62e37681a01dd395dceee7239 (diff) | |
download | lua-language-server-659964c943c4b1e78c729318dd8537d0b8c4cbf0.zip |
don't open non-file uri
Diffstat (limited to 'script')
-rw-r--r-- | script/file-uri.lua | 4 | ||||
-rw-r--r-- | script/provider/diagnostic.lua | 4 | ||||
-rw-r--r-- | script/provider/provider.lua | 9 |
3 files changed, 13 insertions, 4 deletions
diff --git a/script/file-uri.lua b/script/file-uri.lua index 7f3e36a8..ccd47156 100644 --- a/script/file-uri.lua +++ b/script/file-uri.lua @@ -94,4 +94,8 @@ function m.decode(uri) return value end +function m.split(uri) + return uri:match('([^:]*):?/?/?([^/]*)(.*)') +end + return m diff --git a/script/provider/diagnostic.lua b/script/provider/diagnostic.lua index de1a735e..3e587009 100644 --- a/script/provider/diagnostic.lua +++ b/script/provider/diagnostic.lua @@ -225,7 +225,7 @@ function m.doDiagnostic(uri, isScopeDiag) local prog <close> = progress.create(scp, lang.script.WINDOW_DIAGNOSING, 0.5) prog:setMessage(ws.getRelativePath(uri)) - log.debug('Diagnostic file:', uri) + --log.debug('Diagnostic file:', uri) local syntax = m.syntaxErrors(uri, state) @@ -235,7 +235,7 @@ function m.doDiagnostic(uri, isScopeDiag) tracy.ZoneBeginN 'mergeSyntaxAndDiags' local _ <close> = tracy.ZoneEnd local full = mergeDiags(syntax, lastDiag, diags) - log.debug(('Pushed [%d] results'):format(full and #full or 0)) + --log.debug(('Pushed [%d] results'):format(full and #full or 0)) if not full then m.clear(uri) return diff --git a/script/provider/provider.lua b/script/provider/provider.lua index 5ee99b3e..eef22b21 100644 --- a/script/provider/provider.lua +++ b/script/provider/provider.lua @@ -225,8 +225,13 @@ m.register 'workspace/didRenameFiles' { m.register 'textDocument/didOpen' { ---@async function (params) - local doc = params.textDocument - local uri = files.getRealUri(doc.uri) + local doc = params.textDocument + local scheme = furi.split(doc.uri) + if scheme ~= 'file' then + return + 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) |