summaryrefslogtreecommitdiff
path: root/script/core
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2021-09-24 17:08:15 +0800
committer最萌小汐 <sumneko@hotmail.com>2021-09-24 17:08:15 +0800
commitf06d38754a38ef25bfe5a10b931b596becc092e4 (patch)
tree3df3de0643097be312f7249a01838cc887505745 /script/core
parent9ed21208bbd28207da7f57a314d761ceb120b510 (diff)
downloadlua-language-server-f06d38754a38ef25bfe5a10b931b596becc092e4.zip
stop provider when file changing
Diffstat (limited to 'script/core')
-rw-r--r--script/core/folding.lua10
-rw-r--r--script/core/semantic-tokens.lua8
2 files changed, 9 insertions, 9 deletions
diff --git a/script/core/folding.lua b/script/core/folding.lua
index 51d1be6b..bd3ba5f3 100644
--- a/script/core/folding.lua
+++ b/script/core/folding.lua
@@ -146,22 +146,22 @@ local Care = {
}
return function (uri)
- local ast = files.getState(uri)
- local text = files.getText(uri)
- if not ast or not text then
+ local state = files.getState(uri)
+ local text = files.getText(uri)
+ if not state or not text then
return nil
end
local regions = {}
local status = {}
- guide.eachSource(ast.ast, function (source)
+ guide.eachSource(state.ast, function (source)
local tp = source.type
if Care[tp] then
await.delay()
Care[tp](source, text, regions)
end
end)
- for _, source in ipairs(ast.comms) do
+ for _, source in ipairs(state.comms) do
local tp = source.type
if Care[tp] then
await.delay()
diff --git a/script/core/semantic-tokens.lua b/script/core/semantic-tokens.lua
index 405f2735..38b75227 100644
--- a/script/core/semantic-tokens.lua
+++ b/script/core/semantic-tokens.lua
@@ -214,14 +214,14 @@ local function buildTokens(uri, results)
end
return function (uri, start, finish)
- local ast = files.getState(uri)
+ local state = files.getState(uri)
local text = files.getText(uri)
- if not ast then
+ if not state then
return nil
end
local results = {}
- guide.eachSourceBetween(ast.ast, start, finish, function (source)
+ guide.eachSourceBetween(state.ast, start, finish, function (source)
local method = Care[source.type]
if not method then
return
@@ -230,7 +230,7 @@ return function (uri, start, finish)
await.delay()
end)
- for _, comm in ipairs(ast.comms) do
+ for _, comm in ipairs(state.comms) do
if comm.type == 'comment.cshort' then
results[#results+1] = {
start = comm.start,