Commit graph

6342 commits

Author SHA1 Message Date
Remo Senekowitsch
de11273857
Document installation of rust-analyzer via rustup (#12618) 2025-02-01 19:43:20 -06:00
Pascal Kuthe
5c1f3f814f
implement incomplete completion requests 2025-02-01 19:36:10 -05:00
Pascal Kuthe
4e0fc0efc6
Add a completion handler type in helix-view for tracking responses
This will replace the `Sender<CompletionEvent>` in the child commits.
It tracks sender alongside extra metadata about the responses received
from providers - namely whether a request is incomplete or not - which
can be reused between subsequent requests to the provider.
2025-02-01 19:35:58 -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
f0fa905622
LSP: Eagerly send requests in Client::request
This is a similar change to the parent commit but for `request`. The
requests should be sent eagerly so that the ordering stays consistent.

Co-authored-by: Pascal Kuthe <pascalkuthe@pm.me>
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
Pascal Kuthe
0ea401d2d7
Use the slotmap workspace dependency in helix-view
This workspace dependency is already used in `helix-core` and
`helix-lsp`. This change uses it in `helix-view` as well for
consistency.
2025-02-01 19:32:23 -05:00
uncenter
e70f8833e2
Highlight $ template literals as shell commands (#12751) 2025-02-01 18:18:08 -06:00
Kristoffer Plagborg Bak Sørensen
30616344d7
Recognize .sublime-* files (#12750) 2025-02-01 17:44:06 -06:00
rhogenson
17ffa38a5a
Use the first char in a grapheme for classification (#12483)
Co-authored-by: Rose Hogenson <rosehogenson@posteo.net>
2025-02-01 17:09:45 -06:00
Michael Davis
c3620b7116
Join input and wait tasks in external formatter Tokio command
This matches the layout of `shell_impl_async` in `commands.rs` and
avoids a hang or maybe deadlock in `to_writer`'s calls to
`tokio::io::AsyncWriteExt::write_all`. I don't really understand the
underlying cause of the hang but it seems it's necessary to spawn a
new tokio task to provide input to stdin. This is shown in an example
in `tokio::process::Child::wait` but not documented explicitly.
2025-02-01 10:58:03 -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
Nikita Revenco
6edff24c81
fix: add comment token for svelte files (#12743)
Co-authored-by: Nikita Revenco <154856872+NikitaRevenco@users.noreply.github.com>
2025-01-31 15:13:09 -06: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
Michael Davis
28047fed7f
config: Deny unknown fields in [editor.smart-tab]
Previously a typo like "enabled" would silently be discarded. Instead
we should error when a field is configured which doesn't exist.

Fixes #12739
2025-01-31 08:34:30 -05:00
RoloEdits
025719c1d8
perf(ropey): enable simd feature for stdx (#12735) 2025-01-30 19:51:34 -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
John Kelly
6906164177
Properly prevent crossterm features being used when feature = "term" not enabled in helix-view (#12734) 2025-01-30 17:38:07 -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
Gareth Widlansky
8328c422b7
Add ghostty configuration support (#12703) 2025-01-29 08:56:08 -06:00
0xLucqs
6049f2035b
chore(grammar): update cairo + queries (#12712) 2025-01-28 08:19:33 -06:00
Gabriel Dinner-David
8d6efaf350
fix zig highlight query use of #lua-match (#12708) 2025-01-28 00:19:43 -05:00
dependabot[bot]
98ddbf0086
build(deps): bump the rust-dependencies group with 2 updates (#12707)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-01-27 17:19:26 -06:00
Zi How Poh
0c8f0c0334
goto_diag: avoid wraparound by default (#12704) 2025-01-27 14:41:34 -06:00
Michael Davis
fec5101a41
DAP: Refactor handling of Event and Request protocol types
This change refactors the DAP `Event` type, the `helix_dap` module and
the `helix_dap::transport` module to be closer to the equivalent
implementations in `helix_lsp`. The DAP `Event` type is similar to LSP's
`Notification` so this change rewrites the enum as a trait which is
implemented by empty types (for example `enum Initialized {}`).

`Event` is then reintroduced as an enum in `helix_dap` with a helper
function to convert from the `Event` as the transport knows it. By
separating the definitions of `Event` between lib and transport, we can
handle incoming events which are not known to our `Event` enum. For
example debugpy sends `"debugpySockets"` which is unknown. With this
change, unknown events are discarded with an info-level log message.

The `Request` type was already a trait but did not have an enum with the
known values. This change also introduces a `helix_dap::Request` enum
similar to `helix_dap::Event`. This resolves a TODO comment about
avoiding `unwrap` when parsing the request's arguments.
2025-01-27 15:27:35 -05:00
Michael Davis
9bc63c1c59
DAP: Move module ID tests out of events module
These were mistakenly added to the events module, they should be part of
the types module.
2025-01-27 15:25:22 -05:00
Michael Davis
20151a5594
Move rope grapheme iterators from core to stdx 2025-01-27 09:24:40 -05:00
Michael Davis
51832b02c9
core: Remove unused byte index grapheme functions 2025-01-27 09:24:40 -05:00
Michael Davis
39b72329b4
stdx: Add floor/ceil/is grapheme boundary functions to RopeSliceExt
These functions are the equivalent of 23b424a46 for grapheme clusters.
In order to add the `is_grapheme_boundary` function we also need to
query whether a byte index lies on a character boundary, so this change
also adds `is_char_boundary`.
2025-01-27 09:24:40 -05:00
Michael Davis
0364521dca
goto_word: Skip keys with modifiers in both on-next-key blocks 2025-01-27 09:24:40 -05:00
Michael Davis
f5f9f499cf
goto_word: Reject jump label characters with modifiers
Previously you could use `<A-a><A-b>` to jump to a label "ab". We should
not treat characters with modifiers the same as characters without.
With this change the `<A-a>` input exits out of the jumping on-next-key.

Fixes #12695
2025-01-27 08:49:03 -05:00
Poliorcetics
b00b475dfe
just: bump grammar support to Just 1.39.0 (#12692) 2025-01-26 20:10:27 -06:00
kyfanc
9829ac0c02
Cycle through hover results from multiple language servers (#10122)
Co-authored-by: Vladyslav Karasov <36513243+cotneit@users.noreply.github.com>
Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
2025-01-26 11:24:50 -06:00
Kristoffer Plagborg Bak Sørensen
7c907e66f4
feat: print helpful suggestion when using :{,r}sort incorrectly (#12585) 2025-01-26 10:39:19 -06:00
Kristoffer Plagborg Bak Sørensen
259be07f05
feat: add asm-lsp for assembly dialects (#12684) 2025-01-26 10:28:40 -06:00
Michael Davis
360c6bb061
stdx: Replace RopeSliceExt::byte_to_next_char with ceil_char_boundary
The new `RopeSliceExt::ceil_char_boundary` from the parent commits can
be used to implement `RopeSliceExt::byte_to_next_char` when used with
`RopeSlice::byte_to_char`. That function had only one caller and that
caller will eventually disappear when we switch to Ropey v2 and drop
character indexing, so we can drop `byte_to_next_char` now and replace
its caller with `byte_to_char` plus `ceil_char_boundary`.

This change keeps the unit tests for `byte_to_next_char` and checks them
against a polyfill of `byte_to_char` plus `ceil_char_boundary` to ensure
that `byte_to_next_char`'s intended behavior is not changed.
2025-01-26 11:11:53 -05:00
Michael Davis
4919058e90
Use RopeSliceExt floor/ceil functions for goto_file_impl search cap
This is a good example use-case of the `floor_char_boundary` and
`ceil_char_boundary` functions added in the parent commit. In the
single-width, single-selection case in `goto_file` we cap the search
to either the current line or 1000 bytes before or after the cursor
(whichever case comes earlier). That byte index might not lie on a
character boundary so it needs to be fixed to either the prior or
later boundary.
2025-01-26 11:10:50 -05:00
Michael Davis
23b424a46d
stdx: Add floor/ceil char boundary functions to RopeSliceExt
These functions mimic `str::floor_char_boundary` and
`str::floor_char_boundary` (currently unstable under
`round_char_boundary`). They're useful for correcting a byte index
which may not lie on a character boundary. For example you might limit
a search within a slice to some fixed number of bytes. The fixed number
might not lie on a boundary though so it needs to be corrected to
either the earlier (floor) or later (ceil) boundary.
2025-01-26 11:10:24 -05:00
Joel Dueck
aac0ce5fd1
Update install.md: fix link to lang server install instructions (#12675) 2025-01-26 14:21:13 +09:00
Michael Davis
899afad4a6
flake: Revert update of nixpkgs 2025-01-25 13:52:14 -05:00
magackame
3fdd98979c
fix: goto_file_impl incorrect use of slice instead of byte_slice (#12673) 2025-01-25 12:38:35 -06:00
Alexis Mousset
de738bac6a
Small refinements for modus themes (#12670) 2025-01-25 20:30:43 +09:00
Darshan Kumawat
81708b70e6
doc: Document mdm and mrm for popup help (#12650) 2025-01-24 11:46:19 -06:00