Baike.dev
All toolsAI codingTrendingOpen sourceNewsSubmit
Log in
Back to tool/Back to issues
#4335·YouCompleteMe

YCM sends inaccurate range to HLS (Haskell Language Server)

Author: Aster89Created Jul 21, 2026Updated Jul 21, 2026

Issue Prelude

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

  • I have read and understood YCM's CONTRIBUTING document.
  • I have read and understood YCM's CODE_OF_CONDUCT document.
  • I have read and understood YCM's README, especially the Frequently Asked Questions section.
  • I have searched YCM's issue tracker to find issues similar to the one I'm about to report and couldn't find an answer to my problem. (Example Google search.)
  • If filing a bug report, I have included the output of vim --version.
  • If filing a bug report, I have included the output of :YcmDebugInfo.
  • If filing a bug report, I have attached the contents of the logfiles using the :YcmToggleLogs command.
  • If filing a bug report, I have included which OS (including specific OS version) I am using.
  • If filing a bug report, I have included a minimal test case that reproduces my issue, using vim -Nu /path/to/YCM/vimrc_ycm_minimal, including what I expected to happen and what actually happened.
  • If filing a installation failure report, I have included the entire output of install.py (or cmake/make/ninja) including its invocation
  • I understand this is an open-source project staffed by volunteers and that any help I receive is a selfless, heartfelt gift of their free time. I know I am not entitled to anything and will be polite and courteous.
  • I understand my issue may be closed if it becomes obvious I didn't actually perform all of these steps.

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:

  • What did you do?

