ms-jpq / coq_nvim

Fast as FUCK nvim completion. SQLite, concurrent scheduler, hundreds of hours of optimization.
GNU General Public License v3.0
3.54k stars 101 forks source link

Completion is not triggered when typing a dot #464

Open lucypero opened 2 years ago

lucypero commented 2 years ago

For example, in Javascript:

console.

When you press the dot, nothing shows up. I have to, for example, manually trigger autocompletion by pressing C-Space.

I don't know why the pum disappears when I type the dot.

lucypero commented 2 years ago

https://user-images.githubusercontent.com/11927498/157252127-cff41b9d-54f6-4a9f-82f2-59a3e9ab663a.mp4

kaiuri commented 2 years ago

<deleted by the author, motive: incorrect>

lucypero commented 2 years ago

@urikaoli

no it's not an LSP issue. The same thing happens on rust-analyzer. It's some configuration thing. I'll look into it later.

kaiuri commented 2 years ago

@lucypero

My mistake, actually, setting coq_settings.match.unifying_chars to include "." might solve it

lucypero commented 2 years ago

@urikaoli no, that made it even worse haha.

You said it works for you. can you share your config?

kaiuri commented 2 years ago

@lucypero sure

lspconfig.tsserver.setup { on_attach = on_attach }
g.coq_settings = {
  auto_start = 'shut-up',
  clients = { tree_sitter = { enabled = false }, paths = { preview_lines = 3 } },
  display = { icons = { mode = 'short' } },
  keymap = { recommended = true },
}

But that won't be of any help I assume. Vim's completion "engine" is quite weird, gets even weird when trying to juggle lua, vimscript and an auto-completion framework.

You could try rewriting your insert mode keymaps to use the vim.keymap API... I don't know, tried reading your init.vim but my configuration's been full lua for so long that vimscript seems alien to me.

lukebakken commented 2 years ago

FWIW, I'm seeing the same issue. NVIM v0.7.0 on Win32, coq at version b23cd450. I tried the suggestion in this comment but that kept C-Space from working at all.

init.vim.txt

Please let me know how I can assist troubleshooting this further.

brenoprata10 commented 2 years ago

I am also having the same issue

Balandino commented 2 years ago

Though it doesn't fix the core issue, below is a partial workaround which may prove useful. The below mapping inserts a . and manually triggers Lsp completions when a . is typed in insert mode:

vim.api.nvim_set_keymap('i', '.', '<cmd>lua vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes(".<C-x><C-u><C-e>", true, false, true), "n", true)<CR>', { noremap = true })

ms-jpq commented 2 years ago

does this issue still happen on the latest?

there has been lots of change changes, so im not sure if the original issue still persists

ppebb commented 2 years ago

Still happens for me on latest.

PhantomCloak commented 2 years ago

on macos It happens for me too with nightly + native lsp + omnisharp

Christopher2K commented 2 years ago

Hey! Clean install here, it's still happening!

dinkopehar commented 1 year ago

Happens for me also when using python.

For example, typing import date| only shows some snippets, but if I press <C-Space>, I get suggestions as import datetime etc.

TomzBench commented 1 year ago

my behavior is similar. the dot will not trigger completion unless i do dot + space. Then completions will come. Also trying to manually trigger the completion will not redraw the completion pop up. Even when completions are there (via dot + space), c-space should usually flash the popup menu. This does not happen. I am using latest as of today, it only affects my windows computer.

SamCB commented 9 months ago

I've got the same issue here. It's somewhat transient, sometimes the suggestion comes up straight away, but most of the time it doesn't. Can confirm it's happening in at least both Lua and Javascript/Typescript. It doesn't seem to be related just to . either, but naturally . is the case where you'd hope to get suggestions. If I backspace and enter the . again, it almost always is able to show the suggestions I'd expect.

For demonstration purposes, I have the following code:

const EXAMPLE = { foo: true, bar: false };

// < cursor here

