| Commit message (Collapse) | Author | Age |
|
|
|
|
|
|
| |
If the new results shown by the picker select a file that hasn't been
previewed before, the idle timeout would not trigger highlighting on
that file. With this change, we reset the idle timeout and allow that
file to be highlighted on the next idle timeout event.
|
|
|
|
|
|
| |
This change uses the idle-timeout event to trigger fetching new results
in the DynamicPicker, so idle-timeout becomes a sort of debounce. This
prevents querying the language server overly aggressively.
|
|
|
|
|
|
|
|
|
|
|
| |
Most language servers limit the number of workspace symbols that
are returned with an empty query even though all symbols are
supposed to be returned, according to the spec (for perfomance
reasons). This patch adds a workspace symbol picker based on a
dynamic picker that allows re-requesting the symbols on every
keypress (i.e. when the picker query text changes). The old behavior
has been completely replaced, and I have only tested with
rust-analyzer so far.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The error messages for a theme that failed to be deserialized (or
otherwise failed to load) were covered up by the context/with_context
calls:
* The log message for a bad theme configured in config.toml would only
say "Failed to deserilaize theme"
* Selecting a bad theme via :theme would show "Theme does not exist"
With these changes, we let the TOML deserializer errors bubble up, so
the error messages can now say the line number of a duplicated
key - and that key's name - when a theme fails to load because of a
duplicated key.
Providing a theme which does not exist to :theme still gives a helpful
error message: "No such file or directory."
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Reset mode when changing buffers
This is similar to the change in
e4c9d4082a139aac3aea4506918171b96e81f5b9: reset the editor to normal
mode when changing buffers. Usually the editor is already in normal
mode but it's possible to setup insert-mode keybindings that change
buffers.
* Move normal mode entering code to Editor
This should be called internally in the Editor when changing documents
(Editor::switch) or changing focuses (Editor::focus).
|
| |
|
| |
|
|
|
|
| |
Pass client name ('helix') and client version (version / git hash)
to LSP server on initialization.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* add command and keybding to jump to next/prev hunk
* add textobject for change
* Update helix-vcs/src/diff.rs
Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
* select entire hunk instead of first char
* fix selection range
Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
|
|
|
|
|
|
|
|
|
| |
* Add `View::ensure_cursor_in_view_center` to adjust view after searching and jumping
Also `offset_coodrs_to_in_view` was refactored to reduce duplicated position calculations.
* Fix a wrong offset calculation in `offset_coords_to_in_view_center`
It ignored `scrolloff` if `centering` is false.
|
|
|
|
|
|
|
|
| |
Completion edits - either basic `insert_text` strings or structured
`text_edit`s - are assumed by the LSP spec to apply to the current
cursor (or at least the trigger point). We can use the range (if any)
and text given by the Language Server to create a transaction that
changes all ranges in the current selection though, allowing auto-
complete to affect multiple cursors.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Change default TS object bindings
Changes 'match inside/around' bindings for:
- type definition from `c` to `t`
- comments from `o` to `c`
- tests from `t` to `T`
Also changes those for the `]` / `[` bindings.
* Update docs for changed keybinds
Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Show (git) diff signs in gutter (#3890)
Avoid string allocation when git diffing
Incrementally diff using changesets
refactor diffs to be provider indepndent and improve git implementation
remove dependency on zlib-ng
switch to asynchronus diffing with similar
Update helix-vcs/Cargo.toml
fix toml formatting
Co-authored-by: Ivan Tham <pickfire@riseup.net>
fix typo in documentation
use ropey reexpors from helix-core
fix crash when creating new file
remove useless use if io::Cursor
fix spelling mistakes
implement suggested improvement to repository loading
improve git test isolation
remove lefover comments
Co-authored-by: univerz <univerz@fu-solution.com>
fixed spelling mistake
minor cosmetic changes
fix: set self.differ to None if decoding the diff_base fails
fixup formatting
Co-authored-by: Ivan Tham <pickfire@riseup.net>
reload diff_base when file is reloaded from disk
switch to imara-diff
Fixup formatting
Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
Redraw buffer whenever a diff is updated.
Only store hunks instead of changes for individual lines to easily allow
jumping between them
Update to latest gitoxide version
Change default diff gutter position
Only update gutter after timeout
* update diff gutter synchronously, with a timeout
* Apply suggestions from code review
Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
* address review comments and ensure lock is always aquired
* remove configuration for redraw timeout
Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
|
| |
|
|
|
|
| |
This reverts commit fd00f3a70eb626242bb2fcc9bddf2c4d94580a9a.
|
| |
|
| |
|
|
|
|
|
|
| |
This matches the insert-mode behavior for Vim and Kakoune: if the
current line is empty except for whitespace, `<ret>` should insert a
line ending at the beginning of the line, moving any indentation to the
next line.
|
| |
|
|
|
|
|
|
|
|
| |
When using undo/redo, the history revision can be decremented. In that
case we should apply the inversions since the given revision in
History::changes_since. This prevents panics with jumplist operations
when a session uses undo/redo to move the jumplist selection outside
of the document.
|
|
|
|
|
|
| |
View::apply should only be called by EditorView after
42e37a571e75aaf4feb1717dfebe8cf215e535dd. This change removes the
duplicate calls within undo/redo which could cause a panic.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Add a test case for updating jumplists across windows
* Apply transactions to all views on history changes
This ensures that jumplist selections follow changes in documents, even
when there are multiple views (for example a split where both windows
edit the same document).
* Leave TODOs for cleaning up View::apply
* Use Iterator::reduce to compose history transactions
Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Language Servers may signal that they do not support a method in
the initialization result (server capabilities). We can check these
when making LSP requests and hint in the status line when a method
is not supported by the server. This can also prevent crashes in
servers which assume that clients do not send requests for methods
which are disabled in the server capabilities.
There is an existing pattern the LSP client module where a method
returns `Option<impl Future<Output = Result<_>>>` with `None` signaling
no support in the server. This change extends this pattern to the rest
of the client functions. And we log an error to the statusline for
manually triggered LSP calls which return `None`.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Previously, jumplists could grow unchecked. Every transaction is
applied to jumplist selections to ensure that they are up to date
and within document bounds, so this would cause every edit to become
more expensive as jumplist lengths increased throughout a session.
Setting a maximum number of entries limits the cost.
Vim and Neovim limit their jumplists:
* https://github.com/vim/vim/blob/b298fe6cbae3b240b10dbd55d9c38d0cc8e033d3/src/structs.h#L141
* https://github.com/neovim/neovim/blob/e8cc489accc435076afb4fdf89778b64f0a48473/src/nvim/mark_defs.h#L57
Notably, Kakoune does not. In Kakoune, changes are applied to jumplist
entries lazily as you hit `<C-o>`/`<C-i>` though, so Kakoune doesn't
have the same growing cost concerns. Kakoune also does not have a
concept of a View which limits the cost further.
Vim and Neovim limit to 100. This seems unreasonably high to me so I've
set this to 30 to start. We can increase if this is problematically
low.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
d6323b7cbc21a9d3ba29738c76581dad93f9f415 changed the behavior of paste
to select the newly inserted text. This is preferrable in normal mode
because it's useful to be able to act on the new text. This behavior
is worse for insert or select mode though:
* In insert mode, the cursor ends up on the last character of the newly
selected text, so further typing inserts text before the last
character.
* In select mode, the current selection is replaced with the new text
selection which doesn't extend the current selection. With this
change, the selection is extended to include the new text.
This aligns the behavior more closely with Kakoune, but it's
coincidental instead of intentional: Kakoune doesn't implement
bracketed paste (AFAIK) which causes this behavior in insert mode,
and Kakoune doesn't have a select mode.
|
| |
|
| |
|
|
|
|
|
| |
Previously, commands such as `r<tab>` (replace with tab) or `t<tab>`
(select till tab) had no effect. This is because `KeyCode::Tab` needs
special treatment (like `KeyCode::Enter`).
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This change handles a language server exiting. This was a UX sore-spot:
if a language server crashed, Helix did not recognize the exit and
continued to send requests to it. All requests would timeout since they
would not receive responses. This would also hold-up Helix closing
itself down since it would try to gracefully shutdown the server which
is implemented in the LSP spec as a request.
We could attempt to automatically restart the language server on crash.
I left this for future work since that change will need to be slightly
complicated: it will need to cover the case of a language server
repeatedly crashing.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
| |
Co-authored-by: Austen Adler <agadler@austenadler.com>
|
|
|
|
|
|
|
|
|
| |
PR #4134 switched the autocomplete menu from alphabetical to fuzzy
sorting. This commit removes the still existing filtering by prefix and
should enable full fuzzy sorting of the autocomplete menu.
closes #3084, #1807
Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This fixes an edge case for completing shellwords. With a file
"a b.txt" in the current directory, the sequence `:open a\<tab>`
will result in the prompt containing `:open aa\ b.txt`. This is
because the length of the input which is trimmed when replacing with
completion is calculated on the part of the input which is parsed by
shellwords and then escaped (in a separate operation), which is lossy.
In this case it loses the trailing backslash.
The fix provided here refactors shellwords to track both the _words_
(shellwords with quotes and escapes resolved) and the _parts_ (chunks
of the input which turned into each word, with separating whitespace
removed). When calculating how much of the input to delete when
replacing with the completion item, we now use the length of the last
part.
This also allows us to eliminate the duplicate work done in the
`ends_with_whitespace` check.
|
|
|
|
|
| |
The text within the command palette used a custom format to display
the keybinding for a command. This change switches to the key sequence
format that we use for pending keys and macros.
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
| |
* Add command to add word boundaries to search
* Calculate string capacity before building
|