Shougo / ddc-source-lsp

lsp source for ddc.vim
Other
67 stars 22 forks source link

inserted text disappear when snippetSupport is enabled #43

Closed Warashi closed 1 year ago

Warashi commented 1 year ago
  1. install gopls
  2. use vimrc below

    let s:cache_dir = expand("~/.cache/nvim/dein")
    let s:pum = s:cache_dir . "/repos/github.com/Shougo/pum.vim"
    let s:denops = s:cache_dir . "/repos/github.com/vim-denops/denops.vim"
    let s:ddc = s:cache_dir . "/repos/github.com/Shougo/ddc.vim"
    let s:ddc_source_nvim_lsp = s:cache_dir . "/repos/github.com/Shougo/ddc-source-nvim-lsp"
    let s:ddc_ui_pum = s:cache_dir . "/repos/github.com/Shougo/ddc-ui-pum"
    
    let s:lspconfig = s:cache_dir . "/repos/github.com/neovim/nvim-lspconfig"
    
    execute 'set runtimepath+=' . s:pum
    execute 'set runtimepath+=' . s:denops
    execute 'set runtimepath+=' . s:ddc
    execute 'set runtimepath+=' . s:ddc_source_nvim_lsp
    execute 'set runtimepath+=' . s:ddc_ui_pum
    execute 'set runtimepath+=' . s:lspconfig
    
    inoremap <silent><expr> <C-n> pum#visible() ? pum#map#select_relative(+1) : ddc#map#manual_complete()
    inoremap <silent><expr> <C-y> pum#map#confirm()
    
    call ddc#custom#patch_global(#{ ui: "pum", sources: ["nvim-lsp"], autoCompleteEvents: []})
    call ddc#enable()
    
    lua << EOF
    local capabilities = vim.lsp.protocol.make_client_capabilities()
    capabilities.textDocument.completion.completionItem.snippetSupport = true
    require("lspconfig").gopls.setup({ capabilities = capabilities })
    EOF
  3. make temporary directory
  4. do go mod init exmaple.com/ddc-source-nvim-lsp-test/main
  5. open main.go with nvim
  6. type as below
    package main
  7. enter newline with Insert mode, then type func<C-n><C-n><C-y> slowly slowly because make first <C-n> successfully open completion menu.
Warashi commented 1 year ago

I forgot to set snippetEngine documented below. https://github.com/Shougo/ddc-source-nvim-lsp/blob/738b86b5c16ee8f396d9437e6aea17780e325ef1/doc/ddc-source-nvim-lsp.txt#L67-L74

The problem is solved after configure these settings. I'm sorry, there is no problem without my settings.

Shougo commented 1 year ago

I have checked the code and it is the problem of ddc-source-nvim-lsp. Please update.