Git Product home page Git Product logo

ddc-source-lsp's People

Contributors

110y avatar 4513echo avatar atusy avatar azufr avatar delphinus avatar e-kwsm avatar gamoutatsumi avatar haruyama avatar ippachi avatar kamecha avatar kuuote avatar lumakernel avatar matsui54 avatar ogaken-1 avatar shougo avatar staticwagomu avatar uga-rosa avatar willelz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

ddc-source-lsp's Issues

inserted text disappear when snippetSupport is enabled

  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.

Completion does not work well in recent commits when capabilities.textDocument.completion.completionItem.snippetSupport = true (and no snippet plugins are used?)

prerequisite

Software version

  • NVIM v0.10.0-dev-673+g622ae2f53
  • Vim plugins other than ddc-source-nvim-lsp: latest at time of posting.

Other

  1. set up golang runtime and go install golang.org/x/tools/gopls@latest
  2. prepare main.go with the following content
package main

import "fmt"

func main() {
	fmt.Println("hello")
}

Steps to reproduce

case 1

7008699

  1. copy https://github.com/haruyama/ddc-source-nvim-lsp-config-for-debug/tree/f1939a76a22d63085319d4693c654e99f5267f69 to ~/.config/nvim
  2. nvim main.go on console
  3. enter fmt.P in main function

no candidates are displayed from ddc.

no error messages in :messages

case 2

738b86b

  1. copy https://github.com/haruyama/ddc-source-nvim-lsp-config-for-debug/tree/f1939a76a22d63085319d4693c654e99f5267f69 to ~/.config/nvim
  2. comment out L53-L56 in ~/.config/nvim/dein_lazy.toml
  3. comment in L59-L62 in ~/.config/nvim/dein_lazy.toml
  4. nvim main.go on console
  5. enter fmt.P and Ctrl-N and ( in main function

fmt.( is displayed. (expected: fmt.Println()

error messages in :messages

[ddc] source: nvim-lsp "onCompleteDone()" failed                                                                                                                                                                              
[denops] (ddc) 0,CompleteDone Autocommands for "*"..function ddc#ui#native#_on_complete_done[6]..ddc#on_complete_done[1]..ddc#complete#_on_complete_done[28]..denops#request[1]..denops#server#request[4]..denops#_internal#server#chan
#request[4]..denops#_internal#rpc#nvim#request[1]..denops#callback#call, line 2: No callback function for  exist

nvim-lsp "gather()" failed

I am getting the following error as the title says.

image

I have not made any changes on my config for a couple months now: https://github.com/creativenull/dotfiles/blob/d5a03647d69f965c0e4d1b80145bcee56215a403/config/nvim/lua/user/ddc.lua#L87

I also turned on debug mode on denops but do not see any additional errors other than the image above.

What else can I try to debug this issue?

Specifications:

Deno v1.35
Denops (commit: https://github.com/vim-denops/denops.vim/tree/fece0a2b24655e42a3fd10dbbf2962d39b381e90)
ddc.vim (commit: https://github.com/Shougo/ddc.vim/tree/6c1de37d138d376326c9bbc1ed0b66d6a244189a)
Neovim 0.9.1

Candidates not shown (from gopls)

Problems summary

Candidates from nvim-lsp does not be shown (from gopls at least).

Expected

Environment Information

  • ddc.vim version (SHA1): b30ba8b14264933acd67eba68f17507dbfffc473

  • ddc-nvim-lsp version (SHA1): a5f9c16

  • denops.vim version (SHA1): 84cbe85d95145998050bb2e95940f84e221331da

  • deno version(deno -V output): deno 1.15.2

  • OS: Ubuntu 21.04

  • neovim version (SHA1): 9086938f7bd6d6ccb7f4a30fb78aeaf0d84e4471

  • gopls version:

    golang.org/x/tools/gopls master
        golang.org/x/tools/[email protected] h1:6bmYt+2wZ6DzkRtpVZV8V4lpUTkWYsqqYTgOaY/re04=
    

Provide a minimal init.vim/vimrc with less than 50 lines (Required!)

call ddc#custom#patch_global({
      \ 'sources': ['nvim-lsp', 'around'],
      \ 'sourceOptions': {
      \   '_': {'matchers': ['matcher_head']},
      \   'around': {'mark': 'A'},
      \   'nvim-lsp': {'mark': 'L', 'forceCompletionPattern': '\.\w*|:\w*|->\w*'},
      \ },
      \ })
call ddc#enable()

lua << EOF
  require'lspconfig'.gopls.setup{}
EOF

How to reproduce the problem from neovim/Vim startup (Required!)

  1. Run this Dockerfile.
  2. nvim hoge.go
  3. Seeing candidates from around, but no ones from nvim-lsp. See screencats below.

asciicast

Using built-in terminal breaks lsp server

I work on C projects using the clang lsp, and used deoplete with this setup successfully before.
While working on a C project if I open a split terminal window (:terminal) to execute some commands, after some time (a random amount, it can take a while or be quick, but it always happens) completion stops working and nvim spams with error messages:

E475: Invalid argument: Channel doesn't exist
Error detected while processing TextChangedT Autocommands for "*"..function ddc#_on_event[6]..denops#notify[1]..denops#server#notify[4]..denops#_internal#server#chan#notify[4]..denops#_internal#rpc#nvim#notify:
line    1:
E475: Invalid argument: Channel doesn't exist
Error detected while processing TextChangedT Autocommands for "*"..function ddc#_on_event[6]..denops#notify[1]..denops#server#notify[4]..denops#_internal#server#chan#notify[4]..denops#_internal#rpc#nvim#notify:
line    1:
E475: Invalid argument: Channel doesn't exist
Error detected while processing TextChangedT Autocommands for "*"..function ddc#_on_event[6]..denops#notify[1]..denops#server#notify[4]..denops#_internal#server#chan#notify[4]..denops#_internal#rpc#nvim#notify:
line    1:
E475: Invalid argument: Channel doesn't exist
Error detected while processing TextChangedT Autocommands for "*"..function ddc#_on_event[6]..denops#notify[1]..denops#server#notify[4]..denops#_internal#server#chan#notify[4]..denops#_internal#rpc#nvim#notify:
line    1:
E475: Invalid argument: Channel doesn't exist
Error detected while processing TextChangedT Autocommands for "*"..function ddc#_on_event[6]..denops#notify[1]..denops#server#notify[4]..denops#_internal#server#chan#notify[4]..denops#_internal#rpc#nvim#notify:
line    1:
E475: Invalid argument: Channel doesn't exist
[denops] Server stopped (133). Restarting...
[denops] <--- Last few GCs --->
[denops]
[denops] [288147:0x7f6f4c075a20]     6766 ms: Scavenge 1365.1 (1430.9) -> 1362.3 (1432.7) MB, 33.0 / 0.0 ms  (average mu = 0.359, current mu = 0.289) task;
[denops] [288147:0x7f6f4c075a20]     7602 ms: Mark-Compact 1367.2 (1432.7) -> 1364.7 (1444.9) MB, 830.3 / 0.0 ms  (average mu = 0.231, current mu = 0.105) task; scavenge might not succeed
[denops] [288147:0x7f6f4c075a20]     8971 ms: Mark-Compact 1377.6 (1444.9) -> 1373.4 (1454.2) MB, 1362.4 / 0.0 ms  (average mu = 0.096, current mu = 0.005) task; scavenge might not succeed
[denops]
[denops]
[denops] <--- JS stacktrace --->
[denops]
[denops]
[denops] #
[denops] # Fatal javascript OOM in Reached heap limit
[denops] #
[denops]
[denops] Server stopped (133). Restarting...
[denops] <--- Last few GCs --->
[denops]
[denops] [289099:0x7f9c80075a20]     7150 ms: Scavenge 1367.1 (1418.5) -> 1366.4 (1428.3) MB, 3.6 / 0.0 ms  (average mu = 0.314, current mu = 0.272) task;
[denops] [289099:0x7f9c80075a20]     7158 ms: Scavenge 1371.9 (1428.3) -> 1370.5 (1429.5) MB, 4.2 / 0.0 ms  (average mu = 0.314, current mu = 0.272) task;
[denops] [289099:0x7f9c80075a20]     7165 ms: Scavenge 1372.7 (1429.5) -> 1371.8 (1449.8) MB, 4.6 / 0.0 ms  (average mu = 0.314, current mu = 0.272) task;
[denops]
[denops]
[denops] <--- JS stacktrace --->
[denops]
[denops]
[denops] #
[denops] # Fatal javascript OOM in Reached heap limit
[denops] #
[denops]
[denops] Server stopped (133). Restarting...

It spams like this every minute or so after it happens for the first time.

My plugin configuration:

require('packer').startup(function(use)
    use 'wbthomason/packer.nvim'

    use { 'neovim/nvim-lspconfig',
        config = function()
            require'lspconfig'.clangd.setup{}
        end
    }

    use { 'Shougo/ddc-source-nvim-lsp',
        requires = {'Shougo/ddc.vim', 'neovim/nvim-lspconfig'}
    }

    use { 'Shougo/ddc.vim',
        requires = {
            'Shougo/ddc-ui-native',
            'vim-denops/denops.vim',
            'Shougo/ddc-source-nvim-lsp',
        },
        config = function()
            vim.fn['ddc#custom#patch_global']('ui', 'native')
            vim.fn['ddc#custom#patch_global']({
                sources = {'nvim-lsp'},
                sourceOptions = {
                    ["nvim-lsp"] = {
                        mark = 'L',
                        forceCompletionPattern = '\\.\\w*| =\\w*|->\\w*' },
                    }
                })
            vim.keymap.set('i', '<Tab>', function()
                local col = vim.fn.col('.') - 1
                if vim.fn.pumvisible() == 1 then
                    return "<C-n>"
                elseif col <= 1 or vim.fn.getline('.'):sub(col, col):match('%s') then
                    return "<TAB>"
                else
                    return vim.cmd("call ddc#map#manual_complete()")
                end
            end, {expr = true, silent = true})

            vim.fn["ddc#enable"]()
        end
    }

end)

Showing errors with using efm-langserver

Problems summary

When using neovim/nvim-lspconfig and efm-langserver, printed errors every time typing character.

Expected

Not showing errors.

Environment Information

  • ddc.vim version (SHA1): eaed91a9977a2ee58333608c8829a207ad2aa18d

  • denops.vim version (SHA1): 228d446132825bd8035a5530a206611f639f9a74

  • deno version(deno -V output): deno 1.16.2

  • OS: Arch Linux

  • neovim/Vim :version output: NVIM v0.6.0-dev+605-g2bd8f2fb5

  • :checkhealth or :CheckHealth result(neovim only):

checkhealth
denops: health#denops#check
========================================================================
  - INFO: Supported Deno version: `1.14.0`
  - INFO: Detected Deno version: `1.16.2`
  - OK: Deno version check: passed
  - INFO: Supported Neovim version: `0.5.0`
  - INFO: Detected Neovim version: `0.6.0`
  - OK: Neovim version check: passed
  - INFO: Denops status: `running`
  - OK: Denops status check: passed

lspconfig: require("lspconfig.health").check()
========================================================================
  - WARNING: Can't find any config.
  - INFO: gopls: configuration checked.
  - INFO: eslint: configuration checked.
  - INFO: efm: configuration checked.
  - INFO: jsonls: configuration checked.
  - INFO: vimls: configuration checked.
  - INFO: rust_analyzer: configuration checked.
  - INFO: tsserver: configuration checked.
  - INFO: yamlls: configuration checked.

nvim: health#nvim#check
========================================================================
## Configuration
  - WARNING: Missing user config file: /home/gamoutatsumi/.config/nvim/init.vim
    - ADVICE:
      - :help |nvim-from-vim|

## Performance
  - OK: Build type: RelWithDebInfo

## Remote Plugins
  - OK: Up to date

## terminal
  - INFO: key_backspace (kbs) terminfo entry: key_backspace=^H
  - INFO: key_dc (kdch1) terminfo entry: key_dc=\E[3~
  - INFO: $TERM_PROGRAM='tmux'
  - INFO: $COLORTERM='truecolor'

## tmux
  - OK: escape-time: 10
  - INFO: Checking stuff
  - OK: focus-events: on
  - INFO: $TERM: screen-256color

provider: health#provider#check
========================================================================
## Clipboard (optional)
  - OK: Clipboard tool found: xclip

## Python 2 provider (optional)
  - WARNING: No Python executable found that can `import neovim`. Using the first available executable for diagnostics.
  - ERROR: Python provider error:
    - ADVICE:
      - provider/pythonx: Could not load Python 2:
          /usr/bin/python2 does not have the "neovim" module. :help |provider-python|
          /usr/bin/python2.7 does not have the "neovim" module. :help |provider-python|
          python2.6 not found in search path or not executable.
          /usr/bin/python is Python 3.9 and cannot provide Python 2.
  - INFO: Executable: Not found

## Python 3 provider (optional)
  - INFO: `g:python3_host_prog` is not set.  Searching for python3 in the environment.
  - INFO: Multiple python3 executables found.  Set `g:python3_host_prog` to avoid surprises.
  - INFO: Executable: /usr/bin/python3
  - INFO: Other python executable: /bin/python3
  - INFO: Python version: 3.9.7
  - INFO: pynvim version: 0.4.3
  - OK: Latest pynvim is installed.

## Python virtualenv
  - OK: no $VIRTUAL_ENV

## Ruby provider (optional)
  - INFO: Ruby: ruby 3.0.2p107 (2021-07-07 revision 0db68f0233) [x86_64-linux]
  - WARNING: `neovim-ruby-host` not found.
    - ADVICE:
      - Run `gem install neovim` to ensure the neovim RubyGem is installed.
      - Run `gem environment` to ensure the gem bin directory is in $PATH.
      - If you are using rvm/rbenv/chruby, try "rehashing".
      - See :help |g:ruby_host_prog| for non-standard gem installations.

## Node.js provider (optional)
  - INFO: Node.js: v16.13.0
  - WARNING: Missing "neovim" npm (or yarn) package.
    - ADVICE:
      - Run in shell: npm install -g neovim
      - Run in shell (if you use yarn): yarn global add neovim

## Perl provider (optional)
  - ERROR: perl provider error:
    - ADVICE:
      - "Neovim::Ext" cpan module is not installed

vim.lsp: require("vim.lsp.health").check()
========================================================================
  - INFO: LSP log level : WARN
  - INFO: Log path: /home/gamoutatsumi/.cache/nvim/lsp.log
  - INFO: Log size: 56708 KB

vim.treesitter: require("vim.treesitter.health").check()
========================================================================
  - INFO: Runtime ABI version : 13

Provide a minimal init.vim/vimrc with less than 50 lines (Required!)

set runtimepath^=~/Repositories/github.com/Shougo/ddc.vim
set runtimepath^=~/Repositories/github.com/vim-denops/denops.vim
set runtimepath^=~/Repositories/github.com/Shougo/ddc-nvim-lsp
set runtimepath^=~/Repositories/github.com/neovim/nvim-lspconfig

function! s:ddcinit() abort
  call ddc#custom#patch_global('backspaceCompletion', v:true)
  call ddc#custom#patch_global('autoCompleteEvents',
        \ ['InsertEnter', 'TextChangedI', 'TextChangedP'])
  call ddc#custom#patch_global('sources', ['nvim-lsp'])
  call ddc#custom#patch_global('sourceOptions', {
        \ 'nvim-lsp': {
          \   'mark': 'lsp',
          \   'isVolatile': v:true,
          \ },
          \ })

  call ddc#enable()
endfunction

lua << EOF
  require'lspconfig'.efm.setup{ 
    filetypes = { 'markdown' }
  }
EOF

autocmd User DenopsReady call s:ddcinit()

How to reproduce the problem from neovim/Vim startup (Required!)

  1. Install efm-langserver.
  2. start neovim.
  3. open buffer with file enabled only efm. ( e.g. markdown )
  4. typing any characters

Screenshot (if possible)

Error after line break

The LSP I used is pyright.

bug

Message: Error executing vim.schedule lua callback: ...epos/github.com/Shougo/ddc-nvim-lsp/lua/ddc_nvim_lsp.lua:5: attempt to index local 'result' (a nil value)

I don't think the mapping to <CR> has anything to do with it, since the same error occurs when inserting by o.

This is part of my dein_lazy.toml.

~~~
[[plugins]]
repo = 'vim-denops/denops.vim'

[[plugins]]
repo = 'Shougo/ddc-sorter_rank'

[[plugins]]
repo = 'Shougo/ddc-matcher_head'

[[plugins]]
repo = 'Shougo/ddc-around'

[[plugins]]
repo = 'Shougo/ddc-zsh'

[[plugins]]
repo = 'Shougo/ddc-nvim-lsp'

[[plugins]]
repo = 'Shougo/ddc.vim'
on_event = 'InsertEnter'
depends = ['denops.vim', 'ddc-sorter_rank', 'ddc-matcher_head', 'ddc-around', 'ddc-zsh', 'ddc-nvim-lsp']
hook_source = '''
inoremap <silent><expr> <cr> pumvisible() ? ddc#insert_candidate(0) : '<cr>'
'''
hook_post_source = '''
call ddc#custom#patch_global('sources', ['around'])
call ddc#custom#patch_global('sourceOptions', {
      \'_': {
        \'sorters': ['sorter_rank'],
        \'matchers': ['matcher_head']
      \},
      \ 'around': {'mark': 'A'},
      \})
call ddc#custom#patch_filetype(['python', 'rust'], 'sources', ['around', 'nvimlsp'])
call ddc#custom#patch_filetype(['python', 'rust'], 'sourceOptions', {
      \ 'nvimlsp': {'mark': 'lsp', 'forceCompletionPattern': '\.|:|->'},
      \})
call ddc#custom#patch_filetype('zsh', 'sources', ['around', 'zsh'])
call ddc#custom#patch_filetype('zsh', 'sourceOptions', {
      \ 'zsh': {'mark': 'Z'}
      \})
call ddc#enable()
'''

[[plugins]]
repo = 'neovim/nvim-lspconfig'
on_ft = ['rust', 'python']
hook_source = '''
lua << EOL
lsps = {rust = 'rust_analyzer', python = 'pyright'}
for lang, server in pairs(lsps) do
  if vim.bo.filetype == lang then
    require'lspconfig'[server].setup{}
  end
end
EOL
'''

By the way, rust-analyzer gave a lot of errors and did not work at all.
Failed to call 'onEvent' with ["Auto"]: ReferenceError: rec is not defined ~

Last typed word remain as completion matcher even after deleting it

Warning: I will close the issue without the minimal init.vim and the
reproduction instructions.

Problems summary

Last typed character or word? remain as completion matcher even after deleting it using backspace.
As a result, only completion candidates that matched with last typed word are returned

Expected

After deleting word or character, completion matcher should be reset to empty string and all completion candidates should be return

Environment Information

  • ddc.vim version (SHA1): 4da0d40efff84f3e5bc86947bc2448481fbbda7d

  • ddc-source-nvim-lsp version (SHA1): 922e38f75c8e588321e78717557fc1d2b5013983

  • denops.vim version (SHA1): 6b29032365f82fc1ef78d206e4019fd510ea51fb

  • deno version(deno -V output):

deno 1.33.0
  • OS:
    Arch Linux

  • neovim/Vim :version output:

NVIM v0.9.0
Build type: Release
LuaJIT 2.1.0-beta3

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/usr/share/nvim"

Run :checkhealth for more info

Provide a minimal init.vim/vimrc without plugin managers (Required!)

vim.opt.runtimepath:append({ '~/.local/share/nvim/lazy/denops.vim' })
vim.opt.runtimepath:append({ '~/.local/share/nvim/lazy/ddc.vim' })
vim.opt.runtimepath:append({ '~/.local/share/nvim/lazy/ddc-around' })
vim.opt.runtimepath:append({ '~/.local/share/nvim/lazy/ddc-fuzzy' })
vim.opt.runtimepath:append({ '~/.local/share/nvim/lazy/ddc-ui-pum' })
vim.opt.runtimepath:append({ '~/.local/share/nvim/lazy/pum.vim' })
vim.opt.runtimepath:append({ '~/.local/share/nvim/lazy/ddc-source-nvim-lsp' })
vim.opt.runtimepath:append({ '~/.local/share/nvim/lazy/nvim-lspconfig' })

vim.opt.completeopt = { 'menu', 'menuone', 'noinsert' }
vim.fn['pum#set_option']('use_complete', false)
vim.fn['pum#set_option']('scrollbar_char', '')
local ddc_opts = {
    ui = 'pum',
    autoCompleteEvents = { 'InsertEnter', 'TextChangedI', 'TextChangedP', 'CmdlineChanged', 'CmdlineEnter' },
    sources = { 'nvim-lsp', 'around' },
    sourceOptions = {
        _ = {
            matchers = { 'matcher_fuzzy' },
            sorters = { 'sorter_fuzzy' }
        },
        ['nvim-lsp'] = {
            mark = '[lsp]',
            dup = 'keep',
            forceCompletionPattern = [[\.\w*|:\w*|->\w*]],
            minAutoCompleteLength = 2,
            maxItems = 1000,
            ignoreCase = true,
        },
        ['around'] = {
            mark = '[A]'
        }
    }
}

vim.fn['ddc#custom#patch_global'](ddc_opts)
vim.fn['ddc#enable']()


vim.keymap.set('i', '<C-y>', '<cmd>call pum#map#confirm()<cr>')
vim.keymap.set('i', '<C-e>', '<cmd>call pum#map#cancel()<cr>')
vim.keymap.set('i', '<C-n>', '<cmd>call pum#map#insert_relative(+1)<cr>')
vim.keymap.set('i', '<C-p>', '<cmd>call pum#map#insert_relative(-1)<cr>')

-- Setup language servers.
local lspconfig = require('lspconfig')
lspconfig.pyright.setup({
    cmd = { '/opt/language-servers/bin/pyright-langserver', '--stdio' }
})


-- Global mappings.
-- See `:help vim.diagnostic.*` for documentation on any of the below functions
vim.keymap.set('n', '<space>e', vim.diagnostic.open_float)
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev)
vim.keymap.set('n', ']d', vim.diagnostic.goto_next)
vim.keymap.set('n', '<space>q', vim.diagnostic.setloclist)

-- Use LspAttach autocommand to only map the following keys
-- after the language server attaches to the current buffer
vim.api.nvim_create_autocmd('LspAttach', {
    group = vim.api.nvim_create_augroup('UserLspConfig', {}),
    callback = function(ev)
        -- Enable completion triggered by <c-x><c-o>
        vim.bo[ev.buf].omnifunc = 'v:lua.vim.lsp.omnifunc'

        -- Buffer local mappings.
        -- See `:help vim.lsp.*` for documentation on any of the below functions
        local opts = { buffer = ev.buf }
        vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, opts)
        vim.keymap.set('n', 'gd', vim.lsp.buf.definition, opts)
        vim.keymap.set('n', 'K', vim.lsp.buf.hover, opts)
        vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, opts)
        vim.keymap.set('n', '<C-k>', vim.lsp.buf.signature_help, opts)
        vim.keymap.set('n', '<space>wa', vim.lsp.buf.add_workspace_folder, opts)
        vim.keymap.set('n', '<space>wr', vim.lsp.buf.remove_workspace_folder, opts)
        vim.keymap.set('n', '<space>wl', function()
            print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
        end, opts)
        vim.keymap.set('n', '<space>D', vim.lsp.buf.type_definition, opts)
        vim.keymap.set('n', '<space>rn', vim.lsp.buf.rename, opts)
        vim.keymap.set({ 'n', 'v' }, '<space>ca', vim.lsp.buf.code_action, opts)
        vim.keymap.set('n', 'gr', vim.lsp.buf.references, opts)
        vim.keymap.set('n', '<space>f', function()
            vim.lsp.buf.format { async = true }
        end, opts)
    end,
})

How to reproduce the problem from neovim/Vim startup (Required!)

following steps are for python/pyright languange server. this problem also happened with lua/lua-ls.

  1. open .py file
  2. type the following
import os
os.path
  1. delete .path part
  2. type . and only candidate match with path are returned.
  3. It should be reset and return all completion candidates from os module

Screenshot (if possible)

last-word-delete-remain

Upload the log messages by :redir and :message (if errored)

No Error

The source becomes slow in non-lsp buffer

Problems summary

Nvim-lsp source becomes very slow in buffers which language server doesn't attach.

Expected

Completion menu appears immediately after typing.

Environment Information

  • ddc.vim version (SHA1): Shougo/ddc.vim@e1f2e76

  • denops.vim version (SHA1): Shougo/ddc.vim@e1f2e76

  • deno version(deno -V output): deno 1.14.3 (release, x86_64-unknown-linux-gnu)

  • OS: arch linux

  • neovim/Vim :version output: NVIM v0.6.0-dev+366-g270cc1d70

  • :checkhealth or :CheckHealth result(neovim only): No problem

Provide a minimal init.vim/vimrc with less than 50 lines (Required!)

set runtimepath+=~/.cache/dein/repos/github.com/vim-denops/denops.vim/
set runtimepath+=~/.cache/dein/repos/github.com/Shougo/ddc.vim
set runtimepath+=~/.cache/dein/repos/github.com/Shougo/ddc-nvim-lsp
set runtimepath+=~/.cache/dein/repos/github.com/Shougo/ddc-around
set runtimepath+=~/.cache/dein/repos/github.com/neovim/nvim-lspconfig

call ddc#custom#patch_global('sources', ['nvim-lsp', 'around'])
call ddc#custom#patch_global('sourceOptions', {
      \ 'around': {'mark': 'A'},
      \ 'nvim-lsp': {'mark': 'lsp'},
      \ })
call ddc#enable()
lua require'lspconfig'.clangd.setup{}

How to reproduce the problem from neovim/Vim startup (Required!)

  1. Start nvim and type something like hoge ho.
  2. Complete menu appears with delay of few seconds (This does not occur in c buffer which server attaches).

The delay time seems 2000 ms which is timeout of ddc-source-option.
I tried this config and the delay became shorter.

call ddc#custom#patch_global('sourceOptions', {'_': {'timeout': 100}})

Screenshot (if possible)

simplescreenrecorder-2021-10-12_16.54.50.mp4

Completions not working for Python 3 -- Nvim 0.6.0

Problems summary

Getting error when trying to get completions from nvim-lsp (getting the same from omni completion source).
[denops] at async Session.handleNotification (https://deno.land/x/[email protected]/session.ts:130:7)

Expected

Get completions.

Environment Information

  • ddc.vim version (SHA1): 83047c7

  • denops.vim version (SHA1): 228d4461

  • deno version(deno -V output): deno 1.15.3

  • OS: Ubuntu 20.04.2 LTS (GNU/Linux 5.4.0-71-generic x86_64)

  • neovim/Vim :version output:

NVIM v0.6.0-dev+550-g29cec32f4
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3
Compilation: /usr/bin/gcc-11 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -DNVIM_TS_HAS_SET_MATCH_LIMIT -O2 -g -Og -g -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wmissing-prototypes -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fno-common -fdiagnostics-color=always -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -DMIN_LOG_LEVEL=3 -I/home/runner/work/neovim/neovim/build/config -I/home/runner/work/neovim/neovim/src -I/home/runner/work/neovim/neovim/.deps/usr/include -I/usr/include -I/home/runner/work/neovim/neovim/build/src/nvim/auto -I/home/runner/work/neovim/neovim/build/include
Compiled by runner@fv-az139-640

Features: +acl +iconv +tui
See ":help feature-compile"

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "
/home/runner/work/neovim/neovim/build/nvim.AppDir/usr/share/nvim"
:checkhealth
denops: health#denops#check
========================================================================
  - INFO: Supported Deno version: `1.14.0`
  - INFO: Detected Deno version: `1.15.3`
  - OK: Deno version check: passed
  - INFO: Supported Neovim version: `0.5.0`
  - INFO: Detected Neovim version: `0.6.0`
  - OK: Neovim version check: passed
  - INFO: Denops status: `running`
  - OK: Denops status check: passed

lspconfig: require("lspconfig.health").check()
========================================================================
  - INFO: pyright: configuration checked.

nvim: health#nvim#check
========================================================================
## Configuration
  - OK: no issues found

## Performance
  - OK: Build type: RelWithDebInfo

## Remote Plugins
  - OK: Up to date

## terminal
  - INFO: key_backspace (kbs) terminfo entry: key_backspace=^H
  - INFO: key_dc (kdch1) terminfo entry: key_dc=\E[3~
  - INFO: $SSH_TTY='/dev/pts/0'

## tmux
  - OK: escape-time: 10
  - INFO: Checking stuff
  - OK: focus-events: on
  - INFO: $TERM: tmux-256color

nvim-treesitter: require("nvim-treesitter.health").check()
========================================================================
## Installation
  - OK: `tree-sitter` found  0.20.0 (parser generator, only needed for :TSInstallFromGrammar)
  - OK: `node` found v17.0.1 (only needed for :TSInstallFromGrammar)
  - OK: `git` executable found.
  - OK: `cc` executable found. Selected from { vim.NIL, "cc", "gcc", "clang", "cl", "zig" }
    Version: cc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0
  - OK: Neovim was compiled with tree-sitter runtime ABI version 13 (required >=13). Parsers must be compatible with runtime ABI.

## Parser/Features H L F I J
  - python         ✓ ✓ ✓ ✓ ✓ 
  - bash           ✓ ✓ ✓ . ✓ 
  - ...
  Legend: H[ighlight], L[ocals], F[olds], I[ndents], In[j]ections
         +) multiple parsers found, only one will be used
         x) errors found in the query, try to run :TSUpdate {lang}

provider: health#provider#check
========================================================================
## Clipboard (optional)
  - OK: Clipboard tool found: tmux

## Python 2 provider (optional)
  - WARNING: No Python executable found that can `import neovim`. Using the first available executable for diagnostics.
  - ERROR: Python provider error:
    - ADVICE:
      - provider/pythonx: Could not load Python 2:
          /usr/bin/python2 does not have the "neovim" module. :help |provider-python|
          /usr/bin/python2.7 does not have the "neovim" module. :help |provider-python|
          python2.6 not found in search path or not executable.
          /home/philip/miniconda3/bin/python is Python 3.9 and cannot provide Python 2.
  - INFO: Executable: Not found

## Python 3 provider (optional)
  - INFO: Using: g:python3_host_prog = "~/miniconda3/envs/neovim/bin/python"
  - INFO: Executable: /home/philip/miniconda3/envs/neovim/bin/python
  - INFO: Python version: 3.9.7
  - INFO: pynvim version: 0.4.3
  - OK: Latest pynvim is installed.

## Python virtualenv
  - OK: no $VIRTUAL_ENV

## Ruby provider (optional)
  - WARNING: `ruby` and `gem` must be in $PATH.
    - ADVICE:
      - Install Ruby and verify that `ruby` and `gem` commands work.

## Node.js provider (optional)
  - INFO: Node.js: v17.0.1
  - INFO: Nvim node.js host: /home/philip/.local/lib/node_modules/neovim/bin/cli.js
  - OK: Latest "neovim" npm/yarn package is installed: 4.10.0

## Perl provider (optional)
  - ERROR: perl provider error:
    - ADVICE:
      - "Neovim::Ext" cpan module is not installed

sniprun: health#sniprun#check
========================================================================
## Installation
  - OK: `tree-sitter` found  0.20.0 , sniprun will try to make good use of that
  - OK: Rust toolchain found
  - OK: sniprun binary found
  - OK: sniprun binary runs correctly

targets: health#targets#check
========================================================================
  - WARNING: Conflicting mapping found:
    a| → :<C-U>normal! F|vf|<CR>
    | → {'separator': [{'d': '|'}]}
  - WARNING: Conflicting mapping found:
    i| → :<C-U>normal! T|vt|<CR>
    | → {'separator': [{'d': '|'}]}

telescope: require("telescope.health").check()
========================================================================
## Checking for required plugins
  - OK: plenary installed.
  - OK: nvim-treesitter installed.

## Checking external dependencies
  - OK: rg: found ripgrep 13.0.0
  - OK: fd: found fd 8.2.1

## ===== Installed extensions =====

vim.lsp: require("vim.lsp.health").check()
========================================================================
  - INFO: LSP log level : WARN
  - INFO: Log path: /home/philip/.cache/nvim/lsp.log
  - INFO: Log size: 1046 KB

vim.treesitter: require("vim.treesitter.health").check()
========================================================================
  - INFO: Runtime ABI version : 13
  - OK: Loaded parser for bash: ABI version 13
  - OK: Loaded parser for python: ABI version 13
...

Provide a minimal init.vim/vimrc with less than 50 lines (Required!)

" Your minimal init.vim/vimrc
call ddc#custom#patch_global('sources', ['nvim-lsp'])
call ddc#custom#patch_global('sourceOptions', {
      \ '_': { 'matchers': ['matcher_head'] },
      \ 'nvim-lsp': {
      \   'mark': 'lsp',
      \   'forceCompletionPattern': '\.\w*|:\w*|->\w*' },
      \ })
call ddc#custom#patch_global('sourceParams', {
      \ 'nvim-lsp': { 'kindLabels': { 'Class': 'c' } },
      \ })
call ddc#enable()

lua << EOF
vim.lsp.handlers["textDocument/publishDiagnostics"] =
    vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, {
        virtual_text = false,
        underline = true,
        signs = true,
        update_in_insert = true
    })

local nvim_lsp = require('lspconfig')
nvim_lsp["pyright"].setup{}
EOF

How to reproduce the problem from neovim/Vim startup (Required!)

  1. Open a python file.
  2. Start typing (ex.: def)

Screenshot (if possible)

Screen Shot 2021-11-12 at 12 01 32

The error is [denops] at async Session.handleNotification (https://deno.land/x/[email protected]/session.ts:130:7)

[Question] What is the `$ 0` entered when completing CSS?

Problems summary

What is the $0 entered when completing CSS?

Expected

Please tell me how to erase $0.

Environment Information

  • ddc.vim version (SHA1): 9c43cf1f89136a2b6592e694a693c9676a3ffaa7

  • ddc-nvim-lsp version (SHA1): 75b5382

  • denops.vim version (SHA1): f575cd5c56787b764e064da845b72ceea184ea97

  • deno version(deno -V output): 1.15.1

  • OS: Mac

  • neovim/Vim :version output: 0.5.1

  • :checkhealth or :CheckHealth result(neovim only): OK

Provide a minimal init.vim/vimrc with less than 50 lines (Required!)

if &compatible
    set nocompatible
endif
let $CACHE = expand('~/.cache')
if !isdirectory(expand($CACHE))
    call mkdir(expand($CACHE), 'p')
endif
let s:dein_dir = expand('$CACHE/dein')
let s:dein_repo_dir = s:dein_dir . '/repos/github.com/Shougo/dein.vim'
if &runtimepath !~# '/dein.vim'
    if !isdirectory(s:dein_repo_dir)
        execute '!git clone https://github.com/Shougo/dein.vim' s:dein_repo_dir
    endif
    execute 'set runtimepath^=' . s:dein_repo_dir
endif
call dein#begin(s:dein_dir, expand('<sfile>'))
call dein#add('neovim/nvim-lspconfig')
call dein#add('vim-denops/denops.vim')
call dein#add('Shougo/ddc.vim')
call dein#add('Shougo/ddc-matcher_head')
call dein#add('Shougo/ddc-sorter_rank')
call dein#add('Shougo/ddc-nvim-lsp')
call dein#end()
call dein#save_state()
if has('vim_starting') && dein#check_install()
    call dein#install()
endif
inoremap jj <ESC>
lua << EOF
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities.textDocument.completion.completionItem.snippetSupport = true
require"lspconfig".cssls.setup {
  capabilities = capabilities,
}
EOF
call ddc#custom#patch_global('sources', ['nvim-lsp'])
call ddc#custom#patch_global('sourceOptions', {
      \ '_': {
      \   'minAutoCompleteLength': 1,
      \   'matchers': ['matcher_head'],
      \   'sorters': ['sorter_rank']},
      \ 'nvim-lsp': {
      \   'forceCompletionPattern': '\:\w*' },
      \ })
call ddc#enable()

How to reproduce the problem from neovim/Vim startup (Required!)

  1. Enter html: in the CSS file.
  2. Enter {}.
  3. Enter in parentheses and select completion candidates.

Screenshot (if possible)

スクリーンショット 2021-10-15 2 19 41

Not working on Typescript file.

I tried to use this plugin with dein.vim refered your vim config files.

https://github.com/Shougo/shougo-s-github/blob/master/vim/rc/ddc.toml#L116

But not working this plugin on Typescript project(It worked lsp suggestion when I opened other vim config). Other plugins worked fine.

I checked LspInfo and it's fine.

Following code is ddc.toml file.
denops.vim, context_filetype.vim, nvim-lspinstall and impatient.nvim are imported other toml file like your vim config.

[[plugins]]
repo = 'Shougo/ddc.vim'
depends = ['context_filetype.vim', 'denops.vim', 'pum.vim']
on_event = 'InsertEnter'
hook_source = '''
  call ddc#custom#patch_global(
      \ 'sources', ['eskk', 'nvim-lsp', 'file', 'around'],
      \ )

  call ddc#custom#patch_global('sourceOptions', {
      \ '_': {
      \   'ignoreCase': v:true,
      \   'matchers': ['matcher_head'],
      \   'sorters': ['sorter_rank'],
      \   'converters': ['converter_remove_overlap'],
      \ },
      \ 'around': {
      \   'mark': 'A',
      \   'matchers': ['matcher_head', 'matcher_length'],
      \ },
      \ 'nvim-lsp': {
      \   'mark': 'lsp',
      \   'forceCompletionPattern': '\.\w*|:\w*|->\w*'
      \ },
      \ 'file': {
      \   'mark': 'F',
      \   'isVolatile': v:true,
      \   'minAutoCompleteLength': 1000,
      \   'forceCompletionPattern': '\S/\S*',
      \ },
      \ 'cmdline-history': {'mark': 'history'},
      \ 'eskk': {'mark': 'eskk', 'matchers': [], 'sorters': []},
      \ })

  call ddc#custom#patch_global('autoCompleteEvents', [
      \ 'InsertEnter', 'TextChangedI', 'TextChangedP',
      \ 'CmdlineEnter', 'CmdlineChanged',
      \ ])

  call ddc#custom#patch_global('completionMenu', 'pum.vim')

  inoremap <silent><expr> <TAB>
        \ pum#visible() ? '<Cmd>call pum#map#insert_relative(+1)<CR>' :
        \ (col('.') <= 1 <Bar><Bar> getline('.')[col('.') - 2] =~# '\s') ?
        \ '<TAB>' : ddc#manual_complete()
  inoremap <S-Tab> <Cmd>call pum#map#insert_relative(-1)<CR>
  inoremap <C-n>   <Cmd>call pum#map#select_relative(+1)<CR>
  inoremap <C-p>   <Cmd>call pum#map#select_relative(-1)<CR>
  inoremap <C-k>   <Cmd>call pum#map#confirm()<CR>
  inoremap <C-e>   <Cmd>call pum#map#cancel()<CR>

  call ddc#enable()
'''

[[plugins]]
repo = 'Shougo/pum.vim'

[[plugins]]
repo = 'Shougo/ddc-around'
on_source = 'ddc.vim'

[[plugins]]
repo = 'Shougo/ddc-matcher_head'
on_source = 'ddc.vim'

[[plugins]]
repo = 'Shougo/ddc-matcher_length'
on_source = 'ddc.vim'

[[plugins]]
repo = 'Shougo/ddc-sorter_rank'
on_source = 'ddc.vim'

[[plugins]]
repo = 'Shougo/ddc-cmdline-history'
on_source = 'ddc.vim'

[[plugins]]
repo = 'Shougo/ddc-converter_remove_overlap'
on_source = 'ddc.vim'

[[plugins]]
repo = 'LumaKernel/ddc-file'
on_source = 'ddc.vim'

[[plugins]]
repo = 'Shougo/ddc-omni'

[[plugins]]
repo = 'Shougo/ddc-nvim-lsp'
on_source = 'nvim-lspconfig'

[[plugins]]
repo = 'neovim/nvim-lspconfig'
depends = ['impatient.nvim', 'nvim-lspinstall']
on_ft = [
  'javascript',
  'javascriptreact',
  'typescript',
  'typescriptreact',
  'dart'
]
if = 'has("nvim")'
depends = 'ddc.vim'
hook_add = '''
" Keymaps
nnoremap <silent><Leader>D :lua vim.lsp.buf.declaration()<CR>
nnoremap <silent><Leader>d :lua vim.lsp.buf.definition()<CR>
nnoremap <silent><Leader>t :lua vim.lsp.buf.type_definition()<CR>
nnoremap <silent><Leader>i :lua vim.lsp.buf.implementation()<CR>
nnoremap <silent><Leader>c :lua vim.lsp.buf.references()<CR>
nnoremap <silent><Leader>r :lua vim.lsp.buf.rename()<CR>
nnoremap <silent><Leader>a :lua vim.lsp.buf.code_action()<CR>

nnoremap <silent><C-h> :lua vim.lsp.buf.hover()<CR>
nnoremap <silent>K :lua vim.lsp.buf.signature_help()<CR>

nnoremap <silent>[d :lua vim.lsp.diagnostic.goto_prev()<CR>
nnoremap <silent>]d :lua vim.lsp.diagnostic.goto_next()<CR>
nnoremap <silent><Leader>ld :lua vim.lsp.diagnostic.show_line_diagnostics()<CR>
nnoremap <silent><Leader>lld :lua vim.lsp.diagnostic.set_loclist()<CR>

lua << EOF
  local langs = {
    "bash",
    "cmake",
    -- "css",
    "cpp",
    "dockerfile",
    "go",
    "graphql",
    -- "html",
    -- "json",
    "lua",
    "python",
    "ruby",
    "rust",
    "tailwindcss",
    "typescript",
    "vim",
    "yaml"
  }
  local installed_servers = require'lspinstall'.installed_servers()

  local function has_server(lang)
    for _, server in pairs(installed_servers) do
      if server == lang then
        return true
      end
    end

    return false
  end

  for _, lang in pairs(langs) do
    if has_server(lang) == false then
      require'lspinstall'.install_server(lang)
    end
  end

  local function setup_servers()
    require'lspinstall'.setup()
    for _, server in pairs(installed_servers) do
      require'lspconfig'[server].setup{}
    end
  end

  setup_servers()

  require'lspconfig'.dartls.setup{}
EOF
'''

[[plugins]]
repo = 'tyru/eskk.vim'
on_source = 'ddc.vim'
hook_add = '''
 imap <silent> jk <Plug>(eskk:toggle)
 cmap <silent> jk <Plug>(eskk:toggle)
  let g:eskk#directory = expand('~/.eskk')
  let g:eskk#dictionary = {
        \   'path': expand('~/.eskk-jisyo'),
        \   'sorted': 0,
        \   'encoding': 'utf-8',
        \}
  let g:eskk#large_dictionary = {
        \   'path': '~/.config/SKK-JISYO.L',
        \   'sorted': 1,
        \   'encoding': 'utf-8',
        \}
  let g:eskk#server = {
        \   'host': 'localhost',
        \   'port': 1178
        \}
  let g:eskk#kakutei_when_unique_candidate = v:true
  let g:enable_completion = v:false
  let g:eskk#keep_state = v:false
  let g:eskk#egg_like_newline = v:true
  let g:eskk#tab_select_completion = v:true
'''

lsp completions not appearing

I'm trying to migrate from deoplete to ddc but can't get lsp completions to work. As minimal example, create this file

struct Foo {
  int aaaa;
  double bbbb;
};

int main(int, char **) {
  Foo f;
  f.aaaa = 1;
  return 0;
}

If I start adding f.bb I get the around source completion but not lsp (a better example is to move Foo to a separate file and there are no completions). I can confirm that lsp is working by simply adding a syntax error to the file and seeing the lsp error messages appear.

Here is my init.vim

if &compatible
  set nocompatible               " Be iMproved
endif

set runtimepath+=~/.cache/dein/repos/github.com/Shougo/dein.vim

if dein#load_state('~/.cache/dein')
  call dein#begin('~/.cache/dein')

  " Let dein manage dein
  call dein#add('~/.cache/dein/repos/github.com/Shougo/dein.vim')

  " Add or remove your plugins here:
  call dein#add('Shougo/ddc.vim')
  call dein#add('Shougo/ddc-around')
  call dein#add('Shougo/ddc-matcher_head')
  call dein#add('Shougo/ddc-sorter_rank')
  call dein#add('neovim/nvim-lspconfig')
  call dein#add('vim-denops/denops.vim')

  " Required:
  call dein#end()
  call dein#save_state()
endif

" If you want to install not installed plugins on startup.
if dein#check_install()
  call dein#install()
endif
let g:dein#auto_recache=1

syntax on
syntax enable

call ddc#custom#patch_global('sources', ['around', 'nvim-lsp'])
call ddc#custom#patch_global('sourceOptions', {
      \ '_': {
        \   'matchers': ['matcher_head'],
        \   'sorters': ['sorter_rank']
        \},
      \ 'around': {'mark': 'A'},
      \ 'nvim-lsp': {
        \   'mark': 'lsp',
	\   'forceCompletionPattern': '\.\w*|:\w*|->\w*'
        \}
      \})
call ddc#custom#patch_global('sourceParams', {
      \ 'nvim-lsp': { 'kindLabels': { 'Class': 'c' } },
      \ })

call ddc#enable()

lua require 'init'

and the referenced init.lua

local nvim_lsp = require('lspconfig')

local on_attach = function(client, bufnr)
  local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end
  local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end

  buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc')

  local opts = { noremap=true, silent=true }

  buf_set_keymap('n', 'gc', '<Cmd>lua vim.lsp.buf.declaration()<CR>', opts)
  buf_set_keymap('n', 'gd', '<Cmd>lua vim.lsp.buf.definition()<CR>', opts)
end

nvim_lsp.clangd.setup{
  cmd={
    'clangd',
    '-cross-file-rename',
    '-j=2',
    '--header-insertion=never',
    '--background-index',
    '--pch-storage=disk'
  };
  on_attach = on_attach;
  flags = {debounce_text_changes=150};
}

[Question] CSS LSP input.

Problems summary

I don't know the proper setting for CSS forceCompletionPattern.
Completion candidates that start with a colon are not entered correctly.

Expected

Find out the proper settings for the CSS forceCompletionPattern.

Environment Information

  • ddc.vim version (SHA1): 9c43cf1f89136a2b6592e694a693c9676a3ffaa7

  • ddc-nvim-lsp version (SHA1): 75b5382

  • denops.vim version (SHA1): f575cd5c56787b764e064da845b72ceea184ea97

  • deno version(deno -V output): 1.15.1

  • OS: Mac

  • neovim/Vim :version output: 0.5.1

  • :checkhealth or :CheckHealth result(neovim only): OK

Provide a minimal init.vim/vimrc with less than 50 lines (Required!)

if &compatible
    set nocompatible
endif
let $CACHE = expand('~/.cache')
if !isdirectory(expand($CACHE))
    call mkdir(expand($CACHE), 'p')
endif
let s:dein_dir = expand('$CACHE/dein')
let s:dein_repo_dir = s:dein_dir . '/repos/github.com/Shougo/dein.vim'
if &runtimepath !~# '/dein.vim'
    if !isdirectory(s:dein_repo_dir)
        execute '!git clone https://github.com/Shougo/dein.vim' s:dein_repo_dir
    endif
    execute 'set runtimepath^=' . s:dein_repo_dir
endif
call dein#begin(s:dein_dir, expand('<sfile>'))
call dein#add('neovim/nvim-lspconfig')
call dein#add('vim-denops/denops.vim')
call dein#add('Shougo/ddc.vim')
call dein#add('Shougo/ddc-matcher_head')
call dein#add('Shougo/ddc-sorter_rank')
call dein#add('Shougo/ddc-nvim-lsp')
call dein#end()
call dein#save_state()
if has('vim_starting') && dein#check_install()
    call dein#install()
endif
inoremap jj <ESC>
lua << EOF
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities.textDocument.completion.completionItem.snippetSupport = true
require"lspconfig".cssls.setup {
  capabilities = capabilities,
}
EOF
call ddc#custom#patch_global('sources', ['nvim-lsp'])
call ddc#custom#patch_global('sourceOptions', {
      \ '_': {
      \   'minAutoCompleteLength': 1,
      \   'matchers': ['matcher_head'],
      \   'sorters': ['sorter_rank']},
      \ 'nvim-lsp': {
      \   'forceCompletionPattern': '\:\w*' },
      \ })
call ddc#enable()

How to reproduce the problem from neovim/Vim startup (Required!)

  1. Enter html: in the CSS file.

nvim-cmp setup

if &compatible
    set nocompatible
endif
let $CACHE = expand('~/.cache')
if !isdirectory(expand($CACHE))
    call mkdir(expand($CACHE), 'p')
endif
let s:dein_dir = expand('$CACHE/dein')
let s:dein_repo_dir = s:dein_dir . '/repos/github.com/Shougo/dein.vim'
if &runtimepath !~# '/dein.vim'
    if !isdirectory(s:dein_repo_dir)
        execute '!git clone https://github.com/Shougo/dein.vim' s:dein_repo_dir
    endif
    execute 'set runtimepath^=' . s:dein_repo_dir
endif
call dein#begin(s:dein_dir, expand('<sfile>'))
call dein#add('neovim/nvim-lspconfig')
call dein#add('hrsh7th/nvim-cmp')
call dein#add('hrsh7th/cmp-nvim-lsp')
call dein#end()
call dein#save_state()
if has('vim_starting') && dein#check_install()
    call dein#install()
endif
inoremap jj <ESC>
lua << EOF
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities.textDocument.completion.completionItem.snippetSupport = true
require"lspconfig".cssls.setup {
  capabilities = capabilities,
}
local cmp = require('cmp')
cmp.setup {
    mapping = {
        ['<C-p>'] = cmp.mapping.select_prev_item(),
        ['<C-n>'] = cmp.mapping.select_next_item(),
    },
    sources = {
        { name = 'nvim_lsp' }
    },
}
EOF

Screenshot (if possible)

ddc-nvim-lsp
スクリーンショット 2021-10-14 23 24 11

nvim-cmp
スクリーンショット 2021-10-14 23 41 15

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.