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

CocList preview window cursorline not showing #4819

Open
jackielii opened this issue Nov 26, 2023 · 5 comments
Open

CocList preview window cursorline not showing #4819

jackielii opened this issue Nov 26, 2023 · 5 comments

Comments

@jackielii
Copy link
Contributor

Result from CocInfo

## versions

vim version: NVIM v0.9.4
node version: v21.2.0
coc.nvim version: 0.0.82-9c3723a0 2023-11-14 10:51:35 +0800
coc.nvim directory: /Users/jackieli/personal/coc.nvim
term: xterm-kitty
platform: darwin

## Log of coc.nvim

2023-11-26T22:14:02.551 INFO (pid:41928) [attach] - receive notification: updateConfig [ 'python.formatting.blackPath', '/opt/homebrew/bin/black' ]
2023-11-26T22:14:02.658 INFO (pid:41928) [extension:coc-git] - Looking for git in: git
2023-11-26T22:14:02.792 INFO (pid:41928) [plugin] - coc.nvim initialized with node: v21.2.0 after 302
2023-11-26T22:14:02.794 INFO (pid:41928) [attach] - receive notification: highlight []
2023-11-26T22:14:04.007 INFO (pid:41928) [attach] - receive notification: showInfo []

Describe the bug

A clear and concise description of what the bug is.

This was an issue for me for quite a while. It use to work but now not.

In CocList --auto-preview grep ... result I use to see the cursorline highlighting the matched line. But now it's gone. My request was similar to issue: #2039

Reproduce the bug

We will close your issue when you don't provide minimal vimrc and we can't
reproduce it

  • Create file mini.vim with:

    set nocompatible
    set runtimepath^=/path/to/coc.nvim
    filetype plugin indent on
    syntax on
    set hidden
  • Start (neo)vim with command: vim -u mini.vim

  • Enter :CocList --auto-preview grep hello

I tracked the issue down and it looks like it's set on purpose: https://github.com/neoclide/coc.nvim/blob/master/autoload/coc/list.vim#L444 . And the highlights are latter on handled in s:preview_highlights. However I don't quite get what this is doing. And it's probably not working.

Can I request to bring back the cursorline for the preview window? or add an option for user to set it to a different highlight group. Or maybe the original s:preview_highlights are meant to work. Whichever it is, I just would like to see what's the matched line.

Screenshots (optional)

If applicable, add screenshots to help explain your problem.
image

@hexh250786313
Copy link
Contributor

My hack:

sd 'range: emptyRange\(range\) \? null' 'range: emptyRange(range) ? { start: range.start, end: { line: range.end.line, character: range.end.character + 1 } }' ~/.local/share/nvim/site/pack/packer/opt/coc.nvim/build/index.js

(sd is https://github.com/chmln/sd)

The matching in grep is not just single-line, so I think its implementation does not rely on cursorline, but rather on a kind of highlighting that changes the background color, similar to what's in jumpDefinition.

For technical reasons, it's quite challenging for grep to highlight the entire matching string, which might be the reason Zhao mentioned about not having the time to implement it.

Therefore, my hack only allows it to tell you where the first character of the match is, which is not difficult to implement.

simplescreenrecorder-2023-11-29_11.27.47.mp4

@hexh250786313
Copy link
Contributor

I think using coc-lists with plugins like nvim-bqf would be a better choice, as it would highlight the matching characters.

@fannheyward
Copy link
Member

image

Changes in coc-lists only, working for CocList --auto-preview grep hello, but failed on CocList --auto-preview grep hello[AB], working on this.

The core issue: extract hello[AB] to hello, remove regex-related characters.

@fannheyward
Copy link
Member

The core issue: extract hello[AB] to hello, remove regex-related characters.

Any function for this is welcome!

@fannheyward
Copy link
Member

@jackielii @hexh250786313 neoclide/coc-lists#151

only non-interactive mode, and the search text shouldn't contains regex characters

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

3 participants