diff options
-rw-r--r-- | changelog.md | 2 | ||||
-rw-r--r-- | script/core/completion/auto-require.lua | 9 |
2 files changed, 8 insertions, 3 deletions
diff --git a/changelog.md b/changelog.md index c8df69db..6b86db9b 100644 --- a/changelog.md +++ b/changelog.md @@ -9,6 +9,7 @@ * `FIX` [#1924] * `FIX` [#1928] * `FIX` [#1945] +* `FIX` [#1978] [#1715]: https://github.com/LuaLS/lua-language-server/issues/1715 [#1753]: https://github.com/LuaLS/lua-language-server/issues/1753 @@ -17,6 +18,7 @@ [#1924]: https://github.com/LuaLS/lua-language-server/issues/1924 [#1928]: https://github.com/LuaLS/lua-language-server/issues/1928 [#1945]: https://github.com/LuaLS/lua-language-server/issues/1945 +[#1978]: https://github.com/LuaLS/lua-language-server/issues/1978 ## 3.6.13 `2023-3-2` diff --git a/script/core/completion/auto-require.lua b/script/core/completion/auto-require.lua index cec7139c..3139b911 100644 --- a/script/core/completion/auto-require.lua +++ b/script/core/completion/auto-require.lua @@ -56,9 +56,12 @@ function m.check(state, word, position, callback) : gsub("(%p)", "%%%1") : gsub("%%%?", "(.-)") - stemName = relativePath - : match(pattern) - : match("[%a_][%w_]*$") + local stemPath = relativePath:match(pattern) + if not stemPath then + goto INNER_CONTINUE + end + + stemName = stemPath:match("[%a_][%w_]*$") if not stemName or testedStem[stemName] then goto INNER_CONTINUE |