summaryrefslogtreecommitdiff
path: root/script
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2021-01-27 15:00:26 +0800
committer最萌小汐 <sumneko@hotmail.com>2021-01-27 15:00:26 +0800
commitb436b123d67e1c5aa3945da404109fbeb12bdb53 (patch)
tree9d9484c540818bb76df36c6df769230103f49da1 /script
parent9a9f04d6045bb4048605349f897e88decc5311ac (diff)
downloadlua-language-server-b436b123d67e1c5aa3945da404109fbeb12bdb53.zip
avoid importing libraries with invalid names
Diffstat (limited to 'script')
-rw-r--r--script/core/completion.lua1
1 files changed, 1 insertions, 0 deletions
diff --git a/script/core/completion.lua b/script/core/completion.lua
index f1bea2e7..00e5d8f7 100644
--- a/script/core/completion.lua
+++ b/script/core/completion.lua
@@ -363,6 +363,7 @@ local function checkModule(ast, word, offset, results)
local fileName = path:match '[^/\\]*$'
local stemName = fileName:gsub('%..+', '')
if not locals[stemName]
+ and stemName:match '^[%a_][%w_]*$'
and matchKey(word, stemName) then
local targetAst = files.getAst(uri)
if not targetAst then