Merge pull request #9 from dmitmel/main

Fix crashes when completing a path after ~/ and with an unmatched {
This commit is contained in:
hrsh7th 2021-10-18 19:44:32 +09:00 committed by GitHub
commit c495b5985d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 3 deletions

View File

@ -54,9 +54,9 @@ source._dirname = function(self, params)
elseif prefix:match('%./$') then
return vim.fn.resolve(buf_dirname .. '/' .. dirname)
elseif prefix:match('~/$') then
return vim.fn.expand('~/' .. dirname), params.offset
return vim.fn.resolve(vim.fn.expand('~') .. '/' .. dirname)
elseif prefix:match('%$[%a_]+/$') then
return vim.fn.expand(prefix:match('%$[%a_]+/$') .. dirname)
return vim.fn.resolve(vim.fn.getenv(prefix:match('%$([%a_]+)/$')) .. '/' .. dirname)
elseif prefix:match('/$') then
local accept = true
-- Ignore URL components
@ -157,4 +157,3 @@ source._is_slash_comment = function(_)
end
return source