Shougo / ddc-source-lsp

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

Using built-in terminal breaks lsp server #37

Closed Ashymad closed 1 year ago

Ashymad commented 1 year ago

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)
Shougo commented 1 year ago

Fixed. Please update ddc.vim.

Ashymad commented 1 year ago

Thanks :+1: