mirror of
https://codeberg.org/FelipeLema/cmp-async-path
synced 2025-05-11 04:08:42 +00:00
Regex compile first
This commit is contained in:
parent
62ecedd4bd
commit
8889960ab7
@ -1,7 +1,7 @@
|
|||||||
local cmp = require'cmp'
|
local cmp = require'cmp'
|
||||||
|
|
||||||
local NAME_REGEX = [[\%([^/\\:\*?<>'"`\|]\)]]
|
local NAME_REGEX = [[\%([^/\\:\*?<>'"`\|]\)]]
|
||||||
local PATH_REGEX = ([[\%(/PAT\+\)*\ze/PAT*]]):gsub('PAT', NAME_REGEX)
|
local PATH_REGEX = vim.regex(([[\%(/PAT\+\)*\ze/PAT*]]):gsub('PAT', NAME_REGEX))
|
||||||
|
|
||||||
local source = {}
|
local source = {}
|
||||||
|
|
||||||
@ -37,7 +37,7 @@ source.complete = function(self, params, callback)
|
|||||||
end
|
end
|
||||||
|
|
||||||
source._dirname = function(self, params)
|
source._dirname = function(self, params)
|
||||||
local s = vim.regex(PATH_REGEX):match_str(params.context.cursor_before_line)
|
local s = PATH_REGEX:match_str(params.context.cursor_before_line)
|
||||||
if not s then
|
if not s then
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user