neoclide / coc.nvim

Nodejs extension host for vim & neovim, load extensions like VSCode and host language servers.
Other
24.2k stars 954 forks source link

Unexpected behavior of css snippets with neovim >= 0.7.0 #3808

Closed iamcco closed 2 years ago

iamcco commented 2 years ago

Result from CocInfo

CocInfo


## versions

vim version: NVIM v0.8.0-dev+3f2e9298b
node version: v14.18.2
coc.nvim version: 0.0.80-e8628993 2022-05-09 00:44:06 +0800
coc.nvim directory: /Users/aioiyuuko/.configrc/nvim/viml/plugins/coc.nvim
term: xterm-kitty
platform: darwin

## Log of coc.nvim

2022-05-09T18:23:50.303 INFO (pid:25692) [services] - registered service "languageserver.sh"
2022-05-09T18:23:50.305 INFO (pid:25692) [services] - registered service "languageserver.dockerfile"
2022-05-09T18:23:50.305 INFO (pid:25692) [services] - registered service "languageserver.golang"
2022-05-09T18:23:50.378 INFO (pid:25692) [services] - registered service "css"
2022-05-09T18:23:50.379 INFO (pid:25692) [services] - Css language server state change: stopped => starting
2022-05-09T18:23:50.430 INFO (pid:25692) [services] - registered service "diagnostic-languageserver"
2022-05-09T18:23:50.491 INFO (pid:25692) [coc-git] - Looking for git in: git
2022-05-09T18:23:50.504 INFO (pid:25692) [services] - registered service "highlight"
2022-05-09T18:23:50.531 WARN (pid:25692) [workspace] - workspace.createStatusBarItem is deprecated, please use window.createStatusBarItem instead. 
    at c.init (/Users/aioiyuuko/.config/coc/extensions/node_modules/coc-leetcode/out/index.js:1:12315)
    at new c (/Users/aioiyuuko/.config/coc/extensions/node_modules/coc-leetcode/out/index.js:1:12274)
2022-05-09T18:23:50.767 INFO (pid:25692) [services] - registered service "stylelintplus"
2022-05-09T18:23:50.767 INFO (pid:25692) [services] - stylelint language server state change: stopped => starting
2022-05-09T18:23:51.466 INFO (pid:25692) [plugin] - coc.nvim initialized with node: v14.18.2 after 1314ms
2022-05-09T18:23:51.476 WARN (pid:25692) [workspace] - workspace.createStatusBarItem is deprecated, please use window.createStatusBarItem instead. 
    at Object.t.initStatusBar (/Users/aioiyuuko/.config/coc/extensions/node_modules/coc-spell-checker/out/index.js:1:155873)
    at Object.t.activate (/Users/aioiyuuko/.config/coc/extensions/node_modules/coc-spell-checker/out/index.js:1:23099)
2022-05-09T18:23:51.740 INFO (pid:25692) [services] - Css language server state change: starting => running
2022-05-09T18:23:51.745 INFO (pid:25692) [services] - service css started
2022-05-09T18:23:51.874 INFO (pid:25692) [core-watchman] - watchman watching project: /Users/aioiyuuko/.configrc
2022-05-09T18:23:52.178 INFO (pid:25692) [services] - stylelint language server state change: starting => running
2022-05-09T18:23:52.179 INFO (pid:25692) [services] - service stylelintplus started
2022-05-09T18:23:53.576 INFO (pid:25692) [attach] - receive notification: doAutocmd [ 1 ]
2022-05-09T18:23:53.723 INFO (pid:25692) [attach] - receive notification: doAutocmd [ 1 ]
2022-05-09T18:23:53.724 INFO (pid:25692) [attach] - receive notification: doAutocmd [ 1 ]
2022-05-09T18:23:54.141 INFO (pid:25692) [attach] - receive notification: doAutocmd [ 1 ]
2022-05-09T18:23:54.349 INFO (pid:25692) [attach] - Request action: doKeymap [ 'iew==0' ]
2022-05-09T18:23:54.527 INFO (pid:25692) [attach] - receive notification: doAutocmd [ 1 ]
2022-05-09T18:23:54.529 WARN (pid:25692) [completion] - Suggest not triggered with input "", minimal trigger input length: 1
2022-05-09T18:23:54.542 INFO (pid:25692) [attach] - receive notification: doAutocmd [ 1 ]
2022-05-09T18:23:54.560 INFO (pid:25692) [attach] - receive notification: doAutocmd [ 1 ]
2022-05-09T18:23:54.560 INFO (pid:25692) [attach] - receive notification: doAutocmd [ 1 ]
2022-05-09T18:23:55.334 INFO (pid:25692) [attach] - receive notification: doAutocmd [ 1 ]
2022-05-09T18:23:55.336 INFO (pid:25692) [attach] - receive notification: doAutocmd [ 1 ]
2022-05-09T18:23:55.611 INFO (pid:25692) [attach] - receive notification: doAutocmd [ 1 ]
2022-05-09T18:23:56.650 INFO (pid:25692) [attach] - receive notification: doAutocmd [ 1 ]
2022-05-09T18:23:56.794 INFO (pid:25692) [attach] - receive notification: doAutocmd [ 1 ]
2022-05-09T18:23:58.403 INFO (pid:25692) [attach] - receive notification: doAutocmd [ 1 ]
2022-05-09T18:23:58.441 INFO (pid:25692) [attach] - receive notification: doAutocmd [ 1 ]
2022-05-09T18:23:58.447 INFO (pid:25692) [attach] - receive notification: doAutocmd [ 1 ]
2022-05-09T18:23:58.448 INFO (pid:25692) [snippets-session] - Jump to final placeholder, cancelling snippet session
2022-05-09T18:23:58.449 INFO (pid:25692) [attach] - receive notification: showSignatureHelp []
2022-05-09T18:23:58.512 INFO (pid:25692) [attach] - receive notification: startCompletion [
  {
    word: '',
    bufnr: 1,
    col: 13,
    disabled: [],
    filepath: '/Users/aioiyuuko/.configrc/t.css',
    indentkeys: '',
    blacklist: [],
    line: '\tbackground: ;',
    filetype: 'css',
    linenr: 2,
    input: '',
    colnr: 14,
    changedtick: 139
  }
]
2022-05-09T18:23:59.303 INFO (pid:25692) [attach] - receive notification: doAutocmd [ 1 ]
2022-05-09T18:23:59.305 WARN (pid:25692) [completion] - Suggest not triggered with input "", minimal trigger input length: 1
2022-05-09T18:23:59.859 INFO (pid:25692) [attach] - receive notification: doAutocmd [ 1 ]
2022-05-09T18:23:59.860 INFO (pid:25692) [attach] - receive notification: doAutocmd [ 1 ]
2022-05-09T18:24:04.418 INFO (pid:25692) [attach] - receive notification: showInfo []


