diff options
Diffstat (limited to 'script')
-rw-r--r-- | script/core/rename.lua | 6 | ||||
-rw-r--r-- | script/workspace/require-path.lua | 2 |
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 |