summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--changelog.md2
-rw-r--r--script/core/completion/auto-require.lua21
-rw-r--r--script/workspace/require-path.lua1
3 files changed, 16 insertions, 8 deletions
diff --git a/changelog.md b/changelog.md
index d9098991..1e6100e4 100644
--- a/changelog.md
+++ b/changelog.md
@@ -5,10 +5,12 @@
* `FIX` [#1831]
* `FIX` [#1838]
* `FIX` [#1841]
+* `FIX` [#1851]
[#1831]: https://github.com/sumneko/lua-language-server/issues/1831
[#1838]: https://github.com/sumneko/lua-language-server/issues/1838
[#1841]: https://github.com/sumneko/lua-language-server/issues/1841
+[#1851]: https://github.com/sumneko/lua-language-server/issues/1851
## 3.6.7
`2023-1-20`
diff --git a/script/core/completion/auto-require.lua b/script/core/completion/auto-require.lua
index 74fd2e1e..cec7139c 100644
--- a/script/core/completion/auto-require.lua
+++ b/script/core/completion/auto-require.lua
@@ -48,16 +48,21 @@ function m.check(state, word, position, callback)
local infos = rpath.getVisiblePath(uri, path)
local testedStem = { }
for _, sr in ipairs(infos) do
- local pattern = sr.searcher
- :gsub("(%p)", "%%%1")
- :gsub("%%%?", "(.-)")
+ local stemName
+ if sr.searcher == '[[meta]]' then
+ stemName = sr.name
+ else
+ local pattern = sr.searcher
+ : gsub("(%p)", "%%%1")
+ : gsub("%%%?", "(.-)")
- local stemName = relativePath
- :match(pattern)
- :match("[%a_][%w_]*$")
+ stemName = relativePath
+ : match(pattern)
+ : match("[%a_][%w_]*$")
- if not stemName or testedStem[stemName] then
- goto INNER_CONTINUE
+ if not stemName or testedStem[stemName] then
+ goto INNER_CONTINUE
+ end
end
testedStem[stemName] = true
diff --git a/script/workspace/require-path.lua b/script/workspace/require-path.lua
index d7ca8e26..e51d1219 100644
--- a/script/workspace/require-path.lua
+++ b/script/workspace/require-path.lua
@@ -68,6 +68,7 @@ function mt:getRequireResultByPath(path)
if vm.isMetaFileRequireable(uri) then
result[#result+1] = {
name = metaName,
+ searcher = '[[meta]]',
}
end
return result