And then I type:

  1. :messages clear to clear up the debug logs
  2. i to enter insert
  3. E the suggestion pops up,
  4. <tab> to select, then
  5. . and it auto completes EXAMPLE.. From here I expect the suggestions foo and bar to appear.
Debug messages from a case where it shows the suggestions as expected: ``` TIME -- CANCEL -- ALL :: 3us @ 476us TIME -- CANCEL WORKER -- TMUX :: 4ms @ 3ms TIME -- CANCEL WORKER -- SNIP :: 5ms @ 3ms TIME -- CANCEL WORKER -- LSP :: 5ms @ 3ms TIME -- CANCEL WORKER -- PATH :: 4ms @ 3ms TIME -- CANCEL WORKER -- TS :: 4ms @ 3ms TIME -- CANCEL WORKER -- REG :: 4ms @ 3ms TIME -- CANCEL WORKER -- TAG :: 4ms @ 3ms TIME -- CANCEL WORKER -- 3P :: 4ms @ 3ms TIME -- CANCEL WORKER -- BUF :: 4ms @ 3ms TIME -- CACHE -- GET :: 3ms @ 2ms TIME -- LSP :: lsp_comp :: 10ms @ 10ms TIME -- WORKER -- TMUX :: 30ms @ 20ms TIME -- CACHE -- GET :: 3ms @ 2ms TIME -- WORKER -- TS :: 31ms @ 21ms TIME -- WORKER -- PATH :: 32ms @ 21ms TIME -- LSP :: lsp_third_party :: 6ms @ 5ms TIME -- WORKER -- REG :: 33ms @ 23ms TIME -- LSP CACHE :: 12ms @ 12ms TIME -- WORKER -- LSP :: 34ms @ 28ms TIME -- WORKER -- TAG :: 34ms @ 24ms TIME -- WORKER -- BUF :: 34ms @ 24ms TIME -- WORKER -- SNIP :: 36ms @ 24ms TIME -- WORKER -- 3P :: 35ms @ 25ms TIME -- COLLECTED -- ALL :: 46ms @ 38ms TOTAL >>> 58ms TIME -- POLL :: 56ms @ 37ms TIME -- PREVIEW :: 23us @ 403us TIME -- LSP CACHE :: 11ms @ 12ms TIME -- PREVIEW :: 11ms @ 471us (Metric(instance=UUID('ace6724b-7c3a-47b2-bc98-851987d58911'), comp=Completion(source='BUF', always_on_top=False, weight_adjust=0, label='EXAMPLE', sort_by='EXAMPLE', primary_edit=Edit(new_text='EXAMPLE'), adjust_indent=False, icon_match='Text', uid=UUID('cf0ee122-587a -4d8a-b564-1a7cb3537c9f'), secondary_edits=(), preselect=False, kind='\ue612', doc=Doc(text='typescript ⇊\n.:125', syntax=''), extern=None), weight_adjust=1.0, weight=Weights(prefix_matches=1, edit_distance=1.0, recency=7, proximity=1), label_width=7, kind_width=1), [EditInstruction(primary=True, begin=(126, 0), end=(126, 1), cursor_yoffset=0, cursor_xpos=7, new_lines=['EXAMPLE'])]) TIME -- CANCEL -- ALL :: 1000ns @ 474us TIME -- CANCEL WORKER -- TMUX :: 3ms @ 3ms TIME -- CANCEL WORKER -- SNIP :: 3ms @ 3ms TIME -- CANCEL WORKER -- LSP :: 3ms @ 3ms TIME -- CANCEL WORKER -- PATH :: 3ms @ 3ms TIME -- CANCEL WORKER -- TS :: 3ms @ 3ms TIME -- CANCEL WORKER -- REG :: 3ms @ 3ms TIME -- CANCEL WORKER -- TAG :: 3ms @ 3ms TIME -- CANCEL WORKER -- 3P :: 3ms @ 3ms TIME -- CANCEL WORKER -- BUF :: 2ms @ 3ms TIME -- CACHE -- GET :: 2ms @ 2ms TIME -- WORKER -- TMUX :: 14ms @ 20ms TIME -- CACHE -- GET :: 2ms @ 2ms TIME -- WORKER -- PATH :: 16ms @ 21ms TIME -- LSP :: lsp_comp :: 11ms @ 10ms TIME -- LSP :: lsp_third_party :: 5ms @ 5ms TIME -- WORKER -- TS :: 17ms @ 21ms TIME -- WORKER -- REG :: 18ms @ 23ms TIME -- WORKER -- TAG :: 19ms @ 24ms TIME -- WORKER -- BUF :: 19ms @ 24ms TIME -- WORKER -- LSP :: 20ms @ 28ms TIME -- WORKER -- 3P :: 20ms @ 25ms TIME -- LSP CACHE :: 12ms @ 12ms TIME -- LSP CACHE :: 11ms @ 12ms TIME -- WORKER -- SNIP :: 33ms @ 24ms TIME -- COLLECTED -- ALL :: 39ms @ 38ms TOTAL >>> 44ms TIME -- POLL :: 43ms @ 37ms TIME -- PREVIEW :: 28us @ 468us ```
And another case a bit later where it doesn't show any autocomplete: ``` TIME -- CANCEL -- ALL :: 3us @ 450us TIME -- CANCEL WORKER -- TMUX :: 4ms @ 3ms TIME -- CANCEL WORKER -- SNIP :: 4ms @ 3ms TIME -- CANCEL WORKER -- LSP :: 4ms @ 3ms TIME -- CANCEL WORKER -- PATH :: 3ms @ 3ms TIME -- CANCEL WORKER -- TS :: 3ms @ 3ms TIME -- CANCEL WORKER -- REG :: 3ms @ 3ms TIME -- CANCEL WORKER -- TAG :: 3ms @ 3ms TIME -- CANCEL WORKER -- 3P :: 3ms @ 3ms TIME -- CANCEL WORKER -- BUF :: 3ms @ 3ms TIME -- CACHE -- GET :: 4ms @ 2ms TIME -- CACHE -- GET :: 6ms @ 2ms TIME -- WORKER -- TMUX :: 38ms @ 20ms TIME -- WORKER -- TS :: 39ms @ 21ms TIME -- LSP :: lsp_third_party :: 9ms @ 5ms TIME -- WORKER -- PATH :: 41ms @ 22ms TIME -- WORKER -- REG :: 42ms @ 23ms TIME -- WORKER -- TAG :: 43ms @ 24ms TIME -- WORKER -- BUF :: 45ms @ 24ms TIME -- WORKER -- SNIP :: 49ms @ 25ms TIME -- WORKER -- 3P :: 49ms @ 25ms TIME -- LSP CACHE :: 11ms @ 12ms TIME -- WORKER -- LSP :: 57ms @ 28ms TIME -- COLLECTED -- ALL :: 68ms @ 39ms TOTAL >>> 81ms TIME -- POLL :: 79ms @ 36ms TIME -- PREVIEW :: 25us @ 609us TIME -- LSP CACHE :: 19ms @ 12ms TIME -- PREVIEW :: 5ms @ 632us (Metric(instance=UUID('8869e1de-911d-4c48-8fc0-ee773c8a487f'), comp=Completion(source='LSP', always_on_top=False, weight_adjust=0.5, label='EXAMPLE', sort_by='EXAMPLE', primary_edit=Edit(new_text='EXAMPLE'), adjust_indent=False, icon_match='Variable', uid=UUID('1a758ed b-5355-499a-ada0-92763bb3415e'), secondary_edits=(), preselect=False, kind='\U000f0ae7 Variable', doc=None, extern=ExternLSP(client='tsserver', item={'data': {'cacheId': 1}, 'kind': 6, 'sortText': '11', 'label': 'EXAMPLE', 'insertTextFormat': None, 'insertTextMode': No ne}, command=None)), weight_adjust=1.1666666666666667, weight=Weights(prefix_matches=1, edit_distance=1.0, recency=7, proximity=1), label_width=7, kind_width=10), [EditInstruction(primary=True, begin=(126, 0), end=(126, 1), cursor_yoffset=0, cursor_xpos=7, new_lines=['EXAMPLE'])]) TIME -- CANCEL -- ALL :: 1000ns @ 447us TIME -- CANCEL WORKER -- TMUX :: 9ms @ 3ms TIME -- CANCEL WORKER -- SNIP :: 10ms @ 3ms TIME -- CANCEL WORKER -- LSP :: 10ms @ 3ms TIME -- CANCEL WORKER -- PATH :: 10ms @ 3ms TIME -- CANCEL WORKER -- TS :: 10ms @ 3ms TIME -- CANCEL WORKER -- REG :: 10ms @ 3ms TIME -- CANCEL WORKER -- TAG :: 10ms @ 3ms TIME -- CANCEL WORKER -- 3P :: 10ms @ 3ms TIME -- CANCEL WORKER -- BUF :: 2ms @ 3ms TIME -- CACHE -- GET :: 1ms @ 2ms TIME -- WORKER -- TMUX :: 22ms @ 20ms TIME -- CACHE -- GET :: 4ms @ 2ms TIME -- WORKER -- PATH :: 24ms @ 22ms TIME -- LSP :: lsp_comp :: 19ms @ 10ms TIME -- WORKER -- SNIP :: 25ms @ 25ms TIME -- LSP :: lsp_third_party :: 7ms @ 5ms TIME -- WORKER -- TS :: 27ms @ 21ms TIME -- WORKER -- REG :: 27ms @ 23ms TIME -- WORKER -- TAG :: 28ms @ 24ms TIME -- WORKER -- BUF :: 29ms @ 24ms TIME -- WORKER -- LSP :: 31ms @ 28ms TIME -- WORKER -- 3P :: 32ms @ 25ms TIME -- COLLECTED -- ALL :: 46ms @ 39ms TOTAL >>> 55ms TIME -- POLL :: 55ms @ 36ms TIME -- LSP CACHE :: 15ms @ 12ms TIME -- LSP CACHE :: 13ms @ 12ms ```

My relevant config I'm using Lazy to manage my plugins, this is the relevant part of the config: ```lua { 'ms-jpq/coq_nvim', branch = 'coq', event = "InsertEnter", dependencies = { { "ms-jpq/coq.artifacts", branch = "artifacts" }, "neovim/nvim-lspconfig", }, init = function () vim.g.coq_settings = { auto_start = "shut-up", keymap = { recommended = false } } vim.cmd('ino pumvisible() ? (complete_info().selected == -1 ? "\\" : "\\") : "\\"') vim.cmd('ino pumvisible() ? "\\" : "\\"') vim.cmd('ino pumvisible() ? "\\" : "\\"') vim.cmd('ino pumvisible() ? (complete_info().selected == -1 ? "\\" : "\\") : "\\"') vim.cmd('ino pumvisible() ? "\\" : "\\"') vim.cmd('ino pumvisible() ? "\\" : "\\"') end, config = function () require('coq') end }, ``` The full list of plugins I have are: ``` Total: 18 plugins Loaded (17) ● coq.artifacts 1.2ms  coq_nvim ● coq_nvim 11.65ms  InsertEnter ● gitsigns.nvim 0.06ms  start ● lazy.nvim 9.49ms  init.lua ● lualine.nvim 15.96ms  start ● mason-lspconfig.nvim 0.21ms  mason.nvim ● mason.nvim 44.38ms  start ● neo-tree.nvim 32.25ms  start ● nui.nvim 0.18ms  neo-tree.nvim ● nvim-lspconfig 0.81ms  mason.nvim ● nvim-neoclip.lua 20.08ms  start ● nvim-web-devicons 0.76ms  lualine.nvim ● plenary.nvim 1.23ms  neo-tree.nvim ● project.nvim 0.18ms  telescope.nvim ● sqlite.lua 0.05ms  nvim-neoclip.lua ● telescope.nvim 19.98ms  nvim-neoclip.lua ● vim-solarized8 4.17ms  start Not Loaded (1) ○ trouble.nvim ```