Reproduce

only install coc.nvim and coc.nvim extensions

1 open css file nvim t.css 2 input below code $ is cursor position

body {
    $
}

3 type background and select from suggest and trigger snippets 4 type # then the code become

body {
#background: ;
}
iamcco commented 2 years ago

很奇怪,更新了 coc.nvim 和 neovim ,并且把所有 配置 (包括coc配置和插件)都删了,只启用 coc-css ,仍然复现

:CocInfo

## versions

vim version: NVIM v0.8.0-dev+3f2e9298b
node version: v14.18.2
coc.nvim version: 0.0.80-dc2f8ac4 2022-05-09 17:02:56 +0800
coc.nvim directory: /Users/aioiyuuko/.configrc/nvim/viml/plugins/coc.nvim
term: xterm-kitty
platform: darwin

## Log of coc.nvim

2022-05-09T20:45:01.264 INFO (pid:27935) [services] - registered service "css"
2022-05-09T20:45:01.267 INFO (pid:27935) [services] - Css language server state change: stopped => starting
2022-05-09T20:45:01.274 INFO (pid:27935) [plugin] - coc.nvim initialized with node: v14.18.2 after 169ms
2022-05-09T20:45:01.291 INFO (pid:27935) [core-watchman] - watchman watching project: /Users/aioiyuuko/.configrc
2022-05-09T20:45:01.391 INFO (pid:27935) [services] - Css language server state change: starting => running
2022-05-09T20:45:01.396 INFO (pid:27935) [services] - service css started
2022-05-09T20:45:04.242 WARN (pid:27935) [completion] - Suggest not triggered with input "", minimal trigger input length: 1
2022-05-09T20:45:04.450 WARN (pid:27935) [completion] - Suggest not triggered with input "", minimal trigger input length: 1
2022-05-09T20:45:06.109 WARN (pid:27935) [completion] - Suggest not triggered with input "", minimal trigger input length: 1
2022-05-09T20:45:11.132 INFO (pid:27935) [snippets-session] - Jump to final placeholder, cancelling snippet session
2022-05-09T20:45:11.133 INFO (pid:27935) [attach] - receive notification: showSignatureHelp []
2022-05-09T20:45:11.197 INFO (pid:27935) [attach] - receive notification: startCompletion [
  {
    word: '',
    bufnr: 1,
    col: 13,
    disabled: [],
    filepath: '/Users/aioiyuuko/.configrc/t.css',
    indentkeys: '',
    blacklist: [],
    line: '\tbackground: ;',
    filetype: 'css',
    linenr: 2,
    input: '',
    colnr: 14,
    changedtick: 105
  }
]
2022-05-09T20:45:11.832 WARN (pid:27935) [completion] - Suggest not triggered with input "", minimal trigger input length: 1
2022-05-09T20:45:18.360 INFO (pid:27935) [attach] - receive notification: highlight []
2022-05-09T20:45:27.152 INFO (pid:27935) [attach] - receive notification: showInfo []

chemzqm commented 2 years ago

Verbose output needed https://github.com/neoclide/coc.nvim/wiki/Debug-language-server#using-output-channel

fannheyward commented 2 years ago

Can't reproduce too.

iamcco commented 2 years ago

css.log

LSP log 我看了挺正常的,我还发现 不仅仅是 css,所有 snippets 的地方,比如 ts console. 选择 log 然后输入 # 也是一样。

chemzqm commented 2 years ago

Try minimal vimrc.

iamcco commented 2 years ago

minimal vimrc

t.vim in coc.nvim folder

let &runtimepath = &runtimepath . ',' . expand('<sfile>:h')

nvim -u t.vim t.css still happend

fannheyward commented 2 years ago

Reproduced, both css and ts.

  1. console., choose any snippet from LS
  2. confirm log snippet, got console.log(|), | is the cursor
  3. input #
  4. got #|console.log(), and the indent is broken too.
iamcco commented 2 years ago

OK, downgrade neovim to v0.6.1 then the issue gone. Seems like this issue only happen with latest neovim version.

chemzqm commented 2 years ago

Should be neovim's bug, happens on neovim >= 0.7.0

chemzqm commented 2 years ago

I've removed the fix which not fix this issue on all cases, see https://github.com/neovim/neovim/issues/18565