mirror of
https://codeberg.org/FelipeLema/cmp-async-path
synced 2025-05-10 19:58:38 +00:00
move reading lines to resolve
This commit is contained in:
parent
c0d3a5e3ab
commit
868f1206ff
@ -149,7 +149,7 @@ source._candidates = function(_, context, dirname, offset, callback)
|
||||
filterText = '/' .. name,
|
||||
insertText = '/' .. name,
|
||||
kind = cmp.lsp.CompletionItemKind.File,
|
||||
documentation = try_get_lines(dirname .. '/' .. name, 10),
|
||||
path = dirname .. '/' .. name,
|
||||
})
|
||||
end
|
||||
end
|
||||
@ -159,7 +159,7 @@ source._candidates = function(_, context, dirname, offset, callback)
|
||||
filterText = '/' .. name,
|
||||
insertText = '/' .. name,
|
||||
kind = cmp.lsp.CompletionItemKind.File,
|
||||
documentation = try_get_lines(dirname .. '/' .. name, 10),
|
||||
path = dirname .. '/' .. name,
|
||||
})
|
||||
end
|
||||
end
|
||||
@ -176,5 +176,12 @@ source._is_slash_comment = function(_)
|
||||
return is_slash_comment and not no_filetype
|
||||
end
|
||||
|
||||
function source:resolve(completion_item, callback)
|
||||
if completion_item.kind == cmp.lsp.CompletionItemKind.File then
|
||||
completion_item.documentation = try_get_lines(completion_item.path, 10)
|
||||
end
|
||||
callback(completion_item)
|
||||
end
|
||||
|
||||
return source
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user