Include steps to reproduce here.

  1. vim -Nu /path/to/YCM/ycm_vimrc_minimal;
  2. let g:ycm_log_level = 'debug';
  3. source /the/file/at https://github.com/ycm-core/lsp-examples/blob/master/haskell/snippet.vim;
  4. insert this text:
    haskell
    data Foo = Foo
    
    instance Show Foo where
  5. restart the server and wait for the -Wmissing-methods diagnostic on Show Foo;
  6. call :YcmCompleter FixIt with the cursor on each of the 8 positions in Show Foo;
  7. check the TX lines where YCM sends to HLS the range where the FixIt is reqeusted, e.g. by running this ex command:
    vim
    g/TX:.*},"range":{[^}]\+}[^}]\+}/echo substitute(getline('.'), '.*},\("range":{[^}]\+}[^}]\+}}\).*', '\1', '')`

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

If you made changes to vimrc_ycm_minimal, pase them here:

no changes
  • What did you expect to happen?

Not sure, but anything "uniform", e.g.:

  1. the 1-character range corresponding to the cursor position, i.e.
    python
    "range":{"end":{"character":10,"line":2},"start":{"character":9,"line":2}}
    "range":{"end":{"character":11,"line":2},"start":{"character":10,"line":2}}
    "range":{"end":{"character":12,"line":2},"start":{"character":11,"line":2}}
    "range":{"end":{"character":13,"line":2},"start":{"character":12,"line":2}}
    "range":{ # I don't really know what to expect here, as it's the space in between Show and Foo
    "range":{"end":{"character":15,"line":2},"start":{"character":14,"line":2}}
    "range":{"end":{"character":16,"line":2},"start":{"character":15,"line":2}}
    "range":{"end":{"character":17,"line":2},"start":{"character":16,"line":2}}
  2. the 1-character range corresponding to the first character of the identifier the cursor is currently on (this is what I see happening in C++),
    python
    "range":{"end":{"character":10,"line":2},"start":{"character":9,"line":2}}
    "range":{"end":{"character":10,"line":2},"start":{"character":9,"line":2}}
    "range":{"end":{"character":10,"line":2},"start":{"character":9,"line":2}}
    "range":{"end":{"character":10,"line":2},"start":{"character":9,"line":2}}
    "range":{ # I don't really know what to expect here, as it's the space in between Show and Foo
    "range":{"end":{"character":15,"line":2},"start":{"character":14,"line":2}}
    "range":{"end":{"character":15,"line":2},"start":{"character":14,"line":2}}
    "range":{"end":{"character":15,"line":2},"start":{"character":14,"line":2}}
  3. a range corresponding to the whole identifier the cursor is currently on.
    python
    "range":{"end":{"character":13,"line":2},"start":{"character":9,"line":2}}
    "range":{"end":{"character":13,"line":2},"start":{"character":9,"line":2}}
    "range":{"end":{"character":13,"line":2},"start":{"character":9,"line":2}}
    "range":{"end":{"character":13,"line":2},"start":{"character":9,"line":2}}
    "range":{ # I don't really know what to expect here, as it's the space in between Show and Foo
    "range":{"end":{"character":17,"line":2},"start":{"character":14,"line":2}}
    "range":{"end":{"character":17,"line":2},"start":{"character":14,"line":2}}
    "range":{"end":{"character":17,"line":2},"start":{"character":14,"line":2}}
  • What actually happened?

It feels like the range agrees with point 2 above, except when the cursor is on the second character of the identifier, in which case the range agrees with 1.

python
"range":{"end":{"character":10,"line":2},"start":{"character":9,"line":2}}
"range":{"end":{"character":11,"line":2},"start":{"character":10,"line":2}}
"range":{"end":{"character":10,"line":2},"start":{"character":9,"line":2}}
"range":{"end":{"character":10,"line":2},"start":{"character":9,"line":2}}
"range":{"end":{"character":10,"line":2},"start":{"character":9,"line":2}}
"range":{"end":{"character":15,"line":2},"start":{"character":14,"line":2}}
"range":{"end":{"character":16,"line":2},"start":{"character":15,"line":2}}
"range":{"end":{"character":15,"line":2},"start":{"character":14,"line":2}}

Diagnostic data

Output of vim --version

VIM - Vi IMproved 9.2 (2026 Feb 14, compiled Jul 18 2026 21:27:05)
Included patches: 1-804
Compiled by Arch Linux
Huge version with GTK3 GUI.  Features included (+) or not (-):
+acl                +float              +netbeans_intg      -tag_any_white
+arabic             +folding            +num64              +tcl/dyn
+autocmd            -footer             +packages           +termguicolors
+autochdir          +fork()             +path_extra         +terminal
-autoservername     +gettext            +perl/dyn           +terminfo
+balloon_eval       -hangul_input       +persistent_undo    +termresponse
+balloon_eval_term  +iconv              +popupwin           +textobjects
+browse             +insert_expand      +postscript         +textprop
++builtin_terms     +ipv6               +printer            +timers
+byte_offset        +job                +profile            +title
+channel            +jumplist           -python             +toolbar
+cindent            +keymap             +python3/dyn        +user_commands
+clientserver       +lambda             +quickfix           +vartabs
+clipboard          +langmap            +reltime            +vertsplit
+clipboard_provider +libcall            +rightleft          +vim9script
+cmdline_compl      +linebreak          +ruby/dyn           +viminfo
+cmdline_hist       +lispindent         +scrollbind         +virtualedit
+cmdline_info       +listcmds           +signs              +visual
+comments           +localmap           +smartindent        +visualextra
+conceal            +lua/dyn            +socketserver       +vreplace
+cryptv             +menu               -sodium             +wayland
+cscope             +mksession          +image              +wayland_clipboard
+cursorbind         +modify_fname       +image_sixel        +wildignore
+cursorshape        +mouse              +image_kitty        +wildmenu
+dialog_con_gui     +mouseshape         -image_gdi          +windows
+diff               +mouse_dec          +image_cairo        +writebackup
+digraphs           +mouse_gpm          -image_gdk          +X11
+dnd                -mouse_jsbterm      +sound              +xattr
-ebcdic             +mouse_netterm      +spell              -xfontset
+emacs_tags         +mouse_sgr          +startuptime        +xim
+eval               -mouse_sysmouse     +statusline         -xpm
+ex_extra           +mouse_urxvt        -sun_workshop       +xsmp_interact
+extra_search       +mouse_xterm        +syntax             +xterm_clipboard
-farsi              +multi_byte         +tabpanel           -xterm_save
+file_in_path       +multi_lang         +tag_binary         
+find_in_path       -mzscheme           -tag_old_static     
   system vimrc file: "/etc/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
 3rd user vimrc file: "~/.config/vim/vimrc"
      user exrc file: "$HOME/.exrc"
  system gvimrc file: "/etc/gvimrc"
    user gvimrc file: "$HOME/.gvimrc"
2nd user gvimrc file: "~/.vim/gvimrc"
3rd user gvimrc file: "~/.config/vim/gvimrc"
       defaults file: "$VIMRUNTIME/defaults.vim"
    system menu file: "$VIMRUNTIME/menu.vim"
  fall-back for $VIM: "/usr/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK -I/usr/include/gtk-3.0 -I/usr/include/pango-1.0 -I/usr/include/cloudproviders -I/usr/include/cairo -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/glycin-2 -I/usr/include/at-spi2-atk/2.0 -I/usr/include/at-spi-2.0 -I/usr/include/atk-1.0 -I/usr/include/dbus-1.0 -I/usr/lib/dbus-1.0/include -I/usr/include/fribidi -I/usr/include/pixman-1 -I/usr/include/harfbuzz -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/gio-unix-2.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/sysprof-6 -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions -Wformat -Werror=format-security -fstack-clash-protection -fcf-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -g -ffile-prefix-map=/build/vim/src=/usr/src/debug/vim -flto=auto -D_REENTRANT -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 
Linking: gcc -Wl,-E -Wl,-rpath,/usr/lib/perl5/5.42/core_perl/CORE -Wl,-O1 -Wl,--sort-common -Wl,--as-needed -Wl,-z,relro -Wl,-z,now -Wl,-z,pack-relative-relocs -flto=auto -L/usr/local/lib -o vim -lgtk-3 -lgdk-3 -lpangocairo-1.0 -lcairo-gobject -lgdk_pixbuf-2.0 -latk-1.0 -lpango-1.0 -lcairo -lharfbuzz -lgio-2.0 -lgobject-2.0 -lglib-2.0 -lz -lSM -lICE -lXt -lX11 -lwayland-client -lm -lXdmcp -lSM -lICE -lm -ltinfo -lnsl -lcanberra -lacl -lattr -lgpm -L/usr/lib -ltclstub8.6 -ldl -lz -lpthread -lm 

Output of YcmDebugInfo

Printing YouCompleteMe debug information...                                                                                                                                         
-- Resolve completions: Up front
-- Client logfile: /tmp/ycm_e1gzwzpw.log
-- Server Python interpreter: /usr/bin/python3
-- Server Python version: 3.14.6
-- Server has Clang support compiled in: False
-- Clang version: None
-- Extra configuration file found and loaded
-- Extra configuration path: /home/enrico/.ycm_extra_conf.py
-- GenericLSP completer debug information:
--   haskell-language-serverCompleter running
--   haskell-language-serverCompleter process ID: 580901
--   haskell-language-serverCompleter executable: ['/home/enrico/.ghcup/bin/haskell-language-server-wrapper', '--lsp']
--   haskell-language-serverCompleter logfiles:
--     /tmp/haskell_language_servercompleter_stderrcb1unx_2.log
--   haskell-language-serverCompleter Server State: Initialized
--   haskell-language-serverCompleter Project Directory: /home/enrico/haskell-language-server
--   haskell-language-serverCompleter Open Workspaces: {'/home/enrico/haskell-language-server'}
--   haskell-language-serverCompleter Settings: {
--   "haskell": {
--     "plugin": {
--       "case-split": {
--         "globalOn": true
--       },
--       "hlint": {
--         "globalOn": false
--       },
--       "rename": {
--         "config": {
--           "crossModule": true
--         }
--       }
--     },
--     "sessionLoading": "multipleComponents"
--   }
-- }
-- Server running at: http://127.0.0.1:52107
-- Server process ID: 580894
-- Server logfiles:
--   /tmp/ycmd_52107_stdout_6qfmdilc.log
--   /tmp/ycmd_52107_stderr_1jt82okb.log
-- Semantic highlighting supported: True
-- Virtual text supported: True
-- Popup windows supported: True

Output of YcmDiags

uffa.hs|3 col 10 warning| • No explicit implementation for either ‘showsPrec’ or ‘show’ • In the instance declaration for ‘Show Foo’ [GHC-06201]

Output of git rev-parse HEAD in YouCompleteMe installation directory

f8fbc1ddf440b0b34ac23bcd7b7d8d14a7fb80e6

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.

ycmd stderr (from the first TX message that feels wrong, otherwise it's too large for Gist to accept it): https://gist.github.com/Aster89/922b40abe1e1203a5e743bfa46163501

ycm complete log: https://gist.github.com/Aster89/c191f8b1d6fb7aad32525b6e11544670

HLS log: https://gist.github.com/Aster89/c65cc38e7670a4d773c7ccde0f283727

OS version, distribution, etc.

Up-to-date ArchLinux

Output of build/install commands

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

Source: ycm-core/YouCompleteMe

View original on GitHubView discussion on GitHub