summaryrefslogtreecommitdiff
path: root/script/provider
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2023-01-18 06:10:55 +0800
committer最萌小汐 <sumneko@hotmail.com>2023-01-18 06:10:55 +0800
commitbddeb50920da81a6cecd91100aed018769bcc5b7 (patch)
tree9e0c1d979431c5e17da606ec35a9d22fb17dd8f9 /script/provider
parentefffa22c25f713f8e37bb22e891319076f5b759d (diff)
downloadlua-language-server-bddeb50920da81a6cecd91100aed018769bcc5b7.zip
normalize uri from RPC
fix #1810
Diffstat (limited to 'script/provider')
-rw-r--r--script/provider/provider.lua18
1 files changed, 10 insertions, 8 deletions
diff --git a/script/provider/provider.lua b/script/provider/provider.lua
index e77efb7c..a83ce18e 100644
--- a/script/provider/provider.lua
+++ b/script/provider/provider.lua
@@ -114,10 +114,10 @@ m.register 'initialize' {
if params.workspaceFolders then
for _, folder in ipairs(params.workspaceFolders) do
- workspace.create(folder.uri)
+ workspace.create(files.getRealUri(folder.uri))
end
elseif params.rootUri then
- workspace.create(params.rootUri)
+ workspace.create(files.getRealUri(params.rootUri))
end
local response = {
@@ -249,12 +249,14 @@ m.register 'workspace/didChangeWorkspaceFolders' {
function (params)
log.debug('workspace/didChangeWorkspaceFolders', inspect(params))
for _, folder in ipairs(params.event.added) do
- workspace.create(folder.uri)
+ local uri = files.getRealUri(folder.uri)
+ workspace.create(uri)
m.updateConfig()
- workspace.reload(scope.getScope(folder.uri))
+ workspace.reload(scope.getScope(uri))
end
for _, folder in ipairs(params.event.removed) do
- workspace.remove(folder.uri)
+ local uri = files.getRealUri(folder.uri)
+ workspace.remove(uri)
end
end
}
@@ -263,12 +265,12 @@ m.register 'textDocument/didOpen' {
---@async
function (params)
local doc = params.textDocument
- local scheme = furi.split(doc.uri)
- local supports = config.get(doc.uri, 'Lua.workspace.supportScheme')
+ local uri = files.getRealUri(doc.uri)
+ local scheme = furi.split(uri)
+ local supports = config.get(uri, 'Lua.workspace.supportScheme')
if not util.arrayHas(supports, scheme) then
return
end
- local uri = files.getRealUri(doc.uri)
log.debug('didOpen', uri)
local text = doc.text
files.setText(uri, text, true, function (file)