-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Workspace symbol search does not support special characters #5714
Comments
Two notes:
|
This is because the picker showing the symbol results is also filtering by the input text so it's filtering out options that don't have a literal |
Ah, yes, I see |
Alright, so the easiest possible solution (that works!) is to extend But... that sounds more like a workaround than clean code to me, so I wonder if I should add a new option to the picker itself. |
Something that's slightly better would be to not call Ideally we want to completely avoid using the underlying picker's filtering and use the dynamic pickers callback as @the-mikedavis said. But since a helix/helix-term/src/ui/picker.rs Line 904 in 4dcf1fe
Tracing the helix/helix-term/src/ui/picker.rs Lines 607 to 613 in 4dcf1fe
I think the proper solution would be to refactor out a picker that doesn't do filtering, simply displays a list of items with a prompt, handles most common events (like moving up and down the list, changing the prompt, etc) and emits an event when the prompt changes and it's time to re-filter the list. This picker could be embedded in and composed together with the current picker and dynamic picker to get specific behavior. |
One unfortunate sideeffect of this is that we losse the normal picker syntax (and ranking) like using space as a logical and or stuff like #5114. There is probably no way around that (I can think of) except introducing a bunch of escapes (which we probably don't want to do). For global search that is quite intuitive as we are not really filtering the picker items (which would be the files) but a separate property (the search query which is a regex). For the symbol picker it's kind of confusing tough as it looks just like a normal picker where you would expect the normal syntax would just work. Maybe we could somehow indicate visually what kind of syntax a picker accepts? It's probably not super critical but it would be a nice discoverability feature |
I don't think it's possible to have the normal picker syntax in any of the dynamic pickers since the syntax relies on having the full list of options upfront. Taking an example from #5114, That said this would be definitely confusing in the workspace symbol picker like you said, so a visual indicator would indeed be nice to have. |
Merges the code for the Picker and FilePicker into a single Picker that can show a file preview if a preview callback is provided. This change was mainly made to facilitate refactoring out a simple skeleton of a picker that does not do any filtering to be reused in a normal Picker and a DynamicPicker (see helix-editor#5714; in particular [mikes-comment] and [gokuls-comment]). The crux of the issue is that a picker maintains a list of predefined options (eg. list of files in the directory) and (re-)filters them every time the picker prompt changes, while a dynamic picker (eg. interactive global search, helix-editor#4687) recalculates the full list of options on every prompt change. Using a filtering picker to drive a dynamic picker hence does duplicate work of filtering thousands of matches for no reason. It could also cause problems like interfering with the regex pattern in the global search. I tried to directly extract a PickerBase to be reused in Picker and FilePicker and DynamicPicker, but the problem is that DynamicPicker is actually a DynamicFilePicker (i.e. it can preview file contents) which means we would need PickerBase, Picker, FilePicker, DynamicPicker and DynamicFilePicker and then another way of sharing the previewing code between a FilePicker and a DynamicFilePicker. By merging Picker and FilePicker into Picker, we only need PickerBase, Picker and DynamicPicker. [gokuls-comment]: helix-editor#5714 (comment) [mikes-comment]: helix-editor#5714 (comment)
Merges the code for the Picker and FilePicker into a single Picker that can show a file preview if a preview callback is provided. This change was mainly made to facilitate refactoring out a simple skeleton of a picker that does not do any filtering to be reused in a normal Picker and a DynamicPicker (see helix-editor#5714; in particular [mikes-comment] and [gokuls-comment]). The crux of the issue is that a picker maintains a list of predefined options (eg. list of files in the directory) and (re-)filters them every time the picker prompt changes, while a dynamic picker (eg. interactive global search, helix-editor#4687) recalculates the full list of options on every prompt change. Using a filtering picker to drive a dynamic picker hence does duplicate work of filtering thousands of matches for no reason. It could also cause problems like interfering with the regex pattern in the global search. I tried to directly extract a PickerBase to be reused in Picker and FilePicker and DynamicPicker, but the problem is that DynamicPicker is actually a DynamicFilePicker (i.e. it can preview file contents) which means we would need PickerBase, Picker, FilePicker, DynamicPicker and DynamicFilePicker and then another way of sharing the previewing code between a FilePicker and a DynamicFilePicker. By merging Picker and FilePicker into Picker, we only need PickerBase, Picker and DynamicPicker. [gokuls-comment]: helix-editor#5714 (comment) [mikes-comment]: helix-editor#5714 (comment)
Merges the code for the Picker and FilePicker into a single Picker that can show a file preview if a preview callback is provided. This change was mainly made to facilitate refactoring out a simple skeleton of a picker that does not do any filtering to be reused in a normal Picker and a DynamicPicker (see #5714; in particular [mikes-comment] and [gokuls-comment]). The crux of the issue is that a picker maintains a list of predefined options (eg. list of files in the directory) and (re-)filters them every time the picker prompt changes, while a dynamic picker (eg. interactive global search, #4687) recalculates the full list of options on every prompt change. Using a filtering picker to drive a dynamic picker hence does duplicate work of filtering thousands of matches for no reason. It could also cause problems like interfering with the regex pattern in the global search. I tried to directly extract a PickerBase to be reused in Picker and FilePicker and DynamicPicker, but the problem is that DynamicPicker is actually a DynamicFilePicker (i.e. it can preview file contents) which means we would need PickerBase, Picker, FilePicker, DynamicPicker and DynamicFilePicker and then another way of sharing the previewing code between a FilePicker and a DynamicFilePicker. By merging Picker and FilePicker into Picker, we only need PickerBase, Picker and DynamicPicker. [gokuls-comment]: #5714 (comment) [mikes-comment]: #5714 (comment)
Merges the code for the Picker and FilePicker into a single Picker that can show a file preview if a preview callback is provided. This change was mainly made to facilitate refactoring out a simple skeleton of a picker that does not do any filtering to be reused in a normal Picker and a DynamicPicker (see helix-editor#5714; in particular [mikes-comment] and [gokuls-comment]). The crux of the issue is that a picker maintains a list of predefined options (eg. list of files in the directory) and (re-)filters them every time the picker prompt changes, while a dynamic picker (eg. interactive global search, helix-editor#4687) recalculates the full list of options on every prompt change. Using a filtering picker to drive a dynamic picker hence does duplicate work of filtering thousands of matches for no reason. It could also cause problems like interfering with the regex pattern in the global search. I tried to directly extract a PickerBase to be reused in Picker and FilePicker and DynamicPicker, but the problem is that DynamicPicker is actually a DynamicFilePicker (i.e. it can preview file contents) which means we would need PickerBase, Picker, FilePicker, DynamicPicker and DynamicFilePicker and then another way of sharing the previewing code between a FilePicker and a DynamicFilePicker. By merging Picker and FilePicker into Picker, we only need PickerBase, Picker and DynamicPicker. [gokuls-comment]: helix-editor#5714 (comment) [mikes-comment]: helix-editor#5714 (comment)
Merges the code for the Picker and FilePicker into a single Picker that can show a file preview if a preview callback is provided. This change was mainly made to facilitate refactoring out a simple skeleton of a picker that does not do any filtering to be reused in a normal Picker and a DynamicPicker (see helix-editor#5714; in particular [mikes-comment] and [gokuls-comment]). The crux of the issue is that a picker maintains a list of predefined options (eg. list of files in the directory) and (re-)filters them every time the picker prompt changes, while a dynamic picker (eg. interactive global search, helix-editor#4687) recalculates the full list of options on every prompt change. Using a filtering picker to drive a dynamic picker hence does duplicate work of filtering thousands of matches for no reason. It could also cause problems like interfering with the regex pattern in the global search. I tried to directly extract a PickerBase to be reused in Picker and FilePicker and DynamicPicker, but the problem is that DynamicPicker is actually a DynamicFilePicker (i.e. it can preview file contents) which means we would need PickerBase, Picker, FilePicker, DynamicPicker and DynamicFilePicker and then another way of sharing the previewing code between a FilePicker and a DynamicFilePicker. By merging Picker and FilePicker into Picker, we only need PickerBase, Picker and DynamicPicker. [gokuls-comment]: helix-editor#5714 (comment) [mikes-comment]: helix-editor#5714 (comment)
Merges the code for the Picker and FilePicker into a single Picker that can show a file preview if a preview callback is provided. This change was mainly made to facilitate refactoring out a simple skeleton of a picker that does not do any filtering to be reused in a normal Picker and a DynamicPicker (see helix-editor#5714; in particular [mikes-comment] and [gokuls-comment]). The crux of the issue is that a picker maintains a list of predefined options (eg. list of files in the directory) and (re-)filters them every time the picker prompt changes, while a dynamic picker (eg. interactive global search, helix-editor#4687) recalculates the full list of options on every prompt change. Using a filtering picker to drive a dynamic picker hence does duplicate work of filtering thousands of matches for no reason. It could also cause problems like interfering with the regex pattern in the global search. I tried to directly extract a PickerBase to be reused in Picker and FilePicker and DynamicPicker, but the problem is that DynamicPicker is actually a DynamicFilePicker (i.e. it can preview file contents) which means we would need PickerBase, Picker, FilePicker, DynamicPicker and DynamicFilePicker and then another way of sharing the previewing code between a FilePicker and a DynamicFilePicker. By merging Picker and FilePicker into Picker, we only need PickerBase, Picker and DynamicPicker. [gokuls-comment]: helix-editor#5714 (comment) [mikes-comment]: helix-editor#5714 (comment)
Summary
Rust analyzer has a feature where if you type
*
at the end of the workspace symbol search, it does include STDLIB.However, the helix editor cannot display it correctly.
You can see, actually, that something is sent since the result count changes from 0/1 to 0/6, AND when you press backspace (to remove
*
), it shows the results for a fraction of a second.Reproduction Steps
https://asciinema.org/a/oCCBJaSXXysbECQc3nw2FlVpR
CTRL+SHIFT+S
Mutex
- there should be no results from stdlib.*
at the endExpected behavior:
Helix should display the response from the server with Mutex entry from stdlib, as well as from dependencies, etc.
Actual behavior:
An empty list with the correct result count.
Additionally:
*
from the inputSuddenly for a couple of milliseconds, Helix shows the results of
Mutex*
query.Helix log
~/.cache/helix/helix.log
Platform
Linux
Terminal Emulator
alacritty
Helix Version
22.12-189-g2c6bf6fc
The text was updated successfully, but these errors were encountered: