summaryrefslogtreecommitdiff
path: root/script
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2020-11-25 15:53:04 +0800
committer最萌小汐 <sumneko@hotmail.com>2020-11-25 15:53:04 +0800
commit672bec919c9199b9d70856b04620a05f3a03bf58 (patch)
tree40455a1c5ba21eb9fd1c0cd59fdf7e4cfc182556 /script
parent33caa5104855dec19a278f0feadc7bab2c4fbbcd (diff)
downloadlua-language-server-672bec919c9199b9d70856b04620a05f3a03bf58.zip
#269 workspace.library should be normalized first
Diffstat (limited to 'script')
-rw-r--r--script/workspace/workspace.lua6
1 files changed, 4 insertions, 2 deletions
diff --git a/script/workspace/workspace.lua b/script/workspace/workspace.lua
index c5744666..31828245 100644
--- a/script/workspace/workspace.lua
+++ b/script/workspace/workspace.lua
@@ -134,10 +134,10 @@ function m.getLibraryMatchers()
local librarys = {}
for path, pattern in pairs(config.config.workspace.library) do
- librarys[path] = pattern
+ librarys[m.normalize(path)] = pattern
end
if library.metaPath then
- librarys[library.metaPath] = true
+ librarys[m.normalize(library.metaPath)] = true
end
m.libraryMatchers = {}
for path, pattern in pairs(librarys) do
@@ -294,11 +294,13 @@ end
function m.normalize(path)
if platform.OS == 'Windows' then
path = path:gsub('[/\\]+', '\\')
+ :gsub('[/\\]+$', '')
:gsub('^%a+%:', function (str)
return str:upper()
end)
else
path = path:gsub('[/\\]+', '/')
+ :gsub('[/\\]+$', '')
end
return path:gsub('^[/\\]+', '')
end