summaryrefslogtreecommitdiff
path: root/script/provider
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2021-03-08 20:05:20 +0800
committer最萌小汐 <sumneko@hotmail.com>2021-03-08 20:05:20 +0800
commit9d151d9db282c275e975e826f4082028d62f695a (patch)
treeed399b3112d5be986b27267f19540802c2053481 /script/provider
parent262e940659b9081f9579d5a8baa3f8491ece4754 (diff)
downloadlua-language-server-9d151d9db282c275e975e826f4082028d62f695a.zip
no sleep
Diffstat (limited to 'script/provider')
-rw-r--r--script/provider/provider.lua12
1 files changed, 3 insertions, 9 deletions
diff --git a/script/provider/provider.lua b/script/provider/provider.lua
index 8c72be1b..fd304c97 100644
--- a/script/provider/provider.lua
+++ b/script/provider/provider.lua
@@ -599,12 +599,10 @@ proto.on('textDocument/signatureHelp', function (params)
end)
proto.on('textDocument/documentSymbol', function (params)
+ workspace.awaitReady()
local core = require 'core.document-symbol'
local _ <close> = progress.create(lang.script.WINDOW_PROCESSING_SYMBOL, 0.5)
local uri = params.textDocument.uri
- while not files.exists(uri) do
- await.sleep(0.1)
- end
local symbols = core(uri)
if not symbols then
@@ -722,9 +720,8 @@ proto.on('textDocument/semanticTokens/full', function (params)
local core = require 'core.semantic-tokens'
local uri = params.textDocument.uri
local text = files.getText(uri)
- while not text do
- await.sleep(0.1)
- text = files.getText(uri)
+ if not text then
+ return nil
end
local results = core(uri, 0, #text)
return {
@@ -737,9 +734,6 @@ proto.on('textDocument/semanticTokens/range', function (params)
local _ <close> = progress.create(lang.script.WINDOW_PROCESSING_SEMANTIC_RANGE, 0.5)
local core = require 'core.semantic-tokens'
local uri = params.textDocument.uri
- while not files.exists(uri) do
- await.sleep(0.1)
- end
local start = files.offsetOfWord(uri, params.range.start)
local finish = files.offsetOfWord(uri, params.range['end'])
local results = core(uri, start, finish)