summaryrefslogtreecommitdiff
path: root/script
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2020-12-17 14:39:23 +0800
committer最萌小汐 <sumneko@hotmail.com>2020-12-17 14:39:23 +0800
commit65aa894f82033b636118e0919b5b3195e86af9a9 (patch)
tree4496f760e1ffdd591f9d0b442cb1ff40585adfcb /script
parent50e027378a627146f891ee8c5b5e838096d6f334 (diff)
downloadlua-language-server-65aa894f82033b636118e0919b5b3195e86af9a9.zip
some fix
Diffstat (limited to 'script')
-rw-r--r--script/core/rename.lua6
-rw-r--r--script/workspace/require-path.lua2
2 files changed, 7 insertions, 1 deletions
diff --git a/script/core/rename.lua b/script/core/rename.lua
index 54867f77..95a5ee82 100644
--- a/script/core/rename.lua
+++ b/script/core/rename.lua
@@ -117,6 +117,9 @@ local function isValidName(str)
end
local function isValidGlobal(str)
+ if not str then
+ return false
+ end
for s in str:gmatch '[^%.]*' do
if not isValidName(trim(s)) then
return false
@@ -431,6 +434,9 @@ local accept = {
local m = {}
function m.rename(uri, pos, newname)
+ if not newname then
+ return nil
+ end
local ast = files.getAst(uri)
if not ast then
return nil
diff --git a/script/workspace/require-path.lua b/script/workspace/require-path.lua
index f1dc2fb9..4503f0ee 100644
--- a/script/workspace/require-path.lua
+++ b/script/workspace/require-path.lua
@@ -17,7 +17,7 @@ local function getOnePath(path, searcher)
local start = stemSearcher:match '()%?' or 1
for pos = start, #stemPath do
local word = stemPath:sub(start, pos)
- local newSearcher = stemSearcher:gsub('%?', word)
+ local newSearcher = stemSearcher:gsub('%?', (word:gsub('%%', '%%%%')))
if newSearcher == stemPath then
return word
end