Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

:call CocAction('colorPresentation') will cause stuck in vim #65

Open
sainnhe opened this issue Feb 2, 2024 · 5 comments
Open

:call CocAction('colorPresentation') will cause stuck in vim #65

sainnhe opened this issue Feb 2, 2024 · 5 comments

Comments

@sainnhe
Copy link

sainnhe commented Feb 2, 2024

Version info

OS: Darwin wenzhen.local 23.3.0 Darwin Kernel Version 23.3.0: Wed Dec 20 21:30:44 PST 2023; root:xnu-10002.81.5~7/RELEASE_ARM64_T6000 arm64

Node:

$ node --version
v21.6.1

Vim:

$ vim --version
VIM - Vi IMproved 9.1 (2024 Jan 02, compiled Jan 23 2024 22:19:02)
macOS version - arm64
Included patches: 1-50
Compiled by Homebrew
Huge version without GUI.  Features included (+) or not (-):
+acl               +file_in_path      +mouse_urxvt       -tag_any_white
+arabic            +find_in_path      +mouse_xterm       -tcl
+autocmd           +float             +multi_byte        +termguicolors
+autochdir         +folding           +multi_lang        +terminal
-autoservername    -footer            -mzscheme          +terminfo
-balloon_eval      +fork()            +netbeans_intg     +termresponse
+balloon_eval_term +gettext           +num64             +textobjects
-browse            -hangul_input      +packages          +textprop
++builtin_terms    +iconv             +path_extra        +timers
+byte_offset       +insert_expand     +perl              +title
+channel           +ipv6              +persistent_undo   -toolbar
+cindent           +job               +popupwin          +user_commands
-clientserver      +jumplist          +postscript        +vartabs
+clipboard         +keymap            +printer           +vertsplit
+cmdline_compl     +lambda            +profile           +vim9script
+cmdline_hist      +langmap           -python            +viminfo
+cmdline_info      +libcall           +python3           +virtualedit
+comments          +linebreak         +quickfix          +visual
+conceal           +lispindent        +reltime           +visualextra
+cryptv            +listcmds          +rightleft         +vreplace
+cscope            +localmap          +ruby              +wildignore
+cursorbind        +lua               +scrollbind        +wildmenu
+cursorshape       +menu              +signs             +windows
+dialog_con        +mksession         +smartindent       +writebackup
+diff              +modify_fname      +sodium            -X11
+digraphs          +mouse             +sound             -xattr
-dnd               -mouseshape        +spell             -xfontset
-ebcdic            +mouse_dec         +startuptime       -xim
+emacs_tags        -mouse_gpm         +statusline        -xpm
+eval              -mouse_jsbterm     -sun_workshop      -xsmp
+ex_extra          +mouse_netterm     +syntax            -xterm_clipboard
+extra_search      +mouse_sgr         +tag_binary        -xterm_save
-farsi             -mouse_sysmouse    -tag_old_static    
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
       defaults file: "$VIMRUNTIME/defaults.vim"
  fall-back for $VIM: "/opt/homebrew/share/vim"
Compilation: clang -c -I. -Iproto -DHAVE_CONFIG_H -DMACOS_X -DMACOS_X_DARWIN -g -O2 -D_REENTRANT -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 
Linking: clang -o vim -lm -lncurses -lsodium -liconv -lintl -framework AppKit -L/opt/homebrew/opt/lua/lib -llua5.4 -mmacosx-version-min=14.2 -fstack-protector-strong -L/opt/homebrew/opt/perl/lib/perl5/5.38/darwin-thread-multi-2level/CORE -lperl -L/opt/homebrew/opt/[email protected]/Frameworks/Python.framework/Versions/3.12/lib/python3.12/config-3.12-darwin -lpython3.12 -framework CoreFoundation -lruby.3.3 -L/opt/homebrew/Cellar/ruby/3.3.0/lib 

CocInfo

## versions

vim version: VIM - Vi IMproved 9.1 9010050
node version: v21.6.1
coc.nvim version: 0.0.82-d1568d56 2023-09-29 19:43:34 +0800
coc.nvim directory: /Users/sainnhe/.local/share/nvimplugins/coc.nvim
term: tmux
platform: darwin

## Log of coc.nvim

2024-02-02T13:58:05.610 INFO (pid:17182) [extension:coc-git] - Looking for git in: git
2024-02-02T13:58:05.673 WARN (pid:17182) [workspace] - Extension "coc-lists" registered synchronized autocmd "VimLeavePre", which could be slow.
2024-02-02T13:58:05.747 WARN (pid:17182) [workspace] - Extension "coc-project" registered synchronized autocmd "VimLeavePre", which could be slow.
2024-02-02T13:58:05.810 INFO (pid:17182) [plugin] - coc.nvim initialized with node: v21.6.1 after 353
2024-02-02T13:58:05.812 WARN (pid:17182) [workspace] - Extension "coc-imselect" registered synchronized autocmd "VimLeavePre", which could be slow.
2024-02-02T13:58:05.823 INFO (pid:17182) [language-client-index] - Language server "css" started with 17215
2024-02-02T13:58:06.020 INFO (pid:17182) [attach] - receive notification: runCommand [ 'git.refresh' ]
2024-02-02T13:58:06.022 INFO (pid:17182) [attach] - receive notification: doAutocmd [ 12 ]
2024-02-02T13:58:07.994 INFO (pid:17182) [attach] - receive notification: showInfo []
2024-02-02T13:58:07.996 INFO (pid:17182) [attach] - receive notification: doAutocmd [ 1 ]

Steps to reproduce

  1. Install coc-highlight and coc-css
  2. Use vim to open a file named test.css
  3. Append the following content
a {
    color: #f78681;
}
  1. Move cursor over #f78681 and execute :call CocAction('colorPresentation')
  2. The vim process get stucked.

Additional information

This bug doesn't exist in neovim.

@sainnhe sainnhe changed the title editor.action.colorPresentation command will cause stuck in vim :call CocAction('colorPresentation') will cause stuck in vim Feb 2, 2024
@fannheyward
Copy link
Member

image

Tested with coc-highlight and coc-css, can't reproduce.

@sainnhe
Copy link
Author

sainnhe commented Feb 2, 2024

Can you reproduce this using the following config?

call plug#begin(expand('~/.local/share/nvim/plugins'))
Plug 'neoclide/coc.nvim', { 'branch': 'release' }
call plug#end()
let g:coc_data_home = expand('~/.local/share/nvim/coc')
" May need for Vim (not Neovim) since coc.nvim calculates byte offset by count
" utf-8 byte sequence
set encoding=utf-8
" Some servers have issues with backup files, see #649
set nobackup
set nowritebackup

" Having longer updatetime (default is 4000 ms = 4s) leads to noticeable
" delays and poor user experience
set updatetime=300

" Always show the signcolumn, otherwise it would shift the text each time
" diagnostics appear/become resolved
set signcolumn=yes
set nocompatible
{
    "colors.enable": true,
    "highlight.colors.enable": true,
    "highlight.colorNames.enable": false,
    "highlight.document.enable": true
}

I was able reproduce this bug using the above config, and I only installed coc-css and coc-highlight.

@fannheyward
Copy link
Member

fannheyward commented Feb 2, 2024

:CocCommand editor.action.colorPresentation works, the menu is listed and narrow to select, but :call CocAction('colorPresentation') made vim frozen.

Update: :call CocActionAsync('colorPresentation').

@sainnhe
Copy link
Author

sainnhe commented Feb 2, 2024

Yes, I can confirm that CocActionAsync won't make vim stuck, but CocAction will.

Is this the expected behavior? If so, maybe it's necessary to update the coc help doc since there are many parts mentioned CocAction('colorPresentation') in the help doc.

@fannheyward
Copy link
Member

update the coc help doc

PR is welcome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants