Skip to content
This repository has been archived by the owner on Oct 13, 2021. It is now read-only.

Rust analyzer postfix completion issue #354

Open
svcop3 opened this issue Mar 11, 2021 · 1 comment
Open

Rust analyzer postfix completion issue #354

svcop3 opened this issue Mar 11, 2021 · 1 comment

Comments

@svcop3
Copy link

svcop3 commented Mar 11, 2021

When expanding rust analyzer postfix completion, the trigger text is not replaced.

minimal.vim :

call minpac#init()
call minpac#add('k-takata/minpac', {'type': 'opt'})
call minpac#add('neovim/nvim-lspconfig')
call minpac#add('nvim-lua/completion-nvim')
call minpac#add('norcalli/snippets.nvim')

set completeopt=menuone,noinsert,noselect
set shortmess+=c
set signcolumn=yes

lua <<EOF

require'snippets'.use_suggested_mappings()
local nvim_lsp = require'lspconfig'

local on_attach = function(client)
	require'completion'.on_attach(client)
end

local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities.textDocument.completion.completionItem.snippetSupport = true

nvim_lsp.rust_analyzer.setup{ capabilities=capabilities; on_attach=on_attach }
EOF

let g:completion_enable_snippet = 'snippets.nvim'
inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"
inoremap <expr> <Tab>   pumvisible() ? "\<C-n>" : "\<Tab>"	

How to reproduce

  1. Type foo().
  2. expand 'if' snippet
  3. text displayed is
    foo().if foo() { |}

Expected behavior
if foo() { |}

edit: correct formatting

@matoous
Copy link

matoous commented Jun 12, 2021

Hi! Just wanted to add: this applies to other LSPs (most likely) as well, for example for gopls the behaviour is same. I tried with the latest version 0.7.0 which has added support for postfix completions: https://github.com/golang/tools/releases/tag/gopls%2Fv0.7.0 and encountered same issues as you. I am not sure whether the issue is related to nvim-lua/completion-nvim though. This might be issue for neovim itself?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants