Skip to content
This repository has been archived by the owner on Jul 21, 2024. It is now read-only.

Commit

Permalink
special handle the full_imports_path of rustanalyzer
Browse files Browse the repository at this point in the history
  • Loading branch information
glepnir committed Jun 5, 2024
1 parent 291d137 commit 50e58d5
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lua/epo/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,15 @@ local function complete_ondone(bufnr)
util.apply_text_edits(cp_item.additionalTextEdits, bufnr, client.offset_encoding)
end

if vim.bo[args.buf].filetype == 'rust' and vim.tbl_get(cp_item, 'data', 'imports') then
for _, import in ipairs(cp_item.data.imports) do
if import.full_import_path then
local full = ('use %s'):format(import.full_import_path)
api.nvim_buf_set_lines(args.buf, 0, 0, false, { full, '' })
end
end
end

if offset_snip then
offset_snip = offset_snip:sub(col - context[args.buf].startidx + 1)
if #offset_snip > 0 then
Expand Down

0 comments on commit 50e58d5

Please sign in to comment.