diff options
author | sumneko <sumneko@hotmail.com> | 2022-01-23 03:11:38 +0800 |
---|---|---|
committer | sumneko <sumneko@hotmail.com> | 2022-01-23 03:11:38 +0800 |
commit | ce3a22bacd3acd2984c14246feee9bd90283279a (patch) | |
tree | e27056967c9f48ecb81495fa78d5f197677ca706 /script/provider | |
parent | 37760683528051654ceff5026b28462ebc22df7c (diff) | |
download | lua-language-server-ce3a22bacd3acd2984c14246feee9bd90283279a.zip |
cleanup
Diffstat (limited to 'script/provider')
-rw-r--r-- | script/provider/diagnostic.lua | 7 | ||||
-rw-r--r-- | script/provider/provider.lua | 24 |
2 files changed, 16 insertions, 15 deletions
diff --git a/script/provider/diagnostic.lua b/script/provider/diagnostic.lua index 0655b1c7..7b5993a2 100644 --- a/script/provider/diagnostic.lua +++ b/script/provider/diagnostic.lua @@ -11,6 +11,7 @@ local progress = require "progress" local client = require 'client' local converter = require 'proto.converter' local loading = require 'workspace.loading' +local scope = require 'workspace.scope' ---@class diagnosticProvider local m = {} @@ -216,7 +217,7 @@ function m.doDiagnostic(uri, isScopeDiag) end local version = files.getVersion(uri) - local scp = ws.getScope(uri) + local scp = scope.getScope(uri) local prog <close> = progress.create(scp, lang.script.WINDOW_DIAGNOSING, 0.5) prog:setMessage(ws.getRelativePath(uri)) @@ -351,7 +352,7 @@ function m.diagnosticsScope(uri, force) if not force and delay < 0 then return end - local scp = ws.getScope(uri) + local scp = scope.getScope(uri) local id = 'diagnosticsScope:' .. scp:getName() await.close(id) await.call(function () ---@async @@ -360,7 +361,7 @@ function m.diagnosticsScope(uri, force) await.sleep(1.0) end local clock = os.clock() - local bar <close> = progress.create(ws.getScope(uri), lang.script.WORKSPACE_DIAGNOSTIC, 1) + local bar <close> = progress.create(scope.getScope(uri), lang.script.WORKSPACE_DIAGNOSTIC, 1) local cancelled bar:onCancel(function () log.debug('Cancel workspace diagnostics') diff --git a/script/provider/provider.lua b/script/provider/provider.lua index b16a076f..66999aa0 100644 --- a/script/provider/provider.lua +++ b/script/provider/provider.lua @@ -276,7 +276,7 @@ m.register 'textDocument/hover' { } } end - local _ <close> = progress.create(workspace.getScope(uri), lang.script.WINDOW_PROCESSING_HOVER, 0.5) + local _ <close> = progress.create(scope.getScope(uri), lang.script.WINDOW_PROCESSING_HOVER, 0.5) local core = require 'core.hover' if not files.exists(uri) then return nil @@ -305,7 +305,7 @@ m.register 'textDocument/definition' { if not files.exists(uri) then return nil end - local _ <close> = progress.create(workspace.getScope(uri), lang.script.WINDOW_PROCESSING_DEFINITION, 0.5) + local _ <close> = progress.create(scope.getScope(uri), lang.script.WINDOW_PROCESSING_DEFINITION, 0.5) local core = require 'core.definition' local pos = converter.unpackPosition(uri, params.position) local result = core(uri, pos) @@ -344,7 +344,7 @@ m.register 'textDocument/typeDefinition' { if not files.exists(uri) then return nil end - local _ <close> = progress.create(workspace.getScope(uri), lang.script.WINDOW_PROCESSING_TYPE_DEFINITION, 0.5) + local _ <close> = progress.create(scope.getScope(uri), lang.script.WINDOW_PROCESSING_TYPE_DEFINITION, 0.5) local core = require 'core.type-definition' local pos = converter.unpackPosition(uri, params.position) local result = core(uri, pos) @@ -383,7 +383,7 @@ m.register 'textDocument/references' { if not files.exists(uri) then return nil end - local _ <close> = progress.create(workspace.getScope(uri), lang.script.WINDOW_PROCESSING_REFERENCE, 0.5) + local _ <close> = progress.create(scope.getScope(uri), lang.script.WINDOW_PROCESSING_REFERENCE, 0.5) local core = require 'core.reference' local pos = converter.unpackPosition(uri, params.position) local result = core(uri, pos) @@ -434,7 +434,7 @@ m.register 'textDocument/rename' { if not files.exists(uri) then return nil end - local _ <close> = progress.create(workspace.getScope(uri), lang.script.WINDOW_PROCESSING_RENAME, 0.5) + local _ <close> = progress.create(scope.getScope(uri), lang.script.WINDOW_PROCESSING_RENAME, 0.5) local core = require 'core.rename' local pos = converter.unpackPosition(uri, params.position) local result = core.rename(uri, pos, params.newName) @@ -494,7 +494,7 @@ m.register 'textDocument/completion' { } } end - local _ <close> = progress.create(workspace.getScope(uri), lang.script.WINDOW_PROCESSING_COMPLETION, 0.5) + local _ <close> = progress.create(scope.getScope(uri), lang.script.WINDOW_PROCESSING_COMPLETION, 0.5) --log.info(util.dump(params)) local core = require 'core.completion' --log.debug('textDocument/completion') @@ -640,7 +640,7 @@ m.register 'textDocument/signatureHelp' { if not files.exists(uri) then return nil end - local _ <close> = progress.create(workspace.getScope(uri), lang.script.WINDOW_PROCESSING_SIGNATURE, 0.5) + local _ <close> = progress.create(scope.getScope(uri), lang.script.WINDOW_PROCESSING_SIGNATURE, 0.5) local pos = converter.unpackPosition(uri, params.position) local core = require 'core.signature' local results = core(uri, pos) @@ -680,7 +680,7 @@ m.register 'textDocument/documentSymbol' { function (params) local uri = files.getRealUri(params.textDocument.uri) workspace.awaitReady(uri) - local _ <close> = progress.create(workspace.getScope(uri), lang.script.WINDOW_PROCESSING_SYMBOL, 0.5) + local _ <close> = progress.create(scope.getScope(uri), lang.script.WINDOW_PROCESSING_SYMBOL, 0.5) local core = require 'core.document-symbol' local symbols = core(uri) @@ -815,7 +815,7 @@ m.register 'textDocument/semanticTokens/full' { function (params) local uri = files.getRealUri(params.textDocument.uri) workspace.awaitReady(uri) - local _ <close> = progress.create(workspace.getScope(uri), lang.script.WINDOW_PROCESSING_SEMANTIC_FULL, 0.5) + local _ <close> = progress.create(scope.getScope(uri), lang.script.WINDOW_PROCESSING_SEMANTIC_FULL, 0.5) local core = require 'core.semantic-tokens' local results = core(uri, 0, math.huge) return { @@ -830,7 +830,7 @@ m.register 'textDocument/semanticTokens/range' { log.debug('textDocument/semanticTokens/range') local uri = files.getRealUri(params.textDocument.uri) workspace.awaitReady(uri) - local _ <close> = progress.create(workspace.getScope(uri), lang.script.WINDOW_PROCESSING_SEMANTIC_RANGE, 0.5) + local _ <close> = progress.create(scope.getScope(uri), lang.script.WINDOW_PROCESSING_SEMANTIC_RANGE, 0.5) local core = require 'core.semantic-tokens' local start, finish = converter.unpackRange(uri, params.range) local results = core(uri, start, finish) @@ -918,7 +918,7 @@ m.register 'textDocument/onTypeFormatting' { function (params) local uri = files.getRealUri(params.textDocument.uri) workspace.awaitReady(uri) - local _ <close> = progress.create(workspace.getScope(uri), lang.script.WINDOW_PROCESSING_TYPE_FORMATTING, 0.5) + local _ <close> = progress.create(scope.getScope(uri), lang.script.WINDOW_PROCESSING_TYPE_FORMATTING, 0.5) local ch = params.ch if not files.exists(uri) then return nil @@ -994,7 +994,7 @@ do workspace.awaitReady(uri) local edits = {} local hint = require 'core.hint' - local _ <close> = progress.create(workspace.getScope(uri), lang.script.WINDOW_PROCESSING_HINT, 0.5) + local _ <close> = progress.create(scope.getScope(uri), lang.script.WINDOW_PROCESSING_HINT, 0.5) for _, visible in ipairs(visibles) do local piece = hint(uri, visible.start, visible.finish) if piece then |