Commit graph

3527 commits

Author SHA1 Message Date
Michael Davis
6939dd3adb Add tests for select-mode TS textobjects 2022-10-03 10:44:08 -04:00
Michael Davis
c253139790 Extend textobject selections in select mode 2022-10-03 10:44:08 -04:00
Michael Davis
032d76ccf2 Use Range::with_direction consistently 2022-10-03 10:44:08 -04:00
Michael Davis
274f2ea459 Use requested direction for new textobject selection range
This changes the behavior of operations like `]f`/`[f` to set the
direction of the new range to the direction of the action.

The original behavior was to always use the head of the next function.
This is inconsistent with the behavior of goto_next_paragraph and makes
it impossible to create extend variants of the textobject motions.

This causes a behavior change when there are nested functions. The
behavior in the parent commit is that repeated uses of `]f` will
select every function in the file even if nested. With this commit,
functions are skipped.

It's notable that it's possible to emulate the original behavior by
using the `ensure_selections_forward` (A-:) command between invocations
of `]f`.
2022-10-03 10:44:08 -04:00
A-Walrus
f3958aa1fd
Cycled to end/beginning + no more matches msgs (#3176)
* Show status msg when next/prev cycles around

* Add msg when there is no wraparound

* Cleanup code

* Change msg to "Wrapped around document"
2022-10-03 23:43:26 +09:00
Christoph Schmidler
2fac9e24e5
Inherit theme (#3067)
* Add RawTheme to handle inheritance with theme palette

* Add a intermediate step in theme loading

it uses RawTheme struct to load the original ThemePalette, so we can merge it with the inherited one.

* Load default themes via RawThemes, remove Theme deserialization

* Allow naming custom theme same as inherited one

* Remove RawTheme and use toml::Value directly

* Resolve all review changes resulting in a cleaner code

* Simplify return for Loader::load

* Add  implementation to avoid extra step for loading of base themes
2022-10-03 23:34:29 +09:00
A-Walrus
57dc5fbe3a
Show "Invalid regex" message on enter (Validate) (#3049)
* Show "Invalid regex" message on enter (Validate)

* Reset selection on invalid regex

* Add popup for invalid regex

* Replace set_position with position

* Make popup auto close
2022-10-03 23:33:48 +09:00
Joe
bcba5d67f9
Add goto preview (#2982) 2022-10-03 23:33:20 +09:00
David
18f6ec7a8e
Update treesitter markdown (#4078)
* Update treesitter markdown

* Update inline and add table injections
2022-10-03 23:14:16 +09:00
Matt Freitas-Stavola
9d1793c45b
Add pseudo_pending for t/T/f/F (#4062) 2022-10-02 14:32:30 -05:00
Kirawi
8c2cc43017
diff full-doc LSP edits (#4041)
Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
2022-10-02 14:23:23 -05:00
nuid32
6caa7a7f56
Onedarker theme: some improvements (#4069) 2022-10-02 11:19:55 -05:00
nuid32
5b5f1bd39a
Adjust light-gray in onedarker theme (#4060) 2022-10-01 10:37:18 -05:00
zensayyy
c9584251f3
Ensure cursor in view after format (#4047)
Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
2022-10-01 09:32:09 -05:00
Roberto Vidal
cc257e9bf9
Add support for webassembly text format (#4040) 2022-10-01 09:13:52 -05:00
nuid32
2113b1bb2f
themes: Add onedarker (#3980) 2022-10-01 09:11:15 -05:00
Chickenkeeper
60aa7d3607
WGSL syntax highlighting fix (#3996) 2022-09-30 17:43:07 -05:00
Maximilian Muecke
8a7a6e4cff
Add comment injection for R (#4031) 2022-09-29 13:11:45 -05:00
joleaf
c4aec0a5c5
tutor: missing <ESC> before removing the second cursor (#4027)
This step was missing in section 5.2 of tutor.
2022-09-29 11:02:55 -04:00
Sora
038ad6289f
Fix tutor typo favourite to favorite (#4007) 2022-09-28 18:50:24 -05:00
Sven-Hendrik Haase
5dbca0fc08
Add gruvbox dark (#3948)
* Add gruvbox dark

* fixup! Add gruvbox dark
2022-09-28 22:50:53 +08:00
Erin Kim
bdc7b35214
nix: replace runCommandNoCC with runCommand (#3992) 2022-09-27 08:01:58 -05:00
dependabot[bot]
8fc493137d
build(deps): bump serde from 1.0.144 to 1.0.145 (#3989)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-09-26 18:43:30 -05:00
dependabot[bot]
cc0018a7d3
build(deps): bump thiserror from 1.0.35 to 1.0.36 (#3991)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-09-26 18:43:14 -05:00
dependabot[bot]
e3fbeeb789
build(deps): bump unicode-general-category from 0.5.1 to 0.6.0 (#3990)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-09-26 18:36:40 -05:00
Jacob Chandler
90468ad6c5
fix: Improve JSX and TSX tag highlighting (#3973) 2022-09-26 18:27:54 -05:00
dependabot[bot]
d2bb7f5a09
build(deps): bump tokio-stream from 0.1.9 to 0.1.10 (#3988)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-09-26 18:22:48 -05:00
dependabot[bot]
fd4cdf0b1f
build(deps): bump once_cell from 1.14.0 to 1.15.0 (#3987)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-09-26 18:19:50 -05:00
Oskar Köök
98dd9c4f2b
Remove do_block from Ruby indents (#3976)
`do_block` and `block` seem to conflict, causing double-indentation in some cases. Removing `do_block` does not seem to have any negative effect, while fixing the double-indentation issue.
2022-09-26 13:04:32 -04:00
Oskar Köök
c196a90684
Add documentation for max-line-length (#3974) 2022-09-26 07:56:07 -05:00
Poliorcetics
e8f0886b21
chore: remove unneeded attribute after MSRV bump to 1.61 (#3961) 2022-09-25 08:12:33 -05:00
Clay
1a4a9b86d7
heex: upgrade grammar, add roots matching elixir (#3959) 2022-09-25 15:51:25 +09:00
Invader Zim
42e30e7afa
Add bufferline colors to 15 themes (#3881)
Themes:

* acme
* ayu_dark
* ayu_light
* ayu_mirage
* base16_default_dark
* base16_default_light
* bogster
* catppuccin_frappe
* catppuccin_latte
* catppuccin_macchiato
* catppuccin_mocha
* darcula
* dark_plus
* doom_acario_dark
* emacs
2022-09-23 14:32:37 -05:00
adrian5
0d8d8a4ed6
docs: Punctuation on tutor (#3888) 2022-09-23 12:01:41 -05:00
Riccardo Binetti
3a245fe792
Add mix.exs and mix.lock as Elixir root markers (#3917) 2022-09-23 11:40:16 -05:00
Riccardo Binetti
888f4fef6f
Split helix_core::find_root and helix_loader::find_local_config_dirs (#3929)
* Split helix_core::find_root and helix_loader::find_local_config_dirs

The documentation of find_root described the following priority for
detecting a project root:
- Top-most folder containing a root marker in current git repository
- Git repository root if no marker detected
- Top-most folder containing a root marker if not git repository detected
- Current working directory as fallback

The commit contained in https://github.com/helix-editor/helix/pull/1249
extracted and changed the implementation of find_root in find_root_impl,
actually reversing its result order (since that is the order that made
sense for the local configuration merge, from innermost to outermost
ancestors).

Since the two uses of find_root_impl have different requirements (and
it's not a matter of reversing the order of results since, e.g., the top
repository dir should be used by find_root only if there's not marker in
other dirs), this PR splits the two implementations in two different
specialized functions.

In doing so, find_root_impl is removed and the implementation is moved
back in find_root, moving it closer to the documented behaviour thus
making it easier to verify it's actually correct

* helix-core: remove Option from find_root return type

It always returns some result, so Option is not needed
2022-09-23 17:04:07 +09:00
Pascal Kuthe
4133f1f424
Document MSRV policy (#3913) 2022-09-23 15:58:00 +09:00
A-Walrus
eb6fd283dc
Deduplicate regexes in search_selection command (#3941) 2022-09-22 23:33:30 +08:00
Henrik Tjäder
e621848d07
Theme: Papercolor: Tune inactive statusline (#3938) 2022-09-22 07:28:05 -05:00
Michael Davis
6e168b5099
Improve keymap errors from command typos (#3931)
* Improve keymap errors from command typos

Currently, opening helix with a config containing a bad command mapping
fails with a cryptic error. For example, say we have a config (bad.toml)
with a command name that doesn't exist:

    [keys.normal]
    b = "buffer_close" # should be ":buffer-close"

When we `hx -c bad.toml`, we get...

> Bad config: data did not match any variant of untagged enum KeyTrie for key `keys.normal` at line 1 column 1
> Press <ENTER> to continue with default config

This is because of the way that Serde tries to deserialize untagged
enums such as `helix_term::keymap::KeyTrie`. From the Serde docs[^1]:

> Serde will try to match the data against each variant in order and the
> first one that deserializes successfully is the one returned.

`MappableCommand::deserialize` fails (returns an Err variant) when a
command does not exist. Serde interprets this as the `KeyTrie::Leaf`
variant failing to match and declares that the input data doesn't
"match any variant of untagged enum KeyTrie."

Luckily the variants of KeyTrie are orthogonal in structure: we can tell
them apart by the type hints from a `serde:🇩🇪:Visitor`. This change
uses a custom Deserialize implementation along with a Visitor that
discerns which variant of the KeyTrie applies. With this change, the
above failure becomes:

> Bad config: No command named 'buffer_close' for key `keys.normal.b` at line 2 column 5
> Press <ENTER> to continue with default config

We also provide more explicit information about the expectations on
the field. A config with an unexpected type produces a message with
that information and the expectation:

    [keys.normal]
    b = 1

> Bad config: invalid type: integer `1`, expected a command, list of commands, or sub-keymap for key `keys.normal.b` at line 2 column 5
> Press <ENTER> to continue with default config

[^1]: https://serde.rs/enum-representations.html#untagged

* Update helix-term/src/keymap.rs

Co-authored-by: Ivan Tham <pickfire@riseup.net>

Co-authored-by: Ivan Tham <pickfire@riseup.net>
2022-09-22 09:30:42 +08:00
gavincrawford
1dd1476a9e
Fix highlighting on single-character Rust consts (#3927)
Co-authored-by: Kirawi <67773714+kirawi@users.noreply.github.com>
Co-authored-by: Gavin Crawford <gavincrawford@users.noreply.github.com>
2022-09-21 17:55:28 -05:00
taupiqueur
75362dce83
Fix the picker’s keymap documentation (#3925) 2022-09-21 13:51:48 -05:00
Benedikt Müller
5467c65f82
fix fish completions for --config & --log (#3912) 2022-09-20 07:35:00 -05:00
Filipe Azevedo
385ccdfc9c
add :lsp-restart command (#3435) 2022-09-20 16:44:36 +09:00
Joe
aa00a470f3
Fix preview bug (#3644)
* Fix preview bug

* Add comment to empty case
2022-09-20 16:40:48 +09:00
Blaž Hrastnik
1df32c917c diagnostics: Use Vec<Tag> instead of Option<Vec<Tag>> 2022-09-20 16:28:00 +09:00
Luke Cycon
64b0745413
Track source and tags in diagnostics (#3898) 2022-09-20 16:21:15 +09:00
Tobias Hunger
130793dfd0
Add command line parameter to specify log file (#3807)
* Add command line parameter to specify log file

I had the logs of my debug helix mixed in with the logs from the
production helix.

Add a `--log` command line argument to redirect any logs to other
files, making my debugging easier :-)

* Update completion files with `--log` argument
2022-09-20 16:11:30 +09:00
Michael Davis
8988c1ecc7
Re-sort diagnostics after transaction transform (#3895)
Applying document-change transactions to diagnostic ranges is not stable
with respect to the ordering of diagnostics. This can cause diagnostics
to become temporarily unordered with some edits to a document, which can
eventually break some invariants/assumptions in syntax::merge.

With this change, Document::diagnostics are always sorted.
2022-09-20 16:08:58 +09:00
dependabot[bot]
947ff63e6d
build(deps): bump textwrap from 0.15.0 to 0.15.1 (#3906)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-09-19 18:29:00 -05:00