Skip to content
This repository was archived by the owner on Oct 13, 2021. It is now read-only.

Commit 254dfd5

Browse files
committed
fix: error in path completion
1 parent 0c6aafc commit 254dfd5

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

lua/source/path.lua

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,9 @@ M.triggerFunction = function(_, _, _, manager)
6565
local keyword = line_to_cursor:match("[^%s\"].*")
6666
if keyword ~= '/' then
6767
-- TODO rewrite this
68-
local index = string.len(keyword) - string.find(keyword:reverse(), '/') + 1
69-
keyword = string.sub(keyword, 1, index)
68+
local index = string.find(keyword:reverse(), '/') or 1
69+
local length = string.len(keyword) - index + 1
70+
keyword = string.sub(keyword, 1, length)
7071
-- keyword = keyword:match("%s*(%S+)%w*/.*$")
7172
end
7273

0 commit comments

Comments
 (0)