Commit graph

5956 commits

Author SHA1 Message Date
dependabot[bot]
884b53c767
build(deps): bump the rust-dependencies group with 3 updates (#11194)
Bumps the rust-dependencies group with 3 updates: [thiserror](https://github.com/dtolnay/thiserror), [open](https://github.com/Byron/open-rs) and [cc](https://github.com/rust-lang/cc-rs).


Updates `thiserror` from 1.0.61 to 1.0.62
- [Release notes](https://github.com/dtolnay/thiserror/releases)
- [Commits](https://github.com/dtolnay/thiserror/compare/1.0.61...1.0.62)

Updates `open` from 5.2.0 to 5.3.0
- [Release notes](https://github.com/Byron/open-rs/releases)
- [Changelog](https://github.com/Byron/open-rs/blob/main/changelog.md)
- [Commits](https://github.com/Byron/open-rs/compare/v5.2.0...v5.3.0)

Updates `cc` from 1.0.106 to 1.1.5
- [Release notes](https://github.com/rust-lang/cc-rs/releases)
- [Changelog](https://github.com/rust-lang/cc-rs/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/cc-rs/compare/cc-v1.0.106...cc-v1.1.5)

---
updated-dependencies:
- dependency-name: thiserror
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: rust-dependencies
- dependency-name: open
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: rust-dependencies
- dependency-name: cc
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: rust-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-16 12:28:41 +09:00
Masanori Ogino
6b947518c6
Regenerate documentation (#11196) 2024-07-16 12:27:45 +09:00
jyn
b0cf86d31b
add :edit and :e as aliases for :open (#11186)
Vim supports these, and i can't think of any reason helix would want to have a different meaning for `:edit` than `:open`.

docs: https://vimhelp.org/editing.txt.html#%3Aedit
2024-07-15 21:39:05 +02:00
Blaž Hrastnik
107cdf3e43
Merge pull request #6417 from pascalkuthe/inline-diagnostics 2024-07-16 00:28:34 +09:00
Pascal Kuthe
386fa371d7
gracefully handle lack of tokio runtime 2024-07-15 16:36:33 +02:00
Pascal Kuthe
7283ef881f
only show inline diagnostics after a delay 2024-07-15 16:36:29 +02:00
Pascal Kuthe
d8a115641d
fix scrolling/movement for multiline virtual text 2024-07-15 16:35:31 +02:00
Pascal Kuthe
a17b008b42
ignore empty virtual text layers 2024-07-15 16:35:31 +02:00
Pascal Kuthe
3abc07a79e
use correct position for cursor in doc popup 2024-07-15 16:35:31 +02:00
Pascal Kuthe
7e133167ca
remove redudant/incorrect view bound check 2024-07-15 16:35:30 +02:00
Pascal Kuthe
6d051d7084
render diagnostic inline 2024-07-15 16:35:30 +02:00
Pascal Kuthe
39b3d81abf
stable sort diagnostics to avoid flickering 2024-07-15 16:35:30 +02:00
Pascal Kuthe
839f4d758d
fix typo in doc_formatter.rs 2024-07-15 16:35:30 +02:00
Pascal Kuthe
2c0506aa96
streamline text decoration API
This commit brings the text decoration API inline with the
LineAnnotation API (so they are consistent) resulting in a single
streamlined API instead of multiple ADHOK callbacks.
2024-07-15 16:35:26 +02:00
Pascal Kuthe
9a93240d27
correctly wrap at text-width 2024-07-15 16:34:14 +02:00
Pascal Kuthe
4c7cdb8fea
Improve line annotation API
The line annotation as implemented in #5420 had two shortcomings:
* It required the height of virtual text lines to be known ahead time
* It checked for line anchors at every grapheme

The first problem made the API impractical to use in practice because
almost all virtual text needs to be softwrapped. For example inline
diagnostics should be softwrapped to avoid cutting off the diagnostic
message (as no scrolling is possible). While more complex virtual text
like side by side diffs must dynamically calculate the number of empty
lines two align two documents (which requires taking account both
softwrap and virtual text). To address this, the API has been
refactored to use a trait.

The second issue caused some performance overhead and unnecessarily
complicated the `DocumentFormatter`. It was addressed by only calling
the trait mentioned above at line breaks (instead of always). This
allows offers additional flexibility to annotations as it offers
the flexibility to align lines (needed for side by side diffs).
2024-07-15 16:34:14 +02:00
Pascal Kuthe
e15626a00a
track char_idx in DocFormatter 2024-07-15 16:34:13 +02:00
Pascal Kuthe
2023445a08
ensure highlight scopes are skipped properly 2024-07-15 16:34:13 +02:00
Pascal Kuthe
22dfad605a
implement Add/Sub for position
being able to add/subtract positions is very handy when writing rendering code
2024-07-15 16:34:10 +02:00
Blaž Hrastnik
08ee8b9443
Merge pull request #9647 from helix-editor/pickers-v2
`Picker`s "v2"
2024-07-15 23:30:58 +09:00
Michael Davis
9de5f5cefa
Picker: Highlight the currently active column
We can track the ranges in the input text that correspond to each column
and use this information during rendering to apply a new theme key that
makes the "active column" stand out. This makes it easier to tell at
a glance which column you're entering.
2024-07-15 10:03:35 -04:00
FlorianNAdam
6345b78409
Keep editor from switching to normal mode when loading a Document (#11176) 2024-07-15 22:48:37 +09:00
Michael Davis
a7777b3c11
Accept 'IntoIterator<Item = Column<T, D>>' for picker columns
This allows us to replace any `vec![..]`s of columns where all columns
are static with static slices `[..]`.
2024-07-15 09:31:33 -04:00
Michael Davis
009bbdaf8d
Picker: Reset the cursor on prompt change 2024-07-15 09:31:33 -04:00
Michael Davis
8555248b01
Accept 'IntoIterator<Item = T>' for Picker::new options
`Picker::new` loops through the input options to inject each of them, so
there's no need to collect into an intermediary Vec. This removes some
unnecessary collections. Also, pickers that start with no initial
options can now pass an empty slice instead of an empty Vec.

Co-authored-by: Luis Useche <useche@gmail.com>
2024-07-15 09:31:33 -04:00
Michael Davis
3906f6605f
Avoid allocations in Picker file preview callback
The `FileLocation` and `PathOrId` types can borrow paths rather than
requiring them to be owned. This takes a refactor of the preview
functions and preview internals within `Picker`. With this change we
avoid an unnecessary `PathBuf` clone per render for any picker with a
file preview function (i.e. most pickers).

This refactor is not fully complete. The `PathOrId` is _sometimes_ an
owned `PathBuf`. This is for pragmatic reasons rather than technical
ones. We need a further refactor to introduce more core types like
`Location` in order to eliminate the Cow and only use `&Path`s within
`PathOrId`. This is left for future work as it will be a larger refactor
almost entirely fitting into the LSP commands module and helix-core -
i.e. mostly unrelated to refactoring the `Picker` code itself.

Co-authored-by: Pascal Kuthe <pascalkuthe@pm.me>
2024-07-15 09:31:33 -04:00
Michael Davis
f4a433f855
Convert LSP URIs into custom URIs
This introduces a custom URI type in core meant to be extended later
if we want to support other schemes. For now it's just a wrapper over a
PathBuf. We use this new URI type to firewall `lsp::Url`. This was
previously done in 8141a4a but using a custom URI type is more flexible
and will improve the way Pickers handle paths for previews in the child
commit(s).

Co-authored-by: soqb <cb.setho@gmail.com>
2024-07-15 09:31:33 -04:00
Pascal Kuthe
408282097f
avoid collecting columns to a temporary vec 2024-07-15 09:31:33 -04:00
Michael Davis
6ccbfe9bdf
Request a UI redraw on Drop of an Injector
This fixes the changed files picker when used against a clean worktree
for example. Without it the running indicator does not disappear. It
also simplifies the dynamic query handler's implementation so that it
doesn't need to request a redraw explicitly.

Co-authored-by: Pascal Kuthe <pascalkuthe@pm.me>
2024-07-15 09:31:33 -04:00
Michael Davis
6492f17e7d
Add a hidden column for the global search line contents
We could expand on this in the future to have different preview modes
that you can toggle between with C-t. Currently that binding just hides
the preview but it could switch between different preview modes and in
one mode hide the path and just show the line contents.
2024-07-15 09:31:32 -04:00
Michael Davis
7b1131adf6
global_search: Suggest latest '/' register value 2024-07-15 09:31:32 -04:00
Michael Davis
1d023b05ac
Refactor global_search as a dynamic Picker 2024-07-15 09:31:32 -04:00
Michael Davis
5622db6798
Remove sym_picker helper fun
The parent commit split out the workspace symbol picker to an inline
definition so the `workspace` parameter is never passed as `true`. We
should consolidate this picker definition into the symbol_picker
function.
2024-07-15 09:31:32 -04:00
Michael Davis
9e31ba5475
Consolidate DynamicPicker into Picker
DynamicPicker is a thin wrapper over Picker that holds some additional
state, similar to the old FilePicker type. Like with FilePicker, we want
to fold the two types together, having Picker optionally hold that
extra state.

The DynamicPicker is a little more complicated than FilePicker was
though - it holds a query callback and current query string in state and
provides some debounce for queries using the IdleTimeout event.
We can move all of that state and debounce logic into an AsyncHook
implementation, introduced here as `DynamicQueryHandler`. The hook
receives updates to the primary query and debounces those events so
that once a query has been idle for a short time (275ms) we re-run
the query.

A standard Picker created through `new` for example can be promoted into
a Dynamic picker by chaining the new `with_dynamic_query` function, very
similar to FilePicker's replacement `with_preview`.

The workspace symbol picker has been migrated to the new way of writing
dynamic pickers as an example. The child commit will promote global
search into a dynamic Picker as well.
2024-07-15 09:31:32 -04:00
Michael Davis
11f809c177
Bump nucleo to v0.4.1
We will use this in the child commit to improve the picker's running
indicator. Nucleo 0.4.0 includes an `active_injectors` member that we
can use to detect if anything can push to the picker. When that count
drops to zero we can remove the running indicator.

Nucleo 0.4.1 contains a fix for crashes with interactive global search
on a large directory.
2024-07-15 09:31:32 -04:00
Michael Davis
2c9f5b3efb
Implement Error for InjectorShutdown 2024-07-15 09:31:32 -04:00
Michael Davis
53ac833efb
Replace picker shutdown bool with version number
This works nicely for dynamic pickers: we stop any running jobs like
global search that are pushing to the injector by incrementing the
version number when we start a new request. The boolean only allowed
us to shut the picker down once, but with a usize a picker can have
multiple "sessions" / "life-cycles" where it receives new options
from an injector.
2024-07-15 09:31:32 -04:00
Michael Davis
385b398808
Add column configurations for existing pickers
This removes the menu::Item implementations for picker item types and
adds `Vec<Column<T, D>>` configurations.
2024-07-15 09:31:32 -04:00
Michael Davis
c4c17c693d
Add a special query syntax for Pickers to select columns
Now that the picker is defined as a table, we need a way to provide
input for each field in the picker. We introduce a small query syntax
that supports multiple columns without being too verbose. Fields are
specified as `%field pattern`. The default column for a picker doesn't
need the `%field` prefix. The field name may be selected by a prefix
of the field, for example `%p foo.rs` rather than `%path foo.rs`.

Co-authored-by: ItsEthra <107059409+ItsEthra@users.noreply.github.com>
2024-07-15 09:31:31 -04:00
Michael Davis
f40fca88e0
Refactor Picker in terms of columns
`menu::Item` is replaced with column configurations for each picker
which control how a column is displayed and whether it is passed to
nucleo for filtering. (This is used for dynamic pickers so that we can
filter those items with the dynamic picker callback rather than nucleo.)

The picker has a new lucene-like syntax that can be used to filter the
picker only on certain criteria. If a filter is not specified, the text
in the prompt applies to the picker's configured "primary" column.

Adding column configurations for each picker is left for the child
commit.
2024-07-15 09:31:31 -04:00
Michael Davis
dae3841a75
Use an AsyncHook for picker preview highlighting
The picker previously used the IdleTimeout event as a trigger for
syntax-highlighting the currently selected document in the preview pane.
This is a bit ad-hoc now that the event system has landed and we can
refactor towards an AsyncHook (like those used for LSP completion and
signature-help). This should resolve some odd scenarios where the
preview did not highlight because of a race between the idle timeout
and items appearing in the picker.
2024-07-15 09:31:31 -04:00
Emran Ramezan
702a96d417
Update highlights.scm and injections.scm for blade.php files (#11138)
* Update highlights.scm for blade.php files

* Update injections.scm to add tree-sitter-comment injection

* Fixed the injection issues  regarding blade parameters
2024-07-15 22:29:14 +09:00
Masanori Ogino
7f77d95c79
Inject the comment grammar into Hare (#11173) 2024-07-15 22:28:23 +09:00
arcofx
1bad3b0dd4
Make format_selections respect document configuration (#11169) 2024-07-15 22:27:42 +09:00
Blaž Hrastnik
079f544260
Adjust the ruler color of the default theme 2024-07-15 01:19:09 +09:00
Michael Davis
b2cc7d8fea
Add changelog notes for 24.07 (#10731)
* Changelog 2024-05-02

checkpoint: 31273c69e0

* Changelog 2024-05-06

checkpoint: 61818996c6

* Changelog 2024-05-11

checkpoint: 00e9e5eade

* Bump version to 24.05

* Add 24.05 release to AppImage metadata

* Fix release number in changelog

Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>

* Update release numbers to 24.07

* Changelog 2024-06-15

* Changelog 2024-07-14

checkpoint: c9b484097b

* Linkify

---------

Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
2024-07-15 01:17:49 +09:00
Masanori Ogino
c9b484097b
Exclude EOL repos from the Repology badge (#11159) 2024-07-14 11:31:33 +09:00
eh
e6bf97b843
Theme: Kanagawa Dragon (#10172)
Implements the Dragon variant of the Kanagawa theme.
https://github.com/rebelot/kanagawa.nvim?tab=readme-ov-file
2024-07-14 03:01:58 +09:00
Michael Davis
44d2fc2ab3
Commit an undo checkpoint before each write (#11062)
This fixes the modification indicator when saving from insert mode with
a config such as

    [keys.insert]
    C-s = ":write"

Previously the modification indicator would be stuck showing modified
even if the buffer contents matched the disk contents when writing after
some changes in insert mode with this binding. In insert mode we do not
eagerly write undo checkpoints so that all changes made become one
checkpoint as you exit insert mode. When saving, `Document`s `changes`
`ChangeSet` would be non-empty and when there are changes we show the
buffer as modified. Then switching to normal mode would append the
changes to history, bumping the current revision past what it was when
last saved. Since the last saved revision and current revision were then
unsynced, the modification indicator would always show modified.

This matches [Kakoune's behavior]. Kakoune has a different architecture
for writes but a very similar system for history, transactions and undo
checkpoints (what it calls "undo groups"). Upon saving Kakoune creates
an undo checkpoint if there are any uncommitted changes. It does this
after the write has gone through since its writing system is different.
For our writing system it's cleaner to make the undo checkpoint before
performing the save so that the history revision increments before we
send the save event.

[Kakoune's behavior]: 80fcfebca8/src/buffer.cc (L565-L566)
2024-07-14 02:59:47 +09:00
Lukas Grassauer
35f1c2a55f
Update tree-sitter-todotxt (#11097)
Update to latest commit that allows any non-whitespace character for projects, and contexts.
2024-07-14 02:59:21 +09:00