diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2019-06-24 23:34:18 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2019-06-24 23:34:18 +0800 |
commit | a425d6206eb86a2361d0fc87e521e0d8965e9b88 (patch) | |
tree | c548e4e984716d84f056edb60d2e124c45f5c008 /server/src | |
parent | 66e3ebb24ed0fcb7a6a4d2d6600367672f0dace8 (diff) | |
download | lua-language-server-a425d6206eb86a2361d0fc87e521e0d8965e9b88.zip |
修正library可能失效的bug
Diffstat (limited to 'server/src')
-rw-r--r-- | server/src/service.lua | 2 | ||||
-rw-r--r-- | server/src/workspace.lua | 9 |
2 files changed, 10 insertions, 1 deletions
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, |