Commit graph

877 commits

Author SHA1 Message Date
Kitsu
8db93013fb
fix: avoid child area overflow on split (#10620) 2024-04-29 08:18:05 -05:00
Pascal Kuthe
b834806dbc use newtype parttern for langauge server id 2024-04-22 12:27:47 +09:00
Kirawi
6d363a978d
Read symlink when writing files (#10339)
Co-authored-by: Pascal Kuthe <pascalkuthe@pm.me>
2024-04-11 20:49:16 -05:00
Michael Davis
3f2de21342
Handle partial failure when sending textDocument/didSave (#10168) 2024-04-06 13:38:51 +09:00
Tshepang Mbambo
3e2b85c61b
remove redundant imports (#10154) 2024-04-04 23:28:44 +09:00
Michael Davis
1539312558
Add a serializer for the jump alphabet config option (#10156)
Without a serializer, we drop the custom alphabet when making config
modifications like with `:set`. For example before this commit,
`:set mouse false` would reset a custom alphabet to the default.
2024-04-04 23:28:31 +09:00
Luis Useche
190fbf66d4
reconfigure tree properly after closing view (#10004)
This patch merges the last child of a container node to the parent. This
avoids the bug where uneven spaced Views would be created. To reproduce:
1. `vsplit`
2. `split`
3. `quit`
4. `vsplit`

With this patch the bug cannot be seen anymore.
2024-04-02 17:29:57 +02:00
woojiq
cc8290f393
show newest options in jumplist picker first, fix docs (#10095)
* docs: mention `<space>g` changed file picker

* picker(jumplist): show jumps in order from latest to oldest
2024-04-02 16:39:44 +02:00
Kirawi
88d455afeb
Use a temporary file for writes (#9236)
Co-authored-by: Pascal Kuthe <pascalkuthe@pm.me>
2024-03-31 17:43:09 -05:00
dependabot[bot]
3205bc4132
build(deps): bump the rust-dependencies group with 6 updates (#10007)
Bumps the rust-dependencies group with 6 updates:

| Package | From | To |
| --- | --- | --- |
| [smallvec](https://github.com/servo/rust-smallvec) | `1.13.1` | `1.13.2` |
| [arc-swap](https://github.com/vorner/arc-swap) | `1.7.0` | `1.7.1` |
| [regex](https://github.com/rust-lang/regex) | `1.10.3` | `1.10.4` |
| [indoc](https://github.com/dtolnay/indoc) | `2.0.4` | `2.0.5` |
| [rustix](https://github.com/bytecodealliance/rustix) | `0.38.31` | `0.38.32` |
| [which](https://github.com/harryfei/which-rs) | `6.0.0` | `6.0.1` |


Updates `smallvec` from 1.13.1 to 1.13.2
- [Release notes](https://github.com/servo/rust-smallvec/releases)
- [Commits](https://github.com/servo/rust-smallvec/compare/v1.13.1...v1.13.2)

Updates `arc-swap` from 1.7.0 to 1.7.1
- [Changelog](https://github.com/vorner/arc-swap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/vorner/arc-swap/commits)

Updates `regex` from 1.10.3 to 1.10.4
- [Release notes](https://github.com/rust-lang/regex/releases)
- [Changelog](https://github.com/rust-lang/regex/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/regex/compare/1.10.3...1.10.4)

Updates `indoc` from 2.0.4 to 2.0.5
- [Release notes](https://github.com/dtolnay/indoc/releases)
- [Commits](https://github.com/dtolnay/indoc/compare/2.0.4...2.0.5)

Updates `rustix` from 0.38.31 to 0.38.32
- [Release notes](https://github.com/bytecodealliance/rustix/releases)
- [Commits](https://github.com/bytecodealliance/rustix/compare/v0.38.31...v0.38.32)

Updates `which` from 6.0.0 to 6.0.1
- [Release notes](https://github.com/harryfei/which-rs/releases)
- [Changelog](https://github.com/harryfei/which-rs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/harryfei/which-rs/compare/6.0.0...6.0.1)

---
updated-dependencies:
- dependency-name: smallvec
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: rust-dependencies
- dependency-name: arc-swap
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: rust-dependencies
- dependency-name: regex
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: rust-dependencies
- dependency-name: indoc
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: rust-dependencies
- dependency-name: rustix
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: rust-dependencies
- dependency-name: which
  dependency-type: direct:production
  update-type: version-update:semver-patch
  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-03-26 12:55:58 +09:00
Quentin
614a744d24
Add narrow no-break space support (#9604) 2024-03-25 10:29:36 +09:00
Pascal Kuthe
b46064b8c4 Add an Amp-like jump command
Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
2024-03-23 15:35:25 +09:00
Pascal Kuthe
69e07ab61e use slices instead of Rc for virtual text 2024-03-23 15:35:25 +09:00
Luis Useche
6a22d7d1ca
Do not stop reloading docs on error (#9870)
In the `reload-all` command, we should not stop reloading the documents
if one error is found. Instead, we should report the error and continue
trying to reload the current open documents. This is useful in cases
where a backing file does not exist temporarily (e.g. when editing a git
patch in the outstanding chain that doesn't have a file just yet).

This change also remove the error messages in the cases where the
backing is `None`, like in new docs or `tutor`.
2024-03-19 12:16:30 +01:00
dependabot[bot]
3d4889ce9a
build(deps): bump the rust-dependencies group with 3 updates (#9929)
Bumps the rust-dependencies group with 3 updates: [bitflags](https://github.com/bitflags/bitflags), [toml](https://github.com/toml-rs/toml) and [lsp-types](https://github.com/gluon-lang/lsp-types).


Updates `bitflags` from 2.4.2 to 2.5.0
- [Release notes](https://github.com/bitflags/bitflags/releases)
- [Changelog](https://github.com/bitflags/bitflags/blob/main/CHANGELOG.md)
- [Commits](https://github.com/bitflags/bitflags/compare/2.4.2...2.5.0)

Updates `toml` from 0.8.10 to 0.8.12
- [Commits](https://github.com/toml-rs/toml/compare/toml-v0.8.10...toml-v0.8.12)

Updates `lsp-types` from 0.95.0 to 0.95.1
- [Changelog](https://github.com/gluon-lang/lsp-types/blob/master/CHANGELOG.md)
- [Commits](https://github.com/gluon-lang/lsp-types/compare/v0.95.0...v0.95.1)

---
updated-dependencies:
- dependency-name: bitflags
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: rust-dependencies
- dependency-name: toml
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: rust-dependencies
- dependency-name: lsp-types
  dependency-type: direct:production
  update-type: version-update:semver-patch
  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-03-19 15:47:05 +09:00
mo8it
e91ec8e880 Optimize getting a relative path 2024-03-19 14:39:46 +09:00
dependabot[bot]
8dc50bded9
build(deps): bump clipboard-win from 5.2.0 to 5.3.0 (#9922)
Bumps [clipboard-win](https://github.com/DoumanAsh/clipboard-win) from 5.2.0 to 5.3.0.
- [Commits](https://github.com/DoumanAsh/clipboard-win/commits)

---
updated-dependencies:
- dependency-name: clipboard-win
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-19 14:08:36 +09:00
Dan Cardamore
3890376a23
add 'file-absolute-path' to statusline (#4535)
* feat: add 'file-abs-path' to statusline (#4434)

* cleanup implementation

* rename to be non-abbreviated names

---------

Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
2024-03-17 23:55:49 +01:00
dependabot[bot]
4e5f19df53
build(deps): bump clipboard-win from 5.1.0 to 5.2.0 (#9811) 2024-03-06 11:10:24 +09:00
dependabot[bot]
7d8c86e403
build(deps): bump arc-swap from 1.6.0 to 1.7.0 (#9809) 2024-03-06 11:08:07 +09:00
Michael Davis
8141a4a1ab LSP: Key diagnostics off file path instead of URI
URIs need to be normalized to be comparable. For example a language
server could send a URI for a path containing '+' as '%2B' but we might
encode this in something like 'Document::url' as just '+'. We can
normalize the URI straight into a PathBuf though since this is the only
value we compare these diagnostics URIs against. This also covers
edge-cases like windows drive letter capitalization.
2024-02-26 00:12:43 +09:00
Jonathan LEI
cdef4f8a70
Make mouse click extend selection in select mode (#5436)
* Make mouse click extend selection in select mode

* chore: better readability with `Option::take()`
2024-02-19 14:08:26 +01:00
Matt
76e512f944
Remove unwrap on line option, preventing DAP crash (#9632)
* Remove unwrap on line option, preventing DAP crash, ref #4683

* Update to fall back to existing values for option fields
2024-02-16 15:43:14 +01:00
kyfanc
fe869e5dc7
fix lsp config reload (#9415)
`syn_loader` was replaced rather than interior value being replace,
old value was still being referenced and not updated after `:config-refresh`.
By using `ArcSwap` like for `config`, each `.load()` call will return the most
updated value.

Co-authored-by: kyfan <kyfan@email>
2024-02-13 11:58:53 +01:00
dependabot[bot]
c55bf72d25
build(deps): bump clipboard-win from 5.0.0 to 5.1.0 (#9616)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-02-13 09:57:22 +09:00
dependabot[bot]
c111e28a6f
build(deps): bump toml from 0.7.6 to 0.8.10 (#9539)
Bumps [toml](https://github.com/toml-rs/toml) from 0.7.6 to 0.8.10.
- [Commits](https://github.com/toml-rs/toml/compare/toml-v0.7.6...toml-v0.8.10)

---
updated-dependencies:
- dependency-name: toml
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-02-13 01:48:45 +09:00
Waleed Dahshan
cf4492174d
Use range positions to determine insert_newline motion (#9448)
* use anchor and head positions to determine motion

* use range cursor to decide extending or shifting

* add condition to cursor moving back on normal
2024-01-30 06:58:33 +09:00
Pascal Kuthe
87a720c3a1
make path changes LSP spec conform (#8949)
Currently, helix implements operations which change the paths of files
incorrectly and inconsistently. This PR ensures that we do the following
whenever a buffer is renamed (`:move` and workspace edits)

* always send did_open/did_close notifications
* send will_rename/did_rename requests correctly
  * send them to all LSP servers not just those that are active for a
    buffer
  * also send these requests for paths that are not yet open in a buffer (if
    triggered from workspace edit).
  * only send these if the server registered interests in the path
* autodetect language, indent, line ending, ..

This PR also centralizes the infrastructure for path setting and
therefore `:w <path>` benefits from similar fixed (but without didRename)
2024-01-29 01:34:45 +09:00
Blaž Hrastnik
83f09ecbff minor: Silence noisy language server not found error in log 2024-01-24 16:00:21 +09:00
Michael Davis
6d724a8f33 Re-export which from helix-stdx::env
We use `which::which` in many crates, so `which` was a separate
dependency across all of them. We can centralize `which` into the
stdx crate so it's easy for all crates to depend on it.

I also moved the rest of `helix-view/src/env.rs` into helix-stdx's
`env` module since it only contained a thin wrapper around `which`
and `std::env`.
2024-01-24 15:47:49 +09:00
Blaž Hrastnik
6bfe1ddc53 minor: Silence noisy set_error log
Outside of debugging tests, it makes no sense to log this.
2024-01-24 15:31:16 +09:00
Pascal Kuthe
8e592a151f refactor completion and signature help using hooks 2024-01-23 11:20:19 +09:00
Pascal Kuthe
13ed4f6c47 Add hook/event system 2024-01-23 11:20:19 +09:00
Michael Davis
1f916e65cf Create helix-stdx crate for stdlib extensions
helix-stdx is meant to carry extensions to the stdlib or low-level
dependencies that are useful in all other crates. This commit starts
with all of the path functions from helix-core and the CWD tracking that
lived in helix-loader.

The CWD tracking in helix-loader was previously unable to call the
canonicalization functions in helix-core. Switching to our custom
canonicalization code should make no noticeable difference though
since `std::env::current_dir` returns a canonicalized path with
symlinks resolved (at least on unix).
2024-01-18 10:57:53 +09:00
Gabriel Dinner-David
84e24b33dc
make sure to sync views when applying edits to unfocused views (#9173) 2024-01-09 10:21:16 +09:00
Michael Davis
305d6e9c89
Normalize S-<lower-ascii> keymaps to uppercase ascii (#9213) 2024-01-09 10:04:34 +09:00
Philipp Mildenberger
41ca46cf8c
Initialize diagnostics when opening a document (#8873) 2024-01-09 10:01:04 +09:00
Pascal Kuthe
4da6191a1c
don't automatically dismiss zero width diagnostics (#9280) 2024-01-09 09:54:55 +09:00
Pascal Kuthe
783ff27b1b consistent diagnostic sorting 2023-12-27 15:28:14 +09:00
Pascal Kuthe
515ef17207 make diagnostics stick to word boundaries
Diagnostics are currently extended if text is inserted at their end. This is
desirable when inserting text after an identifier. For example consider:

let foo = 2;
    --- unused variable

Renaming the identifier should extend the diagnostic:

let foobar = 2;
    ------ unused variable

This is currently implemented in helix but as a consequence adding whitespaces
or a type hint also extends the diagnostic:

let foo      = 2;
    -------- unused variable
let foo: Bar = 2;
    -------- unused variable

In these cases the diagnostic should remain unchanged:

let foo      = 2;
    --- unused variable
let foo: Bar = 2;
    --- unused variable

As a heuristic helix will now only extend diagnostics that end on a word char
if new chars are appended to the word (so not for punctuation/ whitespace).
The idea for this mapping was inspired for the word level tracking vscode uses
for many positions. While VSCode doesn't currently update diagnostics after
receiving publishDiagnostic it does use this system for inlay hints for example.
Similarly, the new association mechanism implemented here can be used for word
level tracking of inlay hints.

A similar mapping function is implemented for word starts. Together
these can be used to make a diagnostic stick to a word. If that word
is removed that diagnostic is automatically removed too. This is the exact
same behavior VSCode inlay hints eixibit.
2023-12-27 15:28:14 +09:00
Pascal Kuthe
8653e1b02f Add config to mark diagnostic sources as persistent 2023-12-27 15:28:14 +09:00
ath3
9ba691cd3a
Support drawing popup frame (#4313)
Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
2023-12-19 10:17:12 +09:00
Daniel Ebert
938a710904 Make the indent heuristic configurable 2023-12-15 15:59:54 +09:00
dependabot[bot]
7f44a6ad50
build(deps): bump once_cell from 1.18.0 to 1.19.0 (#9053)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-12-12 22:46:11 +09:00
Skyler Hawthorne
bf7c4e1659
use workspace inheritance for common version (#8925) 2023-12-05 10:54:18 +09:00
dependabot[bot]
79965a238d
build(deps): bump url from 2.4.1 to 2.5.0 (#8991)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-12-05 10:41:30 +09:00
dependabot[bot]
4bc43347a1
build(deps): bump clipboard-win from 4.5.0 to 5.0.0 (#8927)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-11-28 09:52:46 +09:00
Fomalhaut Weisszwerg
b7f98d1d99
set Cargo feature resolver to v2 (#8917)
* fix: version of Cargo feature resolver.

This commit solve the ambiguity to determin the version of resolver.
To get more detail, see the following two documents:

- https://doc.rust-lang.org/cargo/reference/resolver.html#resolver-versions
- https://doc.rust-lang.org/edition-guide/rust-2021/default-cargo-resolver.html

* unified: Rust edition in all workspaces.

Now, the Rust 2021 is available in all workspaces.

* fined up: Cargo.toml by using workspace inheritance.

To get more detail of the `workspace.package` table, see a following document:

- https://doc.rust-lang.org/cargo/reference/workspaces.html#the-package-table
2023-11-27 13:24:57 +01:00
Davide Ferrero
3f9788daaa
update which crate to 5.0.0 (#8902)
* update which crate to 5.0.0

* update which crate to 5.0.0
2023-11-26 01:37:00 +09:00
Cole Helbling
8b0ae3d279
bump MSRV to 1.70.0 (#8877)
* rust-toolchain.toml: bump MSRV to 1.70.0

With Firefox 120 released on 21 November 2023, the MSRV is now 1.70.0.

* Fix cargo fmt with Rust 1.70.0

* Fix cargo clippy with Rust 1.70.0

* Fix cargo doc with Rust 1.70.0

* rust-toolchain.toml: add clippy component

* .github: bump dtolnay/rust-toolchain to 1.70

* helix-term: bump rust-version to 1.70

* helix-view/gutter: use checked_ilog10 to count digits

* helix-core/syntax: use MAIN_SEPARATOR_STR constant

* helix-view/handlers/dap: use Display impl for displaying process spawn error

* WIP: helix-term/commands: use checked math to assert ranges cannot overlap
2023-11-25 13:55:49 +01:00