summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.vscode/settings.json5
-rw-r--r--server/src/service.lua2
-rw-r--r--server/src/workspace.lua9
3 files changed, 14 insertions, 2 deletions
diff --git a/.vscode/settings.json b/.vscode/settings.json
index cd655acb..c33c094c 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -18,5 +18,8 @@
"server/locale/",
"server/libs/",
"server/src/3rd",
- ]
+ ],
+ "Lua.workspace.library": {
+ "E:/Github/test" : true
+ }
}
diff --git a/server/src/service.lua b/server/src/service.lua
index d88753f1..0026fb05 100644
--- a/server/src/service.lua
+++ b/server/src/service.lua
@@ -177,7 +177,7 @@ function mt:isLua(uri)
if not self.workspace then
return true
end
- local path = self.workspace:relativePathByUri(uri)
+ local path = self.workspace:absolutePathByUri(uri)
if self.workspace:isLuaFile(path) then
return true
end
diff --git a/server/src/workspace.lua b/server/src/workspace.lua
index 3a67572a..18f9b15b 100644
--- a/server/src/workspace.lua
+++ b/server/src/workspace.lua
@@ -471,12 +471,21 @@ function mt:reset()
self.lsp:reCompile()
end
+---@param uri uri
+---@return path
function mt:relativePathByUri(uri)
local path = uric.decode(uri)
local relate = fs.relative(path, self.root)
return relate
end
+---@param uri uri
+---@return path
+function mt:absolutePathByUri(uri)
+ local path = uric.decode(uri)
+ return fs.absolute(path)
+end
+
return function (lsp, name)
local workspace = setmetatable({
lsp = lsp,