Skip to content

Commit

Permalink
check nil
Browse files Browse the repository at this point in the history
fix #1978
  • Loading branch information
sumneko committed Mar 9, 2023
1 parent b660030 commit 765c926
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 2 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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`
Expand Down
9 changes: 6 additions & 3 deletions script/core/completion/auto-require.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 765c926

Please sign in to comment.