aboutsummaryrefslogtreecommitdiff
path: root/helix-term
Commit message (Collapse)AuthorAge
...
* Improve error message handling for theme loading failures (#5073)Michael Davis2022-12-15
| | | | | | | | | | | | | | | | | 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."
* Add `:pipe-to` typable command that ignores shell output (#4931)Alexander Schlögl2022-12-12
|
* Reset mode when changing buffers (#5072)Michael Davis2022-12-11
| | | | | | | | | | | | | | * 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).
* properly handle detachted git worktrees (#5097)Pascal Kuthe2022-12-11
|
* Fix LSP completions ignoring auto-completion option (#5042)Jummit2022-12-09
|
* feat(lsp): pass client_info on initialization (#4904)Matouš Dzivjak2022-12-09
| | | | Pass client name ('helix') and client version (version / git hash) to LSP server on initialization.
* Only write newlines in menu selection popup if the lsp returns detail (#4902)ath32022-12-09
|
* Add command/keybinding to jump between hunks (#4650)Pascal Kuthe2022-12-06
| | | | | | | | | | | | | | | * 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>
* fix: align view after jumplist_picker (#3743)Narazaki Shuji2022-12-06
| | | | | | | | | * 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.
* Apply completion edits to all cursors (#4496)Michael Davis2022-12-06
| | | | | | | | 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 (#3782)nosa2022-12-06
| | | | | | | | | | | | | | * 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>
* Fix transaction composition order in History::changes_since (#4981)Michael Davis2022-12-03
| | | | | | | | | | | * Add a undo/redo split test case for crossing branches * history: Switch up/down transaction chaining order The old code tends to work in practice because, usually, either up_txns or down_txns are empty. When both have contents though, we can run into a panic trying to compose them all since they will disagree on the length of the text. This fixes the panic test case in the parent commit.
* Add Ctrl-i alias for Windows (#4961)lesleyrs2022-12-02
|
* feat(lsp): add support for lsp Diagnostic{}.data (#4935)sigmaSd2022-12-02
|
* reload_all: Ensure view is synced with doc history before reload (#4965)Michael Davis2022-12-02
|
* Fix nightly clippy lints (#4954)Tshepang Mbambo2022-12-01
|
* Show (git) diff signs in gutter (#3890)Pascal Kuthe2022-12-01
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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>
* Add a test case for undo/redo across splitsMichael Davis2022-11-29
|
* Call View::apply within Document::append_changes_to_historyMichael Davis2022-11-29
|
* Revert "Don't apply transactions to Views in undo/redo"Michael Davis2022-11-29
| | | | This reverts commit fd00f3a70eb626242bb2fcc9bddf2c4d94580a9a.
* Remove eager application of transactions to all viewsMichael Davis2022-11-29
|
* reload-all: Only update viewport when view focuses on the doc (#4901)Filipe Azevedo2022-11-26
|
* Clear line on `<ret>` when line is all whitespace (#4854)Michael Davis2022-11-25
| | | | | | 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.
* Exit select mode on surround commands (#4858)Jonathan LEI2022-11-24
|
* Follow parent links when calculating changes since a revisionMichael Davis2022-11-24
| | | | | | The 'revisions' field on History can't be treated as linear: each Revision in the revisions Vec has a parent link and an optional child link. We can follow those to unroll the recent history.
* Apply inversions to Views on undo/redoMichael Davis2022-11-24
| | | | | | | | 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.
* Don't apply transactions to Views in undo/redoMichael Davis2022-11-24
| | | | | | 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 test case that panics on undoMichael Davis2022-11-24
| | | | | | | This case panics since undo/redo call View::apply and here, the edit that moves the jumplist selection out-of-bounds is not yet applied when View::apply is called in undo/redo. View::apply should only be called by the EditorView now.
* Apply transactions to all views (#4733)Michael Davis2022-11-23
| | | | | | | | | | | | | | | | | * 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>
* lsp: Check server provider capabilities (#3554)Michael Davis2022-11-22
| | | | | | | | | | | | | | 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`.
* remove duplicated shell calls (#3465)Bob2022-11-22
|
* Limit the number of items in the jumplist (#4750)Michael Davis2022-11-22
| | | | | | | | | | | | | | | | | | | | | 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.
* Select new pasted text in normal mode only (#4824)Michael Davis2022-11-21
| | | | | | | | | | | | | | | | | | 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.
* Add preview for scratch buffers in buffer picker (#3454)A-Walrus2022-11-21
|
* Add `:reload-all` command (#4663)Filipe Azevedo2022-11-20
|
* Make `r<tab>` and `f<tab>` work (#4817)Lennard Hofmann2022-11-19
| | | | | 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`).
* minor: render_diagnostics doesn't require &self eitherBlaž Hrastnik2022-11-19
|
* Avoid repeatedly loading configBlaž Hrastnik2022-11-19
|
* Handle language server termination (#4797)Michael Davis2022-11-19
| | | | | | | | | | | | | 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.
* 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.
* Select surrounding characters when using match/surround (m) mode (#4752)Austen Adler2022-11-18
| | | Co-authored-by: Austen Adler <agadler@austenadler.com>
* Remove prefix filtering from autocomplete menu (#4578)ChrHorn2022-11-17
| | | | | | | | | 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>
* Capture word parts while calculating shellwords (#4632)Michael Davis2022-11-17
| | | | | | | | | | | | | | | | | | | 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.
* Use key-sequence format for command palette keybinds (#4712)Michael Davis2022-11-17
| | | | | 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.
* sort fuzzy matches with equal score by length in picker (#4698)Pascal Kuthe2022-11-16
|
* minor: Simplify some command codeBlaž Hrastnik2022-11-16
|
* minor: cloning filter and using count() is wasteful hereBlaž Hrastnik2022-11-16
|
* fix buildBlaž Hrastnik2022-11-15
|
* Add command to add word boundaries to search (#4322)Armin Ronacher2022-11-15
| | | | | * Add command to add word boundaries to search * Calculate string capacity before building
* 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