summaryrefslogtreecommitdiff
path: root/script/provider
diff options
context:
space:
mode:
Diffstat (limited to 'script/provider')
-rw-r--r--script/provider/completion.lua25
-rw-r--r--script/provider/diagnostic.lua2
-rw-r--r--script/provider/provider.lua6
-rw-r--r--script/provider/semantic-tokens.lua10
4 files changed, 23 insertions, 20 deletions
diff --git a/script/provider/completion.lua b/script/provider/completion.lua
index 6c215f15..ec2ac6c7 100644
--- a/script/provider/completion.lua
+++ b/script/provider/completion.lua
@@ -2,6 +2,7 @@ local proto = require 'proto'
local nonil = require 'without-check-nil'
local client = require 'client'
local config = require 'config'
+local ws = require 'workspace'
local isEnable = false
@@ -13,15 +14,17 @@ local function allWords()
list[#list+1] = c
mark[c] = true
end
- local postfix = config.get(uri, 'Lua.completion.postfix')
- if postfix ~= '' and not mark[postfix] then
- list[#list+1] = postfix
- mark[postfix] = true
+ for _, scp in ipairs(ws.folders) do
+ local postfix = config.get(scp.uri, 'Lua.completion.postfix')
+ if postfix ~= '' and not mark[postfix] then
+ list[#list+1] = postfix
+ mark[postfix] = true
+ end
end
return list
end
-local function enable()
+local function enable(uri)
if isEnable then
return
end
@@ -46,7 +49,7 @@ local function enable()
})
end
-local function disable()
+local function disable(uri)
if not isEnable then
return
end
@@ -67,18 +70,18 @@ local function disable()
})
end
-config.watch(function (key, value)
+config.watch(function (uri, key, value)
if key == 'Lua.completion.enable' then
if value == true then
- enable()
+ enable(uri)
else
- disable()
+ disable(uri)
end
end
if key == 'Lua.completion.postfix' then
if config.get(uri, 'Lua.completion.enable') then
- disable()
- enable()
+ disable(uri)
+ enable(uri)
end
end
end)
diff --git a/script/provider/diagnostic.lua b/script/provider/diagnostic.lua
index 1be7d626..75a9fdae 100644
--- a/script/provider/diagnostic.lua
+++ b/script/provider/diagnostic.lua
@@ -442,7 +442,7 @@ await.watch(function (ev, co) ---@async
end
end)
-config.watch(function (key, value, oldValue)
+config.watch(function (uri, key, value, oldValue)
if key:find 'Lua.diagnostics' then
if value ~= oldValue then
m.diagnosticsAll()
diff --git a/script/provider/provider.lua b/script/provider/provider.lua
index 9d853e06..7357240a 100644
--- a/script/provider/provider.lua
+++ b/script/provider/provider.lua
@@ -1019,7 +1019,7 @@ do
end)
end
-local function refreshStatusBar()
+local function refreshStatusBar(uri)
local value = config.get(uri, 'Lua.window.statusBar')
if value then
proto.notify('$/status/show')
@@ -1028,9 +1028,9 @@ local function refreshStatusBar()
end
end
-config.watch(function (key, value)
+config.watch(function (uri, key, value)
if key == 'Lua.window.statusBar' then
- refreshStatusBar()
+ refreshStatusBar(uri)
end
end)
diff --git a/script/provider/semantic-tokens.lua b/script/provider/semantic-tokens.lua
index 2a8013db..f6acb280 100644
--- a/script/provider/semantic-tokens.lua
+++ b/script/provider/semantic-tokens.lua
@@ -20,7 +20,7 @@ local function toArray(map)
end
local dontShowAgain = false
-local function enable()
+local function enable(uri)
if isEnable then
return
end
@@ -80,7 +80,7 @@ local function enable()
end
end
-local function disable()
+local function disable(uri)
if not isEnable then
return
end
@@ -109,16 +109,16 @@ local function refresh()
proto.request('workspace/semanticTokens/refresh', json.null)
end
-config.watch(function (key, value, oldValue)
+config.watch(function (uri, key, value, oldValue)
if key == 'Lua.color.mode' then
if value == 'Semantic' or value == 'SemanticEnhanced' then
if isEnable and value ~= oldValue then
refresh()
else
- enable()
+ enable(uri)
end
else
- disable()
+ disable(uri)
end
end
if key:find '^Lua.runtime'