summaryrefslogtreecommitdiff
path: root/script/workspace
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2021-07-15 16:54:28 +0800
committer最萌小汐 <sumneko@hotmail.com>2021-07-15 16:54:28 +0800
commite4e5edbb3a9a53a7dffb4ab22ff8f6a0f69ce35b (patch)
tree6fccc80330128797aeb4e48f9ebb1c74f1b8de80 /script/workspace
parentef1de8728e84386ae17fbeb64500f658bb98ca8d (diff)
downloadlua-language-server-e4e5edbb3a9a53a7dffb4ab22ff8f6a0f69ce35b.zip
check nil
Diffstat (limited to 'script/workspace')
-rw-r--r--script/workspace/workspace.lua13
1 files changed, 10 insertions, 3 deletions
diff --git a/script/workspace/workspace.lua b/script/workspace/workspace.lua
index 485fd5f4..0f7d8103 100644
--- a/script/workspace/workspace.lua
+++ b/script/workspace/workspace.lua
@@ -121,8 +121,10 @@ function m.getNativeMatcher()
-- config.get 'workspace.library'
for path in pairs(config.get 'Lua.workspace.library') do
path = m.getAbsolutePath(path)
- log.info('Ignore by library:', path)
- pattern[#pattern+1] = path
+ if path then
+ log.info('Ignore by library:', path)
+ pattern[#pattern+1] = path
+ end
end
-- config.get 'workspace.ignoreDir'
for path in pairs(config.get 'Lua.workspace.ignoreDir') do
@@ -146,7 +148,9 @@ function m.getLibraryMatchers()
local librarys = {}
for path in pairs(config.get 'Lua.workspace.library') do
path = m.getAbsolutePath(path)
- librarys[m.normalize(path)] = true
+ if path then
+ librarys[m.normalize(path)] = true
+ end
end
if library.metaPath then
librarys[m.normalize(library.metaPath)] = true
@@ -449,6 +453,9 @@ function m.findUrisByRequirePath(path)
end
function m.normalize(path)
+ if not path then
+ return nil
+ end
path = path:gsub('%$%{(.-)%}', function (key)
if key == '3rd' then
return (ROOT / 'meta' / '3rd'):string()