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

[live_grep] no highlights in results window for a regex query #1708

Open
rockyzhang24 opened this issue Jan 21, 2022 · 8 comments
Open

[live_grep] no highlights in results window for a regex query #1708

rockyzhang24 opened this issue Jan 21, 2022 · 8 comments
Labels
bug Something isn't working

Comments

@rockyzhang24
Copy link
Contributor

rockyzhang24 commented Jan 21, 2022

Description

In live_grep, when I type a regex string as query after the prompt, no highlight for the matching in the results window.

Neovim version

NVIM v0.7.0-dev+797-gb218d02c4
Build type: Release
LuaJIT 2.1.0-beta3

Operating system and version

macOS 12.1 (the latest)

checkhealth telescope

telescope: require("telescope.health").check()
========================================================================
## Checking for required plugins
  - OK: plenary installed.
  - OK: nvim-treesitter installed.

## Checking external dependencies
  - OK: rg: found ripgrep 13.0.0
  - OK: fd: found fd 8.3.1

## ===== Installed extensions =====

## Telescope Extension: `fzf`
  - INFO: No healthcheck provided

Steps to reproduce

  1. launch live_grep
  2. type a string not containing regex, in the results window all the matching will be highlighted
  3. type a regex string, in the result window no highlight for all the matching

Expected behavior

All the matching should be highlighted as well when the query is regex.

Actual behavior

Screen Shot 2022-01-21 at 13 14 05

However, if I type a normal string as a query, all the matching will be highlighted

Screen Shot 2022-01-21 at 13 15 28

Minimal config

The default config.

@rockyzhang24 rockyzhang24 added the bug Something isn't working label Jan 21, 2022
@fdschmidt93
Copy link
Member

Highlighting in the results window is actually performed by a fzy sorter.

Essentially, somebody would have to pick up #1448

@rockyzhang24
Copy link
Contributor Author

rockyzhang24 commented Jan 21, 2022

Thanks. Btw, I installed fzf extension as the sorter. I know that find_files will use fzf, how about live_grep and grep_string?

Should I try telescope-rg.nvim?

@fdschmidt93
Copy link
Member

fdschmidt93 commented Jan 21, 2022

Ah, I was too brief. The fzy sorter for highlighting pretty much only gets the offsets of matched prompts for highlighting but does not perform any sorting per se.

live_grep therefore doesn't practically speaking have any sorter. grep_string passes the string (also possibly an empty string) onto rg and then filters that one using your sorter.

Should I try telescope-rg.nvim?

I think the author originally planned on picking up the PR but never came around. That's why I mentioned somebody has to pick it up :) in the long run, in open source people ideally implement the features they want to see implemented (or generally have fun implementing stuff, of course).

@rockyzhang24
Copy link
Contributor Author

rockyzhang24 commented Jan 21, 2022

Thank you @fdschmidt93 so much for your clear explanation.

On more question (or issue) here still for live_grep highlight.
When I type a query string, say main, only the files containing main xxx will be listed and main should be highlighted. However, if a file has name like main.go and its content has main xxx, highlight will be misplaced, i.e., main in the filename will be highlighted instead of the actual content. Is this a bug?

Screen Shot 2022-01-21 at 15 45 34

@fdschmidt93 I am not sure whether this problem is related to this issue, do I need to open another issue? Thank you very much.

@fdschmidt93
Copy link
Member

It's pretty much the same issue. If we got our highlighting from rg directly that issue would be fixed. I'd say you're happy to open another issue for that, though in practice would have the same solution I guess.

@rockyzhang24
Copy link
Contributor Author

Okay, I got it. Thanks.

@mrbeardad
Copy link

Is there any progress? 👀

@Conni2461
Copy link
Member

Yes there is progress here. One of our team members made a wip pr #2536

I hope we can finish this one soon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants