aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src/ui/menu.rs
Commit message (Collapse)AuthorAge
* Fix scroll track (#9508)ath32024-02-09
|
* refactor completion and signature help using hooksPascal Kuthe2024-01-23
|
* Support drawing popup frame (#4313)ath32023-12-19
| | | Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
* Don't use word splitting during fuzzy matching (#8192)Pascal Kuthe2023-09-06
|
* transition to nucleo for fuzzy matching (#7814)Pascal Kuthe2023-08-30
| | | | | | | | | | | | | | | | | | * transition to nucleo for fuzzy matching * drop flakey test case since the picker streams in results now any test that relies on the picker containing results is potentially flakely * use crates.io version of nucleo * Fix typo in commands.rs Co-authored-by: Skyler Hawthorne <skyler@dead10ck.com> --------- Co-authored-by: Skyler Hawthorne <skyler@dead10ck.com>
* feat: smart_tabSkyler Hawthorne2023-08-01
| | | | | | Implement `smart_tab`, which optionally makes the tab key run the `move_parent_node_start` command when the cursor has non- whitespace to its left.
* Truncate paths in the file picker (#6410)mWalrus2023-03-31
|
* ignore case while filtering completions (#6008)Pascal Kuthe2023-02-16
|
* bump msrv to 1.63 (#5570)Pascal Kuthe2023-02-09
| | | | | * bump msrv to 1.63 * resolve new complex type clippy lints
* Removing C-j and C-k from completion menu navigation (#5070)Dylan Bulfin2023-02-02
|
* Fix clippy 1.67 warnings (#5697)Miguel Madrid-Mencía2023-01-27
|
* Replace menu::Item::{row, label} with format()Gokul Soumya2023-01-18
|
* lsp: Resolve completion item asynchronously on idle-timeout (#4781)Michael Davis2022-11-18
| | | | | | | | | | | | | | | | | | | | | d7d0d5ffb79b6f2e09c6ab8af6e112c41e6f73e8 resolves completion items on the idle-timeout event. The `Completion::resolve_completion_item` function blocks on the LSP request though, which blocks the compositor and in turn blocks the event loop. So until the language server returns the resolved completion item, Helix is unable to respond to keypresses or other LSP messages. This is typically ok since the resolution request is fast but for some language servers this can be problematic, and ideally we shouldn't be blocking like this anyways. When receiving a `completionItem/resolve` request, the Volar server sends a `workspace/configuration` request to Helix and blocks itself on the response, leading to a deadlock. Eventually the resolve request times out within Helix but Helix is locked up and unresponsive in that window. This change resolves the completion item without blocking the compositor.
* Popup scrollbar (#4449)Manos Mertzianis2022-11-15
| | | | | | | | | | | | | | | * init * cargo fmt * optimisation of the scrollbar render both for Menu and Popup. Toggling off scrollbar for Popup<Menu>, since Menu has its own * rendering scroll track * removed unnecessary cast * improve memory allocation * small correction
* Resolve a bunch of upcoming clippy lintsBlaž Hrastnik2022-11-04
|
* feat(lsp): LSP preselected items appear first in completion menu (#4480)lazytanuki2022-10-27
| | | | | * feat(lsp): LSP preselected items appear first in completion menu * fix: shorter diff
* lsp: Resolve completion items missing documentation on idle (#4406)Michael Davis2022-10-22
| | | | | | | | Some language servers may not send the `documentation` field if it is expensive to compute. Clients can request the missing field with a completionItem/resolve request. In this change we use the idle-timeout event to ensure that the current completion item is resolved.
* never sort menu items when no fuzzy matching is possiblePascal Kuthe2022-10-21
|
* sort autocompletins by fuzzy matchPascal Kuthe2022-10-21
|
* sort codeaction by their kind instead of alphabeticallyPascal Kuthe2022-10-21
|
* nit: remove a String allocation that is immediately used as an &str (#4277)Poliorcetics2022-10-14
|
* Add bracketed paste (#3233)Charlie Groves2022-08-29
|
* Add custom event type replacing crossterm's Event (#3169)Gokul Soumya2022-08-09
| | | | | | | | | | Ported over from 61365dfbf3 in the `gui` branch. This will allow adding our own events, most notably an idle timer event (useful for adding debounced input in [dynamic pickers][1] used by interactive global search and workspace symbols). [1]: https://github.com/helix-editor/helix/pull/3110 Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
* Reuse menu::Item trait in picker (#2814)Gokul Soumya2022-07-02
| | | | | | | | | | | | | | | | | | | | | | | | | | * Refactor menu::Item to accomodate external state Will be useful for storing editor state when reused by pickers. * Add some type aliases for readability * Reuse menu::Item trait in picker This opens the way for merging the menu and picker code in the future, since a picker is essentially a menu + prompt. More excitingly, this change will also allow aligning items in the picker, which would be useful (for example) in the command palette for aligning the descriptions to the left and the keybinds to the right in two separate columns. The item formatting of each picker has been kept as is, even though there is room for improvement now that we can format the data into columns, since that is better tackled in a separate PR. * Rename menu::Item::EditorData to Data * Call and inline filter_text() in sort_text() completion * Rename diagnostic picker's Item::Data
* Right align scrollbar with track in completion popup (#2754)Gokul Soumya2022-06-27
| | | | | - Align the scollbar to the right edge of the popup rather than at a margin of one. - Add a scrollbar track and a new scope `ui.menu.scroll`.
* Add single width left margin for completion popup (#2728)Gokul Soumya2022-06-26
| | | | | | | | | | | | | | * Add single width left margin for completion popup * Clear with ui.menu style before rendering menu When rendering a completion popup, the popup component will clear the area with ui.popup and then the menu component would draw over it using a table component. We remove the left edge of the area before passing it to the table component (so that it will be left as padding), and the table component uses ui.menu as the style. If ui.menu and ui.popup are different the left edge of the popup will look different from the rest of the popup. We avoid this by clearing the whole area with ui.menu in Menu::render
* Fix scrollbar length proportional to total menu items (#2860)Gokul Soumya2022-06-22
| | | | | | The scrollbar length used to increase with more entries in the menu, which was counter-intuitive to how scrollbars worked in most applications. Turns out there was a typo in the floor division implementation :)
* ignore Enter keypress when menu has no selection (#1704)Michael Davis2022-02-27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * ignore Enter keypress when menu has no selection supersedes #1622 Builds on the work in #1285. I want to allow Enter to create a newline when there is no selection in the autocomplete menu. This occurs somewhat often when using LSP autocomplete in Elixir which uses `do/end` blocks (and I set the autocomplete menu delay to 0 which exacerbates the problem): ```elixir defmodule MyModule do def do_foo(x) do x end def other_function(y) do| end ``` Here the cursor is `|` in insert mode. The LSP suggests `do_foo` but I want to create a newline. Hitting Enter currently closes the menu, so I end up having to hit Enter twice when the module contains any local with a `do` prefix, which can be inconsistent. With this change, we ignore the Enter keypress to end up creating the newline in this case. * pop compositor layer when ignoring Enter keypress * move closing function out of consumed event result closure * explicitly label close_fn as an 'Option<Callback>'
* Close some popups automatically (#1285)Bram2022-02-23
| | | | | | | | | | | | | | | | | | | * Add Event::Used to use event callback without consuming * Close popup if contents ignored event * collect event results before executing callbacks * don't add new result variant, use Ignored(..) instead * break in match cases * Make auto_close configurable * fix merge * auto close hover popups * fix formatting
* ui: menu: Don't allocate scrollbar space if options fitBlaž Hrastnik2022-01-31
|
* ui: Only render menu scrollbar if it doesn't fitBlaž Hrastnik2022-01-31
|
* Render code actions as a menu, allow adding padding to popupBlaž Hrastnik2022-01-31
|
* Fix panics when resizing (#1408)Mathis Brossier2022-01-16
| | | | | | | | | | | * Change buffer.get & buffer.get_mut to return Option, Implement Trait Index & IndexMut to panic * Prevent FilePicker from drawing outside buffer (rust panics) * apply suggestion * add function in_bounds to avoid useless calculations Co-authored-by: mathis <mathis.brossier@universite-paris-saclay.fr>
* Macros (#1234)Omnikar2021-12-12
| | | | | | | | | | | | | | | | | | | | | | | | * Macros WIP `helix_term::compositor::Callback` changed to take a `&mut Context` as a parameter for use by `play_macro` * Default to `@` register for macros * Import `KeyEvent` * Special-case shift-tab -> backtab in `KeyEvent` conversion * Move key recording to the compositor * Add comment * Add persistent display of macro recording status When macro recording is active, the pending keys display will be shifted 3 characters left, and the register being recorded to will be displayed between brackets — e.g., `[@]` — right of the pending keys display. * Fix/add documentation
* fix: Normalize backtab into shift-tabBlaž Hrastnik2021-12-06
| | | | Fixes #1150
* fix: shift-tab mappings broken after efc2b4c7Blaž Hrastnik2021-11-12
|
* Refactor keyevent handling using key, ctrl macros (#1058)Gokul Soumya2021-11-10
| | | | | | Adds ctrl! and alt! macros (which existed before the big keymap refactor) and uses them in event handling of Components. Note that this converts crossterm's KeyEvent to our own KeyEvent on each invocation of handle_event in Components.
* move_up will select last item, when no item selected (#907)CossonLeo2021-10-26
|
* Add c-j c-k to menu keymap for move_up move_down (#908)CossonLeo2021-10-26
|
* Update to rust 1.56 + 2021 editionBlaž Hrastnik2021-10-22
|
* fix: If backspacing past the start offset, cancel completionBlaž Hrastnik2021-10-16
| | | | Refs #822
* ui: Trigger recalculate_size per popup render so contents can readjustBlaž Hrastnik2021-09-13
|
* Add ui.menu text style (#664)CossonLeo2021-08-28
| | | | | | | | | * add menu text style * add ui.menu.text ui.info ui.info.text to book * change ui.menu.text to ui.menu * fix book's ui.menu
* Refactor new Rect construction (#575)Gokul Soumya2021-08-21
| | | | | | | | | | * Refactor new Rect construction Introduces methods that can be chained to construct new Rects out of pre-existing ones * Clamp x and y to edges in Rect chop methods * Rename Rect clipping functions
* Show file preview in split pane in fuzzy finder (#534)Gokul Soumya2021-08-12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add preview pane for fuzzy finder * Fix picker preview lag by caching * Add picker preview for document symbols * Cache picker preview per document instead of view * Use line instead of range for preview doc * Add picker preview for buffer picker * Fix render bug and refactor picker * Refactor picker preview rendering * Split picker and preview and compose The current selected item is cloned on every event, which is undesirable * Refactor out clones in previewed picker * Retrieve doc from editor if possible in filepicker * Disable syntax highlight for picker preview Files already loaded in memory have syntax highlighting enabled * Ignore directory symlinks in file picker * Cleanup unnecessary pubs and derives * Remove unnecessary highlight from file picker * Reorganize buffer rendering * Use normal picker for code actions * Remove unnecessary generics and trait impls * Remove prepare_for_render and make render mutable * Skip picker preview if screen small, less padding
* ui: completion: Use sort_text to sort the completionsBlaž Hrastnik2021-08-11
|
* ui: menu: Allow wrapping around on ctrl-p/shift tabBlaž Hrastnik2021-08-06
|
* fix: ui/menu: Don't allow scrolling past the end of completionBlaž Hrastnik2021-07-23
| | | | Fixes #472
* Simplify ui/menu.rsBlaž Hrastnik2021-07-23
|
* Calculate completion popup sizingBlaž Hrastnik2021-07-19
| | | | Fixes #220