summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2020-08-05 15:05:28 +0800
committer最萌小汐 <sumneko@hotmail.com>2020-08-05 15:05:28 +0800
commita1ec2fe4db8f611f40eeea2fd4db51d49e6d71ad (patch)
tree8dd3387d326a18fa00ae28eba1d778b09e1a02b1
parent977efc2804c840456edeac2af95ccf68f815d88e (diff)
downloadlua-language-server-a1ec2fe4db8f611f40eeea2fd4db51d49e6d71ad.zip
fix #206 修正require路径中包含 `%` 时的报错
-rw-r--r--script-beta/workspace/workspace.lua1
-rw-r--r--script/workspace.lua1
2 files changed, 2 insertions, 0 deletions
diff --git a/script-beta/workspace/workspace.lua b/script-beta/workspace/workspace.lua
index f24f825a..70f5616b 100644
--- a/script-beta/workspace/workspace.lua
+++ b/script-beta/workspace/workspace.lua
@@ -178,6 +178,7 @@ function m.findUrisByRequirePath(path, whole)
local results = {}
local mark = {}
local input = path:gsub('%.', '/')
+ :gsub('%%', '%%%%')
for _, luapath in ipairs(config.config.runtime.path) do
local part = luapath:gsub('%?', input)
local uris = m.findUrisByFilePath(part, whole)
diff --git a/script/workspace.lua b/script/workspace.lua
index 9bcaec64..d2699851 100644
--- a/script/workspace.lua
+++ b/script/workspace.lua
@@ -382,6 +382,7 @@ function mt:searchPath(baseUri, str)
return self.searched[baseUri][str]
end
str = str:gsub('%.', '/')
+ :gsub('%%', '%%%%')
local searchers = {}
for i, luapath in ipairs(config.config.runtime.path) do
searchers[i] = luapath:gsub('%?', str)