Commit graph

2589 commits

Author SHA1 Message Date
Nikita Revenco
6dbb09f1fa style: format mod.rs 2025-02-18 14:45:13 +00:00
Nikita Revenco
e6e80e2185 fix: remove unneeded panics 2025-02-18 14:27:11 +00:00
Nikita Revenco
a97ebc2ed0 style: format 2025-02-18 14:17:31 +00:00
Nikita Revenco
4fabd7927d refactor: remove unneeded macro 2025-02-18 14:08:16 +00:00
Nikita Revenco
24bd14863b feat: restore cursor when performing file operations 2025-02-18 14:04:10 +00:00
Nikita Revenco
9227267aa3 chore: remove TODO comment 2025-02-18 13:52:09 +00:00
Nikita Revenco
8eac1c2721 feat: refresh picker when directory operations are performed 2025-02-18 13:11:37 +00:00
Nikita Revenco
fac6c7c1a6 chore: appease clippy 2025-02-18 12:38:27 +00:00
Nikita Revenco
b6bbd4f18a fix: delete path, not confirmation e.g. y 2025-02-18 12:38:11 +00:00
Nikita Revenco
6a558be7b3 feat: better initial prompts when using file picker commands 2025-02-18 12:36:54 +00:00
Nikita Revenco
0e6e3e8aeb refactor: rename variable 2025-02-18 12:24:45 +00:00
Nikita Revenco
cd6584f0ab chore: appease clippy 2025-02-18 12:20:37 +00:00
Nikita Revenco
382803c803 feat: add confirmation prompt when overwriting 2025-02-18 12:15:35 +00:00
Nikita Revenco
e177c48208 refactor: use Option<Result> to indicate if a status message should not be changed 2025-02-18 11:42:03 +00:00
Nikita Revenco
a099ae1dbe style: formatting 2025-02-18 11:33:01 +00:00
Nikita Revenco
eafd8ace18 style: formatting 2025-02-18 11:28:30 +00:00
Nikita Revenco
eecabdbeb5 feat: pass context to all callbacks in file operations 2025-02-18 11:16:15 +00:00
Nikita Revenco
7fd7b7274a feat: implement copy path of selected item 2025-02-18 11:11:02 +00:00
Nikita Revenco
b3d0f16276 feat: use display method on paths 2025-02-18 10:48:38 +00:00
Nikita Revenco
835cda11f1 refactor: variable renaming 2025-02-18 10:27:58 +00:00
Nikita Revenco
a96841dac1 feat: implement copying 2025-02-17 23:54:37 +00:00
Nikita Revenco
469115e5ee feat: implement delete files 2025-02-17 23:46:04 +00:00
Nikita Revenco
f59c5966f6 feat: implement creating new files and directory 2025-02-17 23:37:58 +00:00
Nikita Revenco
2eef82e4df feat: implement basic callback functions for prompt operarions 2025-02-17 23:08:17 +00:00
Nikita Revenco
7dc631de9a chore: allow macro to destructure 2025-02-17 22:24:13 +00:00
Nikita Revenco
43f40d318f chore: add TODO comments 2025-02-17 22:08:31 +00:00
Nikita Revenco
d5fb7b2999 refactor: improve the declare_key_handlers macro 2025-02-17 21:54:45 +00:00
Nikita Revenco
5d29a175f3 refactor: utility macro to declare multiple handlers with ease 2025-02-17 21:41:23 +00:00
Nikita Revenco
9a28d4fa42 feat: create operations for create, delete, copy, rename in file explorer 2025-02-17 21:22:51 +00:00
Nikita Revenco
f4e5c26112 feat: figure out how to pass custom callback function set by keymap to picker 2025-02-17 21:09:04 +00:00
Nikita Revenco
87b5bd58bc feat: add API to register additional hooks with Pickrs 2025-02-17 20:53:14 +00:00
Michael Davis
62625eda46
LSP: Move diagnostic handling from Application to Editor
There is no functional change to the move - it's just moving the code
into helix-view under a new method `Editor::handle_lsp_diagnostics` -
thought there is a typo fix, the removal of an unnecessary clone (for
the document's language config) and the removal of some nesting.

Co-authored-by: Sofus Addington <sofus@addington.dk>
2025-02-04 10:39:42 -05:00
Michael Davis
066e938ba0
Add copy_between_registers for interactive register copying 2025-02-02 20:49:25 -05:00
Michael Davis
e882a750ea
commands: Eagerly clear autoinfo in select_register, insert_register
This causes the infobox to disappear even when you type a non-character
key like escape. For example `"<esc>` now clears the infobox where
before it was left hanging.
2025-02-02 20:45:25 -05:00
Michael Davis
70d452db3e
core: Make completion item documentation optional
Path completion items always have documentation but future core (i.e.
non-LSP) completions may not always have documentation - for example
word completion from the current buffer.
2025-02-01 21:24:25 -05:00
Michael Davis
369f2bb93d
ui: Expose the 'prompt' module
The prompt Completion type alias is otherwise private. This will be
used in <https://redirect.github.com/helix-editor/helix/pull/12527>
to refactor some functions to return prompt completions.
2025-02-01 21:12:20 -05:00
Pascal Kuthe
5c1f3f814f
implement incomplete completion requests 2025-02-01 19:36:10 -05:00
Michael Davis
1ab35ade2d
minor: Move CompletionEvent to a new completion handler module
Completions are not specific to LSP anymore. In the child commits we
will expand on the types in this module so this refactor is done
eagerly to minimize changes later.
2025-02-01 19:32:37 -05:00
Pascal Kuthe
018081a5b1
core: Add a provider type to track the origin of a completion 2025-02-01 19:32:37 -05:00
Michael Davis
5532ef35d9
LSP: Remove future wrapper from Client::notify, Client::reply
Previously LSP notifications were sent within a future and most callers
used a `tokio::spawn` to send the notification, silently discarding any
failures like problems serializing parameters or sending on the channel.
It's possible that tokio could schedule futures out of intended order
though which could cause notifications where order is important, like
document synchronization, to become partially shuffled. This change
removes the future wrapper and logs all internal failures.

Also included in this commit is the same change for `Client::reply`
which was also unnecessarily wrapped in a future.

Co-authored-by: Pascal Kuthe <pascalkuthe@pm.me>
2025-02-01 19:32:37 -05:00
Michael Davis
e9c16b7fc5
Use typable command doc when keybind provides no arguments
This improves the display of the keymap popup for example, so that if
you bind a key like `C-x = ":buffer-close"` under the `<space>` menu,
the infobox shows "Close the current buffer." rather than `:buffer-close
[]`.
2025-02-01 09:10:04 -05:00
Michael Davis
8439ce5683
Hover UI: Eagerly convert hover response to Markdown
This simplifies the hover component by eagerly converting all
`lsp::Hover` responses into `Markdown`s. Previously we cached the
current `Markdown` and created a new `Markdown` when switching the
active response. Instead we can consume the `lsp::Hover` and avoid some
clones of its inner types.
2025-01-31 17:34:56 -05:00
Michael Davis
47f84d04ea
Set a statusline error for formatter errors in :format 2025-01-31 14:07:22 -05:00
Michael Davis
2367b20318
Remove popup_border calculations from LSP Hover UI component
The Hover component is used as the inner contents of a Popup. The Popup
should be doing calculations based on whether popup_borders is
configured and not Hover. This fixes an issue with hover rendering when
the popup border option is enabled for popups.

Fixes #12742
2025-01-31 12:01:33 -05:00
renshyle
80dbe030a1
Do not record keys pressed by macros while recording a macro (#12733)
Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
2025-01-30 18:14:04 -06:00
Michael Davis
d285a8a9e5
LSP: Fix option handling in goto definition/references commands
The language server may return `None` for a definition/reference
request. The parent commits introduced a regression for these commands
when a server did not provide locations. With this change a server may
respond with `null` and its locations will instead not be considered.

Fixes #12732
2025-01-30 11:59:02 -05:00
Michael Davis
1a821ac726
LSP: Support multiple langauge servers for goto references
This refactors goto_reference like the parent commit to query all
language servers supporting the feature.
2025-01-30 10:37:01 -05:00
Michael Davis
f7394d53fd
LSP: Support multiple language servers for goto definition
This covers all goto-definition-like commands: declaration, definition,
type definition and implementation.

Closes #11689

Co-authored-by: j <junglerobba@jngl.one>
2025-01-30 10:36:03 -05:00
Michael Davis
ba116b47a0
LSP commands: Move offset encoding onto the Location type
<https://github.com/helix-editor/helix/pull/11486> introduced a Location
type in the LSP commands module which unified helpers like
`jump_to_location`. This change moves `OffsetEncoding` onto that type.

`SymbolInformationItem` and `PickerDiagnostic` already had fields for
carrying the offset encoding. We would want a similar setup for goto
definition/references as well (for supporting multiple language servers
with that feature) but those use the `Location` type. By moving
`OffsetEncoding` onto `Location` we make future changes to allow
mulitple language servers possible for goto definition/references
features and also simplify some calls for symbols and diagnostics.
2025-01-29 17:25:12 -05:00
Michael Davis
c9dc940428
Fix byte/char indexing mix-up in path completion
The positions passed to `Transaction::change_by_selection` should be
character indexes. `edit_diff` is meant to track the number of
characters that should be deleted to erase the file name that has been
typed so far (if any). Mistakenly this was using `str::len` which is
the byte count. This fixes a bug that could cause more text to be
deleted than intended or a panic when completing a directory with
multi-byte characters like 'éclair'.

This change also moves the `edit_diff` binding out of the loop since
it's now performing some non-trivial work (counting characters, where
before it was just accessing the pre-computed number of bytes).
2025-01-29 10:05:21 -05:00