summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2020-12-16 17:30:34 +0800
committer最萌小汐 <sumneko@hotmail.com>2020-12-16 17:30:34 +0800
commit45408dd0e60d16b84a384080bb8a39f871640006 (patch)
treeb108c56f26dd0d9d03015e6f7e0379af2f9475ee
parent5bf01cf4db455da812a56d48251786d2da5355aa (diff)
downloadlua-language-server-45408dd0e60d16b84a384080bb8a39f871640006.zip
#306
-rw-r--r--script/parser/guide.lua6
-rw-r--r--script/workspace/workspace.lua20
2 files changed, 17 insertions, 9 deletions
diff --git a/script/parser/guide.lua b/script/parser/guide.lua
index 1f1ab48a..4ce41963 100644
--- a/script/parser/guide.lua
+++ b/script/parser/guide.lua
@@ -17,6 +17,7 @@ local setmetatable = setmetatable
local assert = assert
local select = select
local osClock = os.clock
+local tonumber = tonumber
local DEVELOP = _G.DEVELOP
local log = log
local _G = _G
@@ -3287,6 +3288,11 @@ local function mathCheck(status, a, b)
or m.getInferLiteral(status, a, 'number')
local v2 = m.getInferLiteral(status, b, 'integer')
or m.getInferLiteral(status, a, 'number')
+ v1 = tonumber(v1)
+ v2 = tonumber(v2)
+ if not v1 or not v2 then
+ return nil
+ end
local int = m.hasType(status, a, 'integer')
and m.hasType(status, b, 'integer')
and not m.hasType(status, a, 'number')
diff --git a/script/workspace/workspace.lua b/script/workspace/workspace.lua
index 10e4b2c9..fc6e90bd 100644
--- a/script/workspace/workspace.lua
+++ b/script/workspace/workspace.lua
@@ -144,16 +144,18 @@ function m.getLibraryMatchers()
end
m.libraryMatchers = {}
for path, pattern in pairs(librarys) do
- local nPath = fs.absolute(fs.path(path)):string()
- local matcher = glob.gitignore(pattern, m.matchOption)
- if platform.OS == 'Windows' then
- matcher:setOption 'ignoreCase'
+ if fs.exists(fs.path(path)) then
+ local nPath = fs.absolute(fs.path(path)):string()
+ local matcher = glob.gitignore(pattern, m.matchOption)
+ if platform.OS == 'Windows' then
+ matcher:setOption 'ignoreCase'
+ end
+ log.debug('getLibraryMatchers', path, nPath)
+ m.libraryMatchers[#m.libraryMatchers+1] = {
+ path = nPath,
+ matcher = matcher
+ }
end
- log.debug('getLibraryMatchers', path, nPath)
- m.libraryMatchers[#m.libraryMatchers+1] = {
- path = nPath,
- matcher = matcher
- }
end
m.libraryVersion = config.version