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

Document use of filter columns in pickers #11218

Merged
merged 9 commits into from
Jul 24, 2024

Conversation

rcorre
Copy link
Contributor

@rcorre rcorre commented Jul 18, 2024

Filtering on columns was implemented in #9647.
The only documentation I could find on this feature
was the PR itself, and the video demo used a different syntax.

Filtering on columns was implemented in helix-editor#9647.
The only documentation I could find on this feature
was the PR itself, and the video demo used a different syntax.
@kirawi
Copy link
Member

kirawi commented Jul 18, 2024

You can also do multiple filters via syntax like %p:"FILTER_1 FILTER_2 ... FILTER_N" The trailing " is optional if nothing else follows.

@rcorre
Copy link
Contributor Author

rcorre commented Jul 18, 2024

Thanks @kirawi! From my testing, it's not %column:"a b", but %column a b

@kirawi
Copy link
Member

kirawi commented Jul 18, 2024

Hmm, you're right. I was running a build of an older version of the picker PR and it seems to have changed.

In pickers, you can filter specific columns by prefixing the column name with `%`.
All words after a `%<column>` term are treated as filters for that column.
The base filter is a regex, while column filters are a space-separated of literals.
For example, in the file picker, `init %path api .proto` searches for files containing
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of in the file picker it should probably be in the global search picker, right? As you cannot search for file contents in the file picker.

book/src/keymap.md Outdated Show resolved Hide resolved
@david-crespo
Copy link
Contributor

Great wording, very helpful and clear. Thank you!

Copy link
Member

@the-mikedavis the-mikedavis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a good start but I think we may want a larger section to talk about pickers now. We could add a page under the Usage section like we have for textobjects for example and include some gifs

@@ -452,6 +452,13 @@ Keys to use within picker. Remapping currently not supported.
| `Ctrl-t` | Toggle preview |
| `Escape`, `Ctrl-c` | Close picker |

In pickers, you can filter specific columns by prefixing the column name with `%`.
All words after a `%<column>` term are treated as filters for that column.
The base filter is a regex, while column filters are a space-separated of literals.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually columns use fuzzy filtering. There are two exceptions: the default columns for global_search and the LSP workspace_symbol_picker. global_search's default column is a regex and workspace_symbol_picker's is sent to the language server so it can do its own filtering.

book/src/keymap.md Outdated Show resolved Hide resolved
@the-mikedavis the-mikedavis added the A-documentation Area: Documentation improvements label Jul 18, 2024
@rcorre
Copy link
Contributor Author

rcorre commented Jul 18, 2024

I think I discovered by accident that ! negates a term. Are there any other hidden features I should know about? 😆

@pascalkuthe
Copy link
Member

That's not new and been implememted for a long time. That is standard fzf syntax.

@rcorre
Copy link
Contributor Author

rcorre commented Jul 19, 2024

I've moved picker docs to their own section.
I'm happy to record some gifs/asciinema, but I'm unclear on how to use them.
It looks like the gifs currently in the docs are links to user-images.githubusercontent.com.
Should I just post gifs in this PR, then link them in the book? Will those links stay alive indefinitely?

book/src/pickers.md Outdated Show resolved Hide resolved

Most pickers perform fuzzy matching using [fzf syntax](https://github.com/junegunn/fzf?tab=readme-ov-file#search-syntax). Two exceptions are the global search picker, which uses regex, and the workspace symbol picker, which passes search terms to the LSP.

If a picker shows multiple columns, you may apply the filter to a specific column by prefixing the column name with `%`. Column names can be shortened to any prefix, so `%p`, `%pa` or `%pat` all mean the same as `%path`. For example, `helix %p .toml$ !lang` searches for the term "helix" within files with paths ending in ".toml" but not including "lang".
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, I thought .toml$ was working, but it isn't. It seems that the line number is considered part of the path, e.g. .toml:7$ works. Is that intentional?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right the line number is considered part of the path column for the sake of fuzzy matching. So instead of adding $ at the end of a path you can add a : instead, e.g. %p file.rs:

book/src/pickers.md Outdated Show resolved Hide resolved
Copy link

@nick42d nick42d left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was in this space recently with #11245 and so added my 2c. Looks good, minor feedback only.


### Filtering Picker Results

Most pickers perform fuzzy matching using [fzf syntax](https://github.com/junegunn/fzf?tab=readme-ov-file#search-syntax). Two exceptions are the global search picker, which uses regex, and the workspace symbol picker, which passes search terms to the LSP.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's an exception to the fzf syntax - the OR syntax is not implemented yet per discussion on #11245

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there an issue specifically for OR support? I couldn't find it.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not that I'm aware of either outside of #11245.

book/src/pickers.md Outdated Show resolved Hide resolved
Copy link
Member

@the-mikedavis the-mikedavis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just a minor edit, otherwise this is looking good

book/src/pickers.md Outdated Show resolved Hide resolved
@the-mikedavis the-mikedavis changed the title Document use of filter columns in pickers. Document use of filter columns in pickers Jul 23, 2024
@pascalkuthe pascalkuthe merged commit 5d3f05c into helix-editor:master Jul 24, 2024
6 checks passed
@dvic
Copy link
Contributor

dvic commented Jul 25, 2024

Just to double check:

For example, a query of helix %p .toml$ !lang in the global search picker searches for the term "helix" within files with paths ending in ".toml" but not including "lang".

For me this example doesn't work, because the line numbers in the format of :123 are appended to the path.

So something %path .exs$ doesn't work but something %path .exs:439$ does. Is this expected? Or should the path matching be updated to exclude the line numbers part?

@rcorre
Copy link
Contributor Author

rcorre commented Jul 25, 2024

Argh, you're correct @dvic. I meant to correct that but forgot: #11218 (comment).

should the path matching be updated to exclude the line numbers part

Personally I think that's the better approach here, but I'm not sure how difficult that is (I can't imagine ever wanting to filter on line number.

@rcorre rcorre deleted the doc-filter-picker branch July 25, 2024 10:44
@dvic
Copy link
Contributor

dvic commented Jul 25, 2024

Argh, you're correct @dvic. I meant to correct that but forgot: #11218 (comment).

should the path matching be updated to exclude the line numbers part

Personally I think that's the better approach here, but I'm not sure how difficult that is (I can't imagine ever wanting to filter on line number.

Ahhh I missed that conversation. @the-mikedavis What is your opinion on this? I also think it's not really useful to include the line number in the matching but I don't know how big of an effort it is to exclude this.

@the-mikedavis
Copy link
Member

Oh whoops I missed that in review. For now we should update the docs to say : instead of $. @pascalkuthe and I talked about line numbers and thought it might better belong in the preview instead (so an absolute line number gutter in the preview pane) rather than the path search text. Then $ would apply as currently documented

dvic added a commit to dvic/helix that referenced this pull request Jul 25, 2024
SofusA pushed a commit to SofusA/helix-pull-diagnostics that referenced this pull request Aug 4, 2024
* Document use of filter columns in pickers.

Filtering on columns was implemented in helix-editor#9647.
The only documentation I could find on this feature
was the PR itself, and the video demo used a different syntax.

* Note that column filters are space-separated.

* Note that picker filters can be abbreviated.

* Specify correct picker in docs.

* Clarify picker filter prefix shortenting.

Co-authored-by: Michael Davis <[email protected]>

* Move picker docs to their own section.

* Update book/src/pickers.md

Co-authored-by: Michael Davis <[email protected]>

* Improve docs on picker registers, keybinds, and syntax.

* Clarify wording around picker queries.

Co-authored-by: Michael Davis <[email protected]>

---------

Co-authored-by: Ryan Roden-Corrent <[email protected]>
Co-authored-by: Michael Davis <[email protected]>
mxxntype pushed a commit to mxxntype/helix that referenced this pull request Aug 14, 2024
* Document use of filter columns in pickers.

Filtering on columns was implemented in helix-editor#9647.
The only documentation I could find on this feature
was the PR itself, and the video demo used a different syntax.

* Note that column filters are space-separated.

* Note that picker filters can be abbreviated.

* Specify correct picker in docs.

* Clarify picker filter prefix shortenting.

Co-authored-by: Michael Davis <[email protected]>

* Move picker docs to their own section.

* Update book/src/pickers.md

Co-authored-by: Michael Davis <[email protected]>

* Improve docs on picker registers, keybinds, and syntax.

* Clarify wording around picker queries.

Co-authored-by: Michael Davis <[email protected]>

---------

Co-authored-by: Ryan Roden-Corrent <[email protected]>
Co-authored-by: Michael Davis <[email protected]>
stackotter pushed a commit to stackotter/helix that referenced this pull request Aug 28, 2024
* Document use of filter columns in pickers.

Filtering on columns was implemented in helix-editor#9647.
The only documentation I could find on this feature
was the PR itself, and the video demo used a different syntax.

* Note that column filters are space-separated.

* Note that picker filters can be abbreviated.

* Specify correct picker in docs.

* Clarify picker filter prefix shortenting.

Co-authored-by: Michael Davis <[email protected]>

* Move picker docs to their own section.

* Update book/src/pickers.md

Co-authored-by: Michael Davis <[email protected]>

* Improve docs on picker registers, keybinds, and syntax.

* Clarify wording around picker queries.

Co-authored-by: Michael Davis <[email protected]>

---------

Co-authored-by: Ryan Roden-Corrent <[email protected]>
Co-authored-by: Michael Davis <[email protected]>
kyruzic pushed a commit to kyruzic/helix that referenced this pull request Sep 27, 2024
* Document use of filter columns in pickers.

Filtering on columns was implemented in helix-editor#9647.
The only documentation I could find on this feature
was the PR itself, and the video demo used a different syntax.

* Note that column filters are space-separated.

* Note that picker filters can be abbreviated.

* Specify correct picker in docs.

* Clarify picker filter prefix shortenting.

Co-authored-by: Michael Davis <[email protected]>

* Move picker docs to their own section.

* Update book/src/pickers.md

Co-authored-by: Michael Davis <[email protected]>

* Improve docs on picker registers, keybinds, and syntax.

* Clarify wording around picker queries.

Co-authored-by: Michael Davis <[email protected]>

---------

Co-authored-by: Ryan Roden-Corrent <[email protected]>
Co-authored-by: Michael Davis <[email protected]>
plul pushed a commit to plul/helix that referenced this pull request Oct 13, 2024
* Document use of filter columns in pickers.

Filtering on columns was implemented in helix-editor#9647.
The only documentation I could find on this feature
was the PR itself, and the video demo used a different syntax.

* Note that column filters are space-separated.

* Note that picker filters can be abbreviated.

* Specify correct picker in docs.

* Clarify picker filter prefix shortenting.

Co-authored-by: Michael Davis <[email protected]>

* Move picker docs to their own section.

* Update book/src/pickers.md

Co-authored-by: Michael Davis <[email protected]>

* Improve docs on picker registers, keybinds, and syntax.

* Clarify wording around picker queries.

Co-authored-by: Michael Davis <[email protected]>

---------

Co-authored-by: Ryan Roden-Corrent <[email protected]>
Co-authored-by: Michael Davis <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-documentation Area: Documentation improvements
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Picker V2 are lacking user-facing docs on how to use them
8 participants