diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2022-04-16 22:57:59 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2022-04-16 22:57:59 +0800 |
commit | d31ecd5f2b8793667b3e8dad576737440c47a29d (patch) | |
tree | 4a81018e82564fb036685b995f25e185d90de352 | |
parent | e8fb2d2e0af8776662e010d334eb46ca1ccd7729 (diff) | |
download | lua-language-server-d31ecd5f2b8793667b3e8dad576737440c47a29d.zip |
cleanup
-rw-r--r-- | script/files.lua | 32 | ||||
-rw-r--r-- | script/provider/provider.lua | 61 | ||||
-rw-r--r-- | script/workspace/loading.lua | 1 |
3 files changed, 1 insertions, 93 deletions
diff --git a/script/files.lua b/script/files.lua index 05b7ab23..768a7434 100644 --- a/script/files.lua +++ b/script/files.lua @@ -550,38 +550,6 @@ function m.getLastState(uri) return file.ast end ----设置文件的当前可见范围 ----@param uri uri ----@param ranges range[] -function m.setVisibles(uri, ranges) - m.visible[uri] = ranges - m.onWatch('updateVisible', uri) -end - ----获取文件的当前可见范围 ----@param uri uri ----@return table[] -function m.getVisibles(uri) - local file = m.fileMap[uri] - if not file then - return nil - end - local ranges = m.visible[uri] - if not ranges or #ranges == 0 then - return nil - end - local visibles = {} - for i, range in ipairs(ranges) do - local startRow = range.start.line - local finishRow = range['end'].line - visibles[i] = { - start = guide.positionOf(startRow, 0), - finish = guide.positionOf(finishRow, 0), - } - end - return visibles -end - function m.getFile(uri) return m.fileMap[uri] or m.dllMap[uri] diff --git a/script/provider/provider.lua b/script/provider/provider.lua index 24ca003b..b8b101ed 100644 --- a/script/provider/provider.lua +++ b/script/provider/provider.lua @@ -986,17 +986,6 @@ m.register 'window/workDoneProgress/cancel' { end } -m.register '$/didChangeVisibleRanges' { - ---@async - function (params) - local uri = files.getRealUri(params.uri) - await.close('visible:' .. uri) - await.setID('visible:' .. uri) - await.delay() - files.setVisibles(uri, params.ranges) - end -} - m.register '$/status/click' { ---@async function () @@ -1212,56 +1201,6 @@ m.register 'inlayHint/resolve' { end } --- Hint -do - ---@async - local function updateHint(uri) - if not config.get(uri, 'Lua.hint.enable') then - return - end - local id = 'updateHint' .. uri - await.close(id) - await.setID(id) - workspace.awaitReady(uri) - local visibles = files.getVisibles(uri) - if not visibles then - return - end - await.close(id) - await.setID(id) - await.delay() - workspace.awaitReady(uri) - local edits = {} - local hint = require 'core.hint' - local _ <close> = progress.create(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 - for _, edit in ipairs(piece) do - edits[#edits+1] = { - text = edit.text, - pos = converter.packPosition(uri, edit.offset), - } - end - end - end - - proto.notify('$/hint', { - uri = uri, - edits = edits, - }) - end - - files.watch(function (ev, uri) - if ev == 'update' - or ev == 'updateVisible' then - await.call(function () ---@async - updateHint(uri) - end) - end - end) -end - local function refreshStatusBar() local valid = config.get(nil, 'Lua.window.statusBar') for _, scp in ipairs(workspace.folders) do diff --git a/script/workspace/loading.lua b/script/workspace/loading.lua index ad968cd4..83418776 100644 --- a/script/workspace/loading.lua +++ b/script/workspace/loading.lua @@ -165,6 +165,7 @@ function mt:loadAll() self._bar:remove() self._bar = progress.create(self.scp.uri, lang.script('WORKSPACE_LOADING', self.scp.uri), 0) for i, set in ipairs(self._sets) do + await.delay() set() self.read = i self:update() |