mirror of
https://codeberg.org/FelipeLema/cmp-async-path
synced 2025-05-16 22:58:28 +00:00
Merge pull request #16 from sudoforge/10/relative-paths-without-a-leading-slash
feat: support relative paths without a leading forward slash
This commit is contained in:
commit
e30d3fdee6
@ -1,7 +1,7 @@
|
||||
local cmp = require'cmp'
|
||||
|
||||
local NAME_REGEX = '\\%([^/\\\\:\\*?<>\'"`\\|]\\)'
|
||||
local PATH_REGEX = vim.regex(([[\%(/PAT\+\)*/\zePAT*$]]):gsub('PAT', NAME_REGEX))
|
||||
local PATH_REGEX = vim.regex(([[\%([/"\']PAT\+\)*[/"\']\zePAT*$]]):gsub('PAT', NAME_REGEX))
|
||||
|
||||
local source = {}
|
||||
|
||||
@ -14,7 +14,7 @@ source.new = function()
|
||||
end
|
||||
|
||||
source.get_trigger_characters = function()
|
||||
return { '/', '.' }
|
||||
return { '/', '.', '"', '\'' }
|
||||
end
|
||||
|
||||
source.get_keyword_pattern = function()
|
||||
@ -56,7 +56,7 @@ source._dirname = function(self, params)
|
||||
if prefix:match('%.%./$') then
|
||||
return vim.fn.resolve(buf_dirname .. '/../' .. dirname)
|
||||
end
|
||||
if prefix:match('%./$') then
|
||||
if (prefix:match('%./$') or prefix:match('"$') or prefix:match('\'$')) then
|
||||
return vim.fn.resolve(buf_dirname .. '/' .. dirname)
|
||||
end
|
||||
if prefix:match('~/$') then
|
||||
|
Loading…
Reference in New Issue
Block a user