ycm-core / YouCompleteMe

A code-completion engine for Vim
http://ycm-core.github.io/YouCompleteMe/
GNU General Public License v3.0
25.41k stars 2.8k forks source link

Visual select highlight does not work on MissingFieldOrMethod error #4116

Closed deividaspetraitis closed 1 year ago

deividaspetraitis commented 1 year ago

Issue Prelude

Please complete these steps and check these boxes (by putting an x inside the brackets) before filing your issue:

Thank you for adhering to this process! It ensures your issue is resolved quickly and that neither your nor our time is needlessly wasted.

Issue Details

Provide a clear description of the problem, including the following key questions:

I am trying to highlight text in visual/visual block mode. It seems that text is not being highlighted on various YCM errors. After reading :h youcompleteme-diagnostic-highlighting-groups I was trying to change various highlighting groups however it seems they do not any effect for this behaviour.

Include steps to reproduce here.

  1. I am using Go programming language
  2. Change any statement to invalid that would cause MissingFieldOrMethod or any other error
  3. Try to select text in visual mode

Include description of a minimal test case, including any actual code required to reproduce the issue.

You can create minimal Go program:

package main

import (
    "fmt"
)

func main() {
    fmt.Prints("Hello World") // Prints will be not highlighted
}

If you made changes to vimrc_ycm_minimal, pase them here:

No changes were made to vimrc_ycm_minimal.

I would expect to be able to see visual selection on MissingFieldOrMethod or any other error.

Selected text is not being highlighted. Attaching gif with behaviour reproduced with vim -Nu /path/to/YCM/vimrc_ycm_minimal:

highlight

Diagnostic data

Output of vim --version

❯ vim --version
VIM - Vi IMproved 9.0 (2022 Jun 28, compiled Jan 05 2023 19:59:18)
macOS version - arm64
Included patches: 1-1151
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             -xfontset
-dnd               -mouseshape        +spell             -xim
-ebcdic            +mouse_dec         +startuptime       -xpm
+emacs_tags        -mouse_gpm         +statusline        -xsmp
+eval              -mouse_jsbterm     -sun_workshop      -xterm_clipboard
+ex_extra          +mouse_netterm     +syntax            -xterm_save
+extra_search      +mouse_sgr         +tag_binary        
-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 -liconv -lintl -framework AppKit -L/opt/homebrew/opt/lua/lib -llua5.4 -mmacosx-version-min=13.0 -fstack-protector-strong -L/opt/homebrew/opt/perl/lib/perl5/5.36/darwin-thread-multi-2level/CORE -lperl -L/opt/homebrew/opt/python@3.11/Frameworks/Python.framework/Versions/3.11/lib/python3.11/config-3.11-darwin -lpython3.11 -framework CoreFoundation -lruby.3.2 -L/opt/homebrew/Cellar/ruby/3.2.0/lib 

Output of YcmDebugInfo

Printing YouCompleteMe debug information...                                                                                                                                                                                                   
-- Resolve completions: On demand                                                                                                                                                                                                             
-- Client logfile: /var/folders/gc/5q359w5141166m5t2k7f8fjr0000gn/T/ycm_2d12k1kh.log                                                                                                                                                          
-- Server Python interpreter: /opt/homebrew/opt/python@3.10/bin/python3.10                                                                                                                                                                    
-- Server Python version: 3.10.9                                                                                                                                                                                                              
-- Server has Clang support compiled in: True                                                                                                                                                                                                 
-- Clang version: clang version 15.0.1 (https://github.com/ycm-core/llvm 708056a3d8259ce1d9fc0f15676d13b53cc23835)                                                                                                                            
-- No extra configuration file found                                                                                                                                                                                                          
-- Go completer debug information:                                                                                                                                                                                                            
--   gopls running                                                                                                                                                                                                                            
--   gopls process ID: 59498                                                                                                                                                                                                                  
--   gopls executable: ['/Users/deividas/.dotfiles/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/go/bin/gopls', '-logfile', '/var/folders/gc/5q359w5141166m5t2k7f8fjr0000gn/T/gopls_stderr0w540yu1.log']                             
--   gopls logfiles:                                                                                                                                                                                                                          
--     /var/folders/gc/5q359w5141166m5t2k7f8fjr0000gn/T/gopls_stderr0w540yu1.log                                                                                                                                                              
--   gopls Server State: Initialized                                                                                                                                                                                                          
--   gopls Project Directory: /Users/deividas/work/xxx                                                                                                                                             
--   gopls Settings: {                                                                                                                                                                                                                        
--   "hints": {                                                                                                                                                                                                                               
--     "assignVariableTypes": true,                                                                                                                                                                                                           
--     "compositeLiteralFields": true,                                                                                                                                                                                                        
--     "compositeLiteralTypes": true,                                                                                                                                                                                                         
--     "constantValues": true,                                                                                                                                                                                                                
--     "functionTypeParameters": true,                                                                                                                                                                                                        
--     "parameterNames": true,                                                                                                                                                                                                                
--     "rangeVariableTypes": true                                                                                                                                                                                                             
--   },                                                                                                                                                                                                                                       
--   "hoverKind": "Structured",                                                                                                                                                                                                               
--   "semanticTokens": true                                                                                                                                                                                                                   
-- }                                                                                                                                                                                                                                          
-- Server running at: http://127.0.0.1:64370                                                                                                                                                                                                  
-- Server process ID: 59421                                                                                                                                                                                                                   
-- Server logfiles:                                                                                                                                                                                                                           
--   /var/folders/gc/5q359w5141166m5t2k7f8fjr0000gn/T/ycmd_64370_stdout_tubjqjbz.log                                                                                                                                                          
--   /var/folders/gc/5q359w5141166m5t2k7f8fjr0000gn/T/ycmd_64370_stderr_qphje2fo.log                                                                                                                                                          
-- Semantic highlighting supported: True                                                                                                                                                                                                      
-- Virtual text supported: True                                                                                                                                                                                                               
-- Popup windows supported: True

Output of YcmDiags

<.. > 26 col 10 error| logger.WithErrors undefined  <..> has no field or method WithErrors) [MissingFieldOrMethod]

Output of git rev-parse HEAD in YouCompleteMe installation directory

7620d87fe1a1632c620921cb0989d358638fb324

Contents of YCM, ycmd and completion engine logfiles

Reproduce the issue with vim -Nu /path/to/YCM/vimrc_ycm_minimal, which enabled debug logging and other useful diagnostics. Include a link to a gist containing all of the log files listed by :YcmToggleLogs.

OS version, distribution, etc.

Apple M1 Pro, macOS 13.1

Output of build/install commands

Include link to a gist containing the invocation and entire output of install.py if reporting an installation issue.

puremourning commented 1 year ago

Can you please provide clear steps to repro using the minimal vimrc per CONTRIBUTING.md.

You didn’t mention what language you are writing or what settings , colour scheme, even..

deividaspetraitis commented 1 year ago

Thanks @puremourning, I have updated issue description to reproduce this behaviour using minimal vimrc as per CONTRIBUTING.md. I have removed references to customised vimrc to avoid confusion, however if you think it might be revelant I can add it.

puremourning commented 1 year ago

It looks like this is a property of your colour scheme, or vim version. For me, this happens:

Screenshot 2023-01-17 at 15 59 47

I tried this with latest master vim.

And this is what I get with vim -Nu /path/to/YCM/vimrc_ycm_minimal

Screenshot 2023-01-17 at 16 28 58

So either your setup is funky, or the steps to are are not complete.