From db56de589a2b5e5ad3c0ceba05f91372c382f538 Mon Sep 17 00:00:00 2001 From: Omnikar Date: Thu, 28 Oct 2021 03:27:28 -0400 Subject: [PATCH 01/20] Add `--tutor` option to `hx --help` output (#924) * Add `--tutor` option to `hx --help` output * Adjust `--tutor` location in help output --- helix-term/src/main.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/helix-term/src/main.rs b/helix-term/src/main.rs index 2589a375b1bc0..f746895cfc837 100644 --- a/helix-term/src/main.rs +++ b/helix-term/src/main.rs @@ -60,6 +60,7 @@ ARGS: FLAGS: -h, --help Prints help information + --tutor Loads the tutorial -v Increases logging verbosity each use for up to 3 times (default file: {}) -V, --version Prints version information From f3c7f20dbce09f516ada77f34f215d64743a34f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bla=C5=BE=20Hrastnik?= Date: Thu, 28 Oct 2021 16:39:17 +0900 Subject: [PATCH 02/20] Release v0.5.0 --- CHANGELOG.md | 86 +++++++++++++++++++++++++++++++++++++++++ Cargo.lock | 12 +++--- helix-core/Cargo.toml | 4 +- helix-lsp/Cargo.toml | 2 +- helix-syntax/Cargo.toml | 2 +- helix-term/Cargo.toml | 8 ++-- helix-tui/Cargo.toml | 6 +-- helix-view/Cargo.toml | 6 +-- 8 files changed, 106 insertions(+), 20 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 03f5730764fcb..e21f383682a2f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,84 @@ +# 0.5.0 (2021-11-28) + +A big shout out to all the contributors! We had 46 contributors in this release. + +Helix has popped up in [Scoop, FreeBSD Ports and Gentu GURU](https://repology.org/project/helix/versions)! + +The following is a quick rundown of the larger changes, there were many more +(check the git history for more details). + +Breaking changes: + +- A couple of keymaps moved to resolve a few conflicting keybinds. + - Documentation popups were moved from `K` to `space+k` + - `K` is now `keep_selections` which filters selections to only keeps ones matching the regex + - `keep_primary_selection` moved from `space+space` to `,` + - `Alt-,` is now `remove_primary_selection` which keeps all selections except the primary one + - Opening files in a split moved from `C-h` to `C-s` +- Some configuration options moved from a `[terminal]` section to `[editor]`. [Consult the documentation for more information.](https://docs.helix-editor.com/configuration.html). + +Features: + +- LSP compatibility greatly improved for some implementations (Julia, Python, Typescript) +- Autocompletion! Completion now triggers automatically after a set idle timeout +- Completion documentation is now displayed next to the popup (#691) +- Treesitter textobjects (select a function via `mf`, class via `mc`) (#728) +- Global search across entire workspace `space+/` (#651) +- Relative line number support (#485) +- Prompts now store a history (72cf86e) +- `:vsplit` and `:hsplit` commands (#639) +- `C-w h/j/k/l` can now be used to navigate between splits (#860) +- `C-j` and `C-k` are now alternative keybindings to `C-n` and `C-p` in the UI (#876) +- Shell commands (shell-pipe, pipe-to, shell-insert-output, shell-append-output, keep-pipe) (#547) +- Searching now defaults to smart case search (case insensitive unless uppercase is used) (#761) +- The preview pane was improved to highlight and center line ranges +- The user `languages.toml` is now merged into defaults, no longer need to copy the entire file (dc57f8dc) +- Show hidden files in completions (#648) +- Grammar injections are now properly handled (dd0b15e) +- `v` in select mode now switches back to normal mode (#660) +- View mode can now be triggered as a "sticky" mode (#719) +- `f`/`t` and object selection motions can now be repeated via `Alt-.` (#891) +- Statusline now displays total selection count and diagnostics counts for both errors and warnings (#916) + +New grammars: + +- Ledger (#572) +- Protobuf (#614) +- Zig (#631) +- YAML (#667) +- Lua (#665) +- OCaml (#666) +- Svelte (#733) +- Vue (#787) +- Tree-sitter queries (#845) +- Elixir (we switched over to the official grammar) (6c0786e) +- Language server definitions for Nix and Elixir (#725) +- Python now uses `pylsp` instead of `pyls` +- Python now supports indentation + +New themes: + +- Monokai (#628) +- Everforest Dark (#760) +- Nord (#799) +- Base16 Default Dark (#833) +- Rose Pine (#897) + +Fixes: + +- Fix crash on empty rust file (#592) +- Exit select mode after toggle comment (#598) +- Pin popups with no positioning to the initial position (12ea3888) +- xsel copy should not freeze the editor (6dd7dc4) +- `*` now only sets the search register and doesn't jump to the next occurrence (3426285) +- Goto line start/end commands extend when in select mode (#739) +- Fix documentation popups sometimes not getting fully highlighted (066367c) +- Refactor apply_workspace_edit to remove assert (b02d872) +- Wrap around the top of the picker menu when scrolling (c7d6e44) +- Don't allow closing the last split if there's unsaved changes (3ff5b00) +- Indentation used different default on hx vs hx new_file.txt (c913bad) + # 0.4.1 (2021-08-14) A minor release that includes: @@ -7,6 +87,8 @@ A minor release that includes: # 0.4.0 (2021-08-13) +A big shout out to all the contributors! We had 28 contributors in this release. + Two months have passed, so this is another big release. A big thank you to all the contributors and package maintainers! @@ -44,6 +126,8 @@ selections in the future as well as resolves many bugs and edge cases. # 0.3.0 (2021-06-27) +A big shout out to all the contributors! We had 24 contributors in this release. + Another big release. Highlights: @@ -90,6 +174,8 @@ Includes a fix where wq/wqa could exit before file saving completed. # 0.2.0 +A big shout out to all the contributors! We had 18 contributors in this release. + Enough has changed to bump the version. We're skipping 0.1.x because previously the CLI would always report version as 0.1.0, and we'd like to distinguish it in bug reports.. diff --git a/Cargo.lock b/Cargo.lock index 17bc73a99d4f8..45a8f5da3b53e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -358,7 +358,7 @@ dependencies = [ [[package]] name = "helix-core" -version = "0.4.1" +version = "0.5.0" dependencies = [ "arc-swap", "etcetera", @@ -382,7 +382,7 @@ dependencies = [ [[package]] name = "helix-lsp" -version = "0.4.1" +version = "0.5.0" dependencies = [ "anyhow", "futures-executor", @@ -400,7 +400,7 @@ dependencies = [ [[package]] name = "helix-syntax" -version = "0.4.1" +version = "0.5.0" dependencies = [ "anyhow", "cc", @@ -411,7 +411,7 @@ dependencies = [ [[package]] name = "helix-term" -version = "0.4.1" +version = "0.5.0" dependencies = [ "anyhow", "chrono", @@ -441,7 +441,7 @@ dependencies = [ [[package]] name = "helix-tui" -version = "0.4.1" +version = "0.5.0" dependencies = [ "bitflags", "cassowary", @@ -454,7 +454,7 @@ dependencies = [ [[package]] name = "helix-view" -version = "0.4.1" +version = "0.5.0" dependencies = [ "anyhow", "bitflags", diff --git a/helix-core/Cargo.toml b/helix-core/Cargo.toml index 84d029d2e1761..ea695d34a4cd4 100644 --- a/helix-core/Cargo.toml +++ b/helix-core/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "helix-core" -version = "0.4.1" +version = "0.5.0" authors = ["Blaž Hrastnik "] edition = "2021" license = "MPL-2.0" @@ -13,7 +13,7 @@ include = ["src/**/*", "README.md"] [features] [dependencies] -helix-syntax = { version = "0.4", path = "../helix-syntax" } +helix-syntax = { version = "0.5", path = "../helix-syntax" } ropey = "1.3" smallvec = "1.7" diff --git a/helix-lsp/Cargo.toml b/helix-lsp/Cargo.toml index 455407ad2aa66..5a284c46cca7a 100644 --- a/helix-lsp/Cargo.toml +++ b/helix-lsp/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "helix-lsp" -version = "0.4.1" +version = "0.5.0" authors = ["Blaž Hrastnik "] edition = "2021" license = "MPL-2.0" diff --git a/helix-syntax/Cargo.toml b/helix-syntax/Cargo.toml index 122fa4603921e..cceec4127860c 100644 --- a/helix-syntax/Cargo.toml +++ b/helix-syntax/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "helix-syntax" -version = "0.4.1" +version = "0.5.0" authors = ["Blaž Hrastnik "] edition = "2021" license = "MPL-2.0" diff --git a/helix-term/Cargo.toml b/helix-term/Cargo.toml index cf1f44d592cda..2414c4335fd33 100644 --- a/helix-term/Cargo.toml +++ b/helix-term/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "helix-term" -version = "0.4.1" +version = "0.5.0" description = "A post-modern text editor." authors = ["Blaž Hrastnik "] edition = "2021" @@ -21,9 +21,9 @@ name = "hx" path = "src/main.rs" [dependencies] -helix-core = { version = "0.4", path = "../helix-core" } -helix-view = { version = "0.4", path = "../helix-view" } -helix-lsp = { version = "0.4", path = "../helix-lsp" } +helix-core = { version = "0.5", path = "../helix-core" } +helix-view = { version = "0.5", path = "../helix-view" } +helix-lsp = { version = "0.5", path = "../helix-lsp" } anyhow = "1" once_cell = "1.8" diff --git a/helix-tui/Cargo.toml b/helix-tui/Cargo.toml index f0c0d7e2da25a..6df65d3602959 100644 --- a/helix-tui/Cargo.toml +++ b/helix-tui/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "helix-tui" -version = "0.4.1" +version = "0.5.0" authors = ["Blaž Hrastnik "] description = """ A library to build rich terminal user interfaces or dashboards @@ -21,5 +21,5 @@ cassowary = "0.3" unicode-segmentation = "1.8" crossterm = { version = "0.22", optional = true } serde = { version = "1", "optional" = true, features = ["derive"]} -helix-view = { version = "0.4", path = "../helix-view", features = ["term"] } -helix-core = { version = "0.4", path = "../helix-core" } +helix-view = { version = "0.5", path = "../helix-view", features = ["term"] } +helix-core = { version = "0.5", path = "../helix-core" } diff --git a/helix-view/Cargo.toml b/helix-view/Cargo.toml index ef09b964f8cf0..34f55eb60e587 100644 --- a/helix-view/Cargo.toml +++ b/helix-view/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "helix-view" -version = "0.4.1" +version = "0.5.0" authors = ["Blaž Hrastnik "] edition = "2021" license = "MPL-2.0" @@ -16,8 +16,8 @@ term = ["crossterm"] [dependencies] bitflags = "1.3" anyhow = "1" -helix-core = { version = "0.4", path = "../helix-core" } -helix-lsp = { version = "0.4", path = "../helix-lsp"} +helix-core = { version = "0.5", path = "../helix-core" } +helix-lsp = { version = "0.5", path = "../helix-lsp"} crossterm = { version = "0.22", optional = true } # Conversion traits From a1b7f003a6ea61b2a77056ce8865a779b3452975 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bla=C5=BE=20Hrastnik?= Date: Thu, 28 Oct 2021 16:44:36 +0900 Subject: [PATCH 03/20] Include the missing dependency bump --- helix-lsp/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helix-lsp/Cargo.toml b/helix-lsp/Cargo.toml index 5a284c46cca7a..f9910cc0bce0d 100644 --- a/helix-lsp/Cargo.toml +++ b/helix-lsp/Cargo.toml @@ -12,7 +12,7 @@ homepage = "https://helix-editor.com" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -helix-core = { version = "0.4", path = "../helix-core" } +helix-core = { version = "0.5", path = "../helix-core" } anyhow = "1.0" futures-executor = "0.3" From 8af6d713cdcc6ce36c1da22a34a2917d80d061a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bla=C5=BE=20Hrastnik?= Date: Thu, 28 Oct 2021 16:49:13 +0900 Subject: [PATCH 04/20] Fix the release date --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e21f383682a2f..12a3cc77b6ad4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,5 @@ -# 0.5.0 (2021-11-28) +# 0.5.0 (2021-10-28) A big shout out to all the contributors! We had 46 contributors in this release. From c02534d2619de0e4d13c4b3bc9b9f32b42ae410b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bla=C5=BE=20Hrastnik?= Date: Thu, 28 Oct 2021 16:57:44 +0900 Subject: [PATCH 05/20] changelog: Add links to all pull requests --- CHANGELOG.md | 66 ++++++++++++++++++++++++++-------------------------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 12a3cc77b6ad4..145455528b0c2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,63 +16,63 @@ Breaking changes: - `keep_primary_selection` moved from `space+space` to `,` - `Alt-,` is now `remove_primary_selection` which keeps all selections except the primary one - Opening files in a split moved from `C-h` to `C-s` -- Some configuration options moved from a `[terminal]` section to `[editor]`. [Consult the documentation for more information.](https://docs.helix-editor.com/configuration.html). +- Some configuration options moved from a `[terminal]` section to `[editor]`. [Consult the documentation for more information.](https://docs.helix-editor.com/configuration.html) Features: - LSP compatibility greatly improved for some implementations (Julia, Python, Typescript) - Autocompletion! Completion now triggers automatically after a set idle timeout -- Completion documentation is now displayed next to the popup (#691) -- Treesitter textobjects (select a function via `mf`, class via `mc`) (#728) -- Global search across entire workspace `space+/` (#651) -- Relative line number support (#485) +- Completion documentation is now displayed next to the popup ([#691](https://github.com/helix-editor/helix/pull/691)) +- Treesitter textobjects (select a function via `mf`, class via `mc`) ([#728](https://github.com/helix-editor/helix/pull/728)) +- Global search across entire workspace `space+/` ([#651](https://github.com/helix-editor/helix/pull/651)) +- Relative line number support ([#485](https://github.com/helix-editor/helix/pull/485)) - Prompts now store a history (72cf86e) -- `:vsplit` and `:hsplit` commands (#639) -- `C-w h/j/k/l` can now be used to navigate between splits (#860) -- `C-j` and `C-k` are now alternative keybindings to `C-n` and `C-p` in the UI (#876) -- Shell commands (shell-pipe, pipe-to, shell-insert-output, shell-append-output, keep-pipe) (#547) -- Searching now defaults to smart case search (case insensitive unless uppercase is used) (#761) +- `:vsplit` and `:hsplit` commands ([#639](https://github.com/helix-editor/helix/pull/639)) +- `C-w h/j/k/l` can now be used to navigate between splits ([#860](https://github.com/helix-editor/helix/pull/860)) +- `C-j` and `C-k` are now alternative keybindings to `C-n` and `C-p` in the UI ([#876](https://github.com/helix-editor/helix/pull/876)) +- Shell commands (shell-pipe, pipe-to, shell-insert-output, shell-append-output, keep-pipe) ([#547](https://github.com/helix-editor/helix/pull/547)) +- Searching now defaults to smart case search (case insensitive unless uppercase is used) ([#761](https://github.com/helix-editor/helix/pull/761)) - The preview pane was improved to highlight and center line ranges - The user `languages.toml` is now merged into defaults, no longer need to copy the entire file (dc57f8dc) -- Show hidden files in completions (#648) +- Show hidden files in completions ([#648](https://github.com/helix-editor/helix/pull/648)) - Grammar injections are now properly handled (dd0b15e) -- `v` in select mode now switches back to normal mode (#660) -- View mode can now be triggered as a "sticky" mode (#719) -- `f`/`t` and object selection motions can now be repeated via `Alt-.` (#891) -- Statusline now displays total selection count and diagnostics counts for both errors and warnings (#916) +- `v` in select mode now switches back to normal mode ([#660](https://github.com/helix-editor/helix/pull/660)) +- View mode can now be triggered as a "sticky" mode ([#719](https://github.com/helix-editor/helix/pull/719)) +- `f`/`t` and object selection motions can now be repeated via `Alt-.` ([#891](https://github.com/helix-editor/helix/pull/891)) +- Statusline now displays total selection count and diagnostics counts for both errors and warnings ([#916](https://github.com/helix-editor/helix/pull/916)) New grammars: -- Ledger (#572) -- Protobuf (#614) -- Zig (#631) -- YAML (#667) -- Lua (#665) -- OCaml (#666) -- Svelte (#733) -- Vue (#787) -- Tree-sitter queries (#845) +- Ledger ([#572](https://github.com/helix-editor/helix/pull/572)) +- Protobuf ([#614](https://github.com/helix-editor/helix/pull/614)) +- Zig ([#631](https://github.com/helix-editor/helix/pull/631)) +- YAML ([#667](https://github.com/helix-editor/helix/pull/667)) +- Lua ([#665](https://github.com/helix-editor/helix/pull/665)) +- OCaml ([#666](https://github.com/helix-editor/helix/pull/666)) +- Svelte ([#733](https://github.com/helix-editor/helix/pull/733)) +- Vue ([#787](https://github.com/helix-editor/helix/pull/787)) +- Tree-sitter queries ([#845](https://github.com/helix-editor/helix/pull/845)) - Elixir (we switched over to the official grammar) (6c0786e) -- Language server definitions for Nix and Elixir (#725) +- Language server definitions for Nix and Elixir ([#725](https://github.com/helix-editor/helix/pull/725)) - Python now uses `pylsp` instead of `pyls` - Python now supports indentation New themes: -- Monokai (#628) -- Everforest Dark (#760) -- Nord (#799) -- Base16 Default Dark (#833) -- Rose Pine (#897) +- Monokai ([#628](https://github.com/helix-editor/helix/pull/628)) +- Everforest Dark ([#760](https://github.com/helix-editor/helix/pull/760)) +- Nord ([#799](https://github.com/helix-editor/helix/pull/799)) +- Base16 Default Dark ([#833](https://github.com/helix-editor/helix/pull/833)) +- Rose Pine ([#897](https://github.com/helix-editor/helix/pull/897)) Fixes: -- Fix crash on empty rust file (#592) -- Exit select mode after toggle comment (#598) +- Fix crash on empty rust file ([#592](https://github.com/helix-editor/helix/pull/592)) +- Exit select mode after toggle comment ([#598](https://github.com/helix-editor/helix/pull/598)) - Pin popups with no positioning to the initial position (12ea3888) - xsel copy should not freeze the editor (6dd7dc4) - `*` now only sets the search register and doesn't jump to the next occurrence (3426285) -- Goto line start/end commands extend when in select mode (#739) +- Goto line start/end commands extend when in select mode ([#739](https://github.com/helix-editor/helix/pull/739)) - Fix documentation popups sometimes not getting fully highlighted (066367c) - Refactor apply_workspace_edit to remove assert (b02d872) - Wrap around the top of the picker menu when scrolling (c7d6e44) From 58b8100751059d34602800d8ebd5a511775b4731 Mon Sep 17 00:00:00 2001 From: ath3 <45574139+ath3@users.noreply.github.com> Date: Thu, 28 Oct 2021 14:23:13 +0200 Subject: [PATCH 06/20] Mention CMake support in changelog (#926) --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 145455528b0c2..52ca2d602f1fc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -52,6 +52,7 @@ New grammars: - Svelte ([#733](https://github.com/helix-editor/helix/pull/733)) - Vue ([#787](https://github.com/helix-editor/helix/pull/787)) - Tree-sitter queries ([#845](https://github.com/helix-editor/helix/pull/845)) +- CMake ([#888](https://github.com/helix-editor/helix/pull/888)) - Elixir (we switched over to the official grammar) (6c0786e) - Language server definitions for Nix and Elixir ([#725](https://github.com/helix-editor/helix/pull/725)) - Python now uses `pylsp` instead of `pyls` From 45fadf61518b36c2e020f7262f136588dc96b03e Mon Sep 17 00:00:00 2001 From: Omnikar Date: Thu, 28 Oct 2021 20:55:15 -0400 Subject: [PATCH 07/20] Add hyperlinks to fix `cargo doc` warn (#931) --- helix-core/src/graphemes.rs | 2 +- helix-core/src/history.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/helix-core/src/graphemes.rs b/helix-core/src/graphemes.rs index 56f5bacb7264e..c639887576288 100644 --- a/helix-core/src/graphemes.rs +++ b/helix-core/src/graphemes.rs @@ -1,6 +1,6 @@ //! Utility functions to traverse the unicode graphemes of a `Rope`'s text contents. //! -//! Based on https://github.com/cessen/led/blob/c4fa72405f510b7fd16052f90a598c429b3104a6/src/graphemes.rs +//! Based on use ropey::{iter::Chunks, str_utils::byte_to_char_idx, RopeSlice}; use unicode_segmentation::{GraphemeCursor, GraphemeIncomplete}; use unicode_width::UnicodeWidthStr; diff --git a/helix-core/src/history.rs b/helix-core/src/history.rs index cf62708a9a455..b53c01fe759df 100644 --- a/helix-core/src/history.rs +++ b/helix-core/src/history.rs @@ -40,7 +40,7 @@ use std::time::{Duration, Instant}; /// * Because delete transactions currently don't store the text that they /// delete, we also store an inversion of the transaction. /// -/// Using time to navigate the history: https://github.com/helix-editor/helix/pull/194 +/// Using time to navigate the history: #[derive(Debug)] pub struct History { revisions: Vec, From f1d339919f4299d570bb6f7fcf5fcc58c0f281cf Mon Sep 17 00:00:00 2001 From: cossonleo Date: Wed, 27 Oct 2021 17:42:11 +0800 Subject: [PATCH 08/20] add expand_selection to last_motion --- helix-term/src/commands.rs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index b3be6d5b3aeb9..08750aeb1617b 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -4348,13 +4348,17 @@ fn rotate_selection_contents_backward(cx: &mut Context) { // tree sitter node selection fn expand_selection(cx: &mut Context) { - let (view, doc) = current!(cx.editor); + let motion = |editor: &mut Editor| { + let (view, doc) = current!(editor); - if let Some(syntax) = doc.syntax() { - let text = doc.text().slice(..); - let selection = object::expand_selection(syntax, text, doc.selection(view.id)); - doc.set_selection(view.id, selection); - } + if let Some(syntax) = doc.syntax() { + let text = doc.text().slice(..); + let selection = object::expand_selection(syntax, text, doc.selection(view.id)); + doc.set_selection(view.id, selection); + } + }; + motion(&mut cx.editor); + cx.editor.last_motion = Some(Motion(Box::new(motion))); } fn match_brackets(cx: &mut Context) { From befecc8a9a087436a9dbc6942e328646c3391874 Mon Sep 17 00:00:00 2001 From: cossonleo Date: Thu, 28 Oct 2021 13:31:44 +0800 Subject: [PATCH 09/20] select smaller range on some case --- helix-core/src/object.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/helix-core/src/object.rs b/helix-core/src/object.rs index d9558dd83c34a..717c5994710d2 100644 --- a/helix-core/src/object.rs +++ b/helix-core/src/object.rs @@ -13,8 +13,13 @@ pub fn expand_selection(syntax: &Syntax, text: RopeSlice, selection: &Selection) let parent = match tree .root_node() .descendant_for_byte_range(from, to) - .and_then(|node| node.parent()) - { + .and_then(|node| { + if node.child_count() == 0 || (node.start_byte() == from && node.end_byte() == to) { + node.parent() + } else { + Some(node) + } + }) { Some(parent) => parent, None => return range, }; From 21d535565bfcc5ff4e2eae34329b051944a8d1f5 Mon Sep 17 00:00:00 2001 From: Ivan Tham Date: Fri, 29 Oct 2021 09:07:07 +0800 Subject: [PATCH 10/20] Support extend for multiple goto (#909) gg, ge, [n]gg --- helix-term/src/commands.rs | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index 08750aeb1617b..9eda2c23bc8b9 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -622,14 +622,25 @@ fn goto_file_start(cx: &mut Context) { } else { push_jump(cx.editor); let (view, doc) = current!(cx.editor); - doc.set_selection(view.id, Selection::point(0)); + let text = doc.text().slice(..); + let selection = doc + .selection(view.id) + .clone() + .transform(|range| range.put_cursor(text, 0, doc.mode == Mode::Select)); + doc.set_selection(view.id, selection); } } fn goto_file_end(cx: &mut Context) { push_jump(cx.editor); let (view, doc) = current!(cx.editor); - doc.set_selection(view.id, Selection::point(doc.text().len_chars())); + let text = doc.text().slice(..); + let pos = doc.text().len_chars(); + let selection = doc + .selection(view.id) + .clone() + .transform(|range| range.put_cursor(text, pos, doc.mode == Mode::Select)); + doc.set_selection(view.id, selection); } fn extend_word_impl(cx: &mut Context, extend_fn: F) @@ -2905,8 +2916,13 @@ fn goto_line(cx: &mut Context) { doc.text().len_lines() - 1 }; let line_idx = std::cmp::min(count.get() - 1, max_line); + let text = doc.text().slice(..); let pos = doc.text().line_to_char(line_idx); - doc.set_selection(view.id, Selection::point(pos)); + let selection = doc + .selection(view.id) + .clone() + .transform(|range| range.put_cursor(text, pos, doc.mode == Mode::Select)); + doc.set_selection(view.id, selection); } } @@ -2920,8 +2936,13 @@ fn goto_last_line(cx: &mut Context) { } else { doc.text().len_lines() - 1 }; + let text = doc.text().slice(..); let pos = doc.text().line_to_char(line_idx); - doc.set_selection(view.id, Selection::point(pos)); + let selection = doc + .selection(view.id) + .clone() + .transform(|range| range.put_cursor(text, pos, doc.mode == Mode::Select)); + doc.set_selection(view.id, selection); } fn goto_last_accessed_file(cx: &mut Context) { From bc6a34d97edae55811c2476278a6288d7d258af3 Mon Sep 17 00:00:00 2001 From: Ivan Tham Date: Fri, 29 Oct 2021 09:08:53 +0800 Subject: [PATCH 11/20] Make match work with extend and multi cursors (#920) --- helix-term/src/commands.rs | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index 9eda2c23bc8b9..28657865b580b 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -4386,14 +4386,15 @@ fn match_brackets(cx: &mut Context) { let (view, doc) = current!(cx.editor); if let Some(syntax) = doc.syntax() { - let pos = doc - .selection(view.id) - .primary() - .cursor(doc.text().slice(..)); - if let Some(pos) = match_brackets::find(syntax, doc.text(), pos) { - let selection = Selection::point(pos); - doc.set_selection(view.id, selection); - }; + let text = doc.text().slice(..); + let selection = doc.selection(view.id).clone().transform(|range| { + if let Some(pos) = match_brackets::find(syntax, doc.text(), range.anchor) { + range.put_cursor(text, pos, doc.mode == Mode::Select) + } else { + range + } + }); + doc.set_selection(view.id, selection); } } From cec0cfdaecdb9b3e7fdf3ae3bb3252ba3f2f2752 Mon Sep 17 00:00:00 2001 From: Kirawi <67773714+kirawi@users.noreply.github.com> Date: Thu, 28 Oct 2021 21:11:30 -0400 Subject: [PATCH 12/20] Uncomment mapping LSP diagnostics through changes (#925) --- helix-view/src/document.rs | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/helix-view/src/document.rs b/helix-view/src/document.rs index c623277d851bd..02da4b7af4c47 100644 --- a/helix-view/src/document.rs +++ b/helix-view/src/document.rs @@ -657,14 +657,13 @@ impl Document { } // map state.diagnostics over changes::map_pos too - // NOTE: seems to do nothing since the language server resends diagnostics on each edit - // for diagnostic in &mut self.diagnostics { - // use helix_core::Assoc; - // let changes = transaction.changes(); - // diagnostic.range.start = changes.map_pos(diagnostic.range.start, Assoc::After); - // diagnostic.range.end = changes.map_pos(diagnostic.range.end, Assoc::After); - // diagnostic.line = self.text.char_to_line(diagnostic.range.start); - // } + for diagnostic in &mut self.diagnostics { + use helix_core::Assoc; + let changes = transaction.changes(); + diagnostic.range.start = changes.map_pos(diagnostic.range.start, Assoc::After); + diagnostic.range.end = changes.map_pos(diagnostic.range.end, Assoc::After); + diagnostic.line = self.text.char_to_line(diagnostic.range.start); + } // emit lsp notification if let Some(language_server) = self.language_server() { From 49f6c2623fbda5ff4be86e5e7d773bf900d9c75c Mon Sep 17 00:00:00 2001 From: Ivan Tham Date: Fri, 29 Oct 2021 11:00:18 +0800 Subject: [PATCH 13/20] Bump lsp-types to 0.91.0 (#932) --- Cargo.lock | 4 +-- helix-lsp/Cargo.toml | 2 +- helix-lsp/src/client.rs | 7 +++-- helix-term/src/application.rs | 9 +++--- helix-term/src/ui/completion.rs | 51 +++++++++++++++++---------------- 5 files changed, 38 insertions(+), 35 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 45a8f5da3b53e..8af5c45c2ebef 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -584,9 +584,9 @@ dependencies = [ [[package]] name = "lsp-types" -version = "0.90.1" +version = "0.91.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f3734ab1d7d157fc0c45110e06b587c31cd82bea2ccfd6b563cbff0aaeeb1d3" +checksum = "be7801b458592d0998af808d97f6a85a6057af3aaf2a2a5c3c677702bbeb4ed7" dependencies = [ "bitflags", "serde", diff --git a/helix-lsp/Cargo.toml b/helix-lsp/Cargo.toml index f9910cc0bce0d..8cbff41d0b0a1 100644 --- a/helix-lsp/Cargo.toml +++ b/helix-lsp/Cargo.toml @@ -19,7 +19,7 @@ futures-executor = "0.3" futures-util = { version = "0.3", features = ["std", "async-await"], default-features = false } jsonrpc-core = { version = "18.0", default-features = false } # don't pull in all of futures log = "0.4" -lsp-types = { version = "0.90", features = ["proposed"] } +lsp-types = { version = "0.91", features = ["proposed"] } serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" thiserror = "1.0" diff --git a/helix-lsp/src/client.rs b/helix-lsp/src/client.rs index 4068ae1fe30ea..b810feef35ca5 100644 --- a/helix-lsp/src/client.rs +++ b/helix-lsp/src/client.rs @@ -461,7 +461,7 @@ impl Client { }; let changes = match sync_capabilities { - lsp::TextDocumentSyncKind::Full => { + lsp::TextDocumentSyncKind::FULL => { vec![lsp::TextDocumentContentChangeEvent { // range = None -> whole document range: None, //Some(Range) @@ -469,10 +469,11 @@ impl Client { text: new_text.to_string(), }] } - lsp::TextDocumentSyncKind::Incremental => { + lsp::TextDocumentSyncKind::INCREMENTAL => { Self::changeset_to_changes(old_text, new_text, changes, self.offset_encoding) } - lsp::TextDocumentSyncKind::None => return None, + lsp::TextDocumentSyncKind::NONE => return None, + kind => unimplemented!("{:?}", kind), }; Some(self.notify::( diff --git a/helix-term/src/application.rs b/helix-term/src/application.rs index 55b12c5a2ec96..6037148f6b709 100644 --- a/helix-term/src/application.rs +++ b/helix-term/src/application.rs @@ -389,10 +389,11 @@ impl Application { message: diagnostic.message, severity: diagnostic.severity.map( |severity| match severity { - DiagnosticSeverity::Error => Error, - DiagnosticSeverity::Warning => Warning, - DiagnosticSeverity::Information => Info, - DiagnosticSeverity::Hint => Hint, + DiagnosticSeverity::ERROR => Error, + DiagnosticSeverity::WARNING => Warning, + DiagnosticSeverity::INFORMATION => Info, + DiagnosticSeverity::HINT => Hint, + severity => unimplemented!("{:?}", severity), }, ), // code diff --git a/helix-term/src/ui/completion.rs b/helix-term/src/ui/completion.rs index a893e70b1cd2a..dcb2bfd835b74 100644 --- a/helix-term/src/ui/completion.rs +++ b/helix-term/src/ui/completion.rs @@ -30,31 +30,32 @@ impl menu::Item for CompletionItem { menu::Row::new(vec![ menu::Cell::from(self.label.as_str()), menu::Cell::from(match self.kind { - Some(lsp::CompletionItemKind::Text) => "text", - Some(lsp::CompletionItemKind::Method) => "method", - Some(lsp::CompletionItemKind::Function) => "function", - Some(lsp::CompletionItemKind::Constructor) => "constructor", - Some(lsp::CompletionItemKind::Field) => "field", - Some(lsp::CompletionItemKind::Variable) => "variable", - Some(lsp::CompletionItemKind::Class) => "class", - Some(lsp::CompletionItemKind::Interface) => "interface", - Some(lsp::CompletionItemKind::Module) => "module", - Some(lsp::CompletionItemKind::Property) => "property", - Some(lsp::CompletionItemKind::Unit) => "unit", - Some(lsp::CompletionItemKind::Value) => "value", - Some(lsp::CompletionItemKind::Enum) => "enum", - Some(lsp::CompletionItemKind::Keyword) => "keyword", - Some(lsp::CompletionItemKind::Snippet) => "snippet", - Some(lsp::CompletionItemKind::Color) => "color", - Some(lsp::CompletionItemKind::File) => "file", - Some(lsp::CompletionItemKind::Reference) => "reference", - Some(lsp::CompletionItemKind::Folder) => "folder", - Some(lsp::CompletionItemKind::EnumMember) => "enum_member", - Some(lsp::CompletionItemKind::Constant) => "constant", - Some(lsp::CompletionItemKind::Struct) => "struct", - Some(lsp::CompletionItemKind::Event) => "event", - Some(lsp::CompletionItemKind::Operator) => "operator", - Some(lsp::CompletionItemKind::TypeParameter) => "type_param", + Some(lsp::CompletionItemKind::TEXT) => "text", + Some(lsp::CompletionItemKind::METHOD) => "method", + Some(lsp::CompletionItemKind::FUNCTION) => "function", + Some(lsp::CompletionItemKind::CONSTRUCTOR) => "constructor", + Some(lsp::CompletionItemKind::FIELD) => "field", + Some(lsp::CompletionItemKind::VARIABLE) => "variable", + Some(lsp::CompletionItemKind::CLASS) => "class", + Some(lsp::CompletionItemKind::INTERFACE) => "interface", + Some(lsp::CompletionItemKind::MODULE) => "module", + Some(lsp::CompletionItemKind::PROPERTY) => "property", + Some(lsp::CompletionItemKind::UNIT) => "unit", + Some(lsp::CompletionItemKind::VALUE) => "value", + Some(lsp::CompletionItemKind::ENUM) => "enum", + Some(lsp::CompletionItemKind::KEYWORD) => "keyword", + Some(lsp::CompletionItemKind::SNIPPET) => "snippet", + Some(lsp::CompletionItemKind::COLOR) => "color", + Some(lsp::CompletionItemKind::FILE) => "file", + Some(lsp::CompletionItemKind::REFERENCE) => "reference", + Some(lsp::CompletionItemKind::FOLDER) => "folder", + Some(lsp::CompletionItemKind::ENUM_MEMBER) => "enum_member", + Some(lsp::CompletionItemKind::CONSTANT) => "constant", + Some(lsp::CompletionItemKind::STRUCT) => "struct", + Some(lsp::CompletionItemKind::EVENT) => "event", + Some(lsp::CompletionItemKind::OPERATOR) => "operator", + Some(lsp::CompletionItemKind::TYPE_PARAMETER) => "type_param", + Some(kind) => unimplemented!("{:?}", kind), None => "", }), // self.detail.as_deref().unwrap_or("") From a1c7e55e3be95be6769d3a08518c8a41c257016f Mon Sep 17 00:00:00 2001 From: Houkime <32805122+Houkime@users.noreply.github.com> Date: Fri, 29 Oct 2021 05:11:19 +0000 Subject: [PATCH 14/20] update cpp queries (#930) Co-authored-by: Houkime <> --- helix-syntax/languages/tree-sitter-cpp | 2 +- runtime/queries/cpp/highlights.scm | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/helix-syntax/languages/tree-sitter-cpp b/helix-syntax/languages/tree-sitter-cpp index c61212414a3e9..e8dcc9d2b404c 160000 --- a/helix-syntax/languages/tree-sitter-cpp +++ b/helix-syntax/languages/tree-sitter-cpp @@ -1 +1 @@ -Subproject commit c61212414a3e95b5f7507f98e83de1d638044adc +Subproject commit e8dcc9d2b404c542fd236ea5f7208f90be8a6e89 diff --git a/runtime/queries/cpp/highlights.scm b/runtime/queries/cpp/highlights.scm index 3315fde0506a2..3348ef3caec23 100644 --- a/runtime/queries/cpp/highlights.scm +++ b/runtime/queries/cpp/highlights.scm @@ -3,7 +3,7 @@ ; Functions (call_expression - function: (scoped_identifier + function: (qualified_identifier name: (identifier) @function)) (template_function @@ -13,15 +13,14 @@ name: (field_identifier) @function) (template_function - name: (scoped_identifier - name: (identifier) @function)) + name: (identifier) @function) (function_declarator - declarator: (scoped_identifier + declarator: (qualified_identifier name: (identifier) @function)) (function_declarator - declarator: (scoped_identifier + declarator: (qualified_identifier name: (identifier) @function)) (function_declarator From 68697cb3322b94b20a47671c50b4fdd143f67ae7 Mon Sep 17 00:00:00 2001 From: Za Wilcox Date: Thu, 28 Oct 2021 23:11:42 -0600 Subject: [PATCH 15/20] Move 'Note' from incorrect location (#921) --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 7cd58d59092b9..e78b92afe9619 100644 --- a/README.md +++ b/README.md @@ -27,11 +27,11 @@ All shortcuts/keymaps can be found [in the documentation on the website](https:/ It's a terminal-based editor first, but I'd like to explore a custom renderer (similar to emacs) in wgpu or skulpin. -# Installation - Note: Only certain languages have indentation definitions at the moment. Check `runtime/queries//` for `indents.toml`. +# Installation + We provide packaging for various distributions, but here's a quick method to build from source. From e5de103728b7a1338056f70524362930695d6c85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bla=C5=BE=20Hrastnik?= Date: Fri, 29 Oct 2021 16:48:25 +0900 Subject: [PATCH 16/20] Extract a clear_completion method --- helix-term/src/ui/editor.rs | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/helix-term/src/ui/editor.rs b/helix-term/src/ui/editor.rs index bf316ee36dc51..c0d602c73bc89 100644 --- a/helix-term/src/ui/editor.rs +++ b/helix-term/src/ui/editor.rs @@ -786,6 +786,14 @@ impl EditorView { completion.required_size((size.width, size.height)); self.completion = Some(completion); } + + pub fn clear_completion(&mut self, editor: &mut Editor) { + self.completion = None; + // Clear any savepoints + let (_, doc) = current!(editor); + doc.savepoint = None; + editor.clear_idle_timer(); // don't retrigger + } } impl EditorView { @@ -990,11 +998,7 @@ impl Component for EditorView { if callback.is_some() { // assume close_fn - self.completion = None; - // Clear any savepoints - let (_, doc) = current!(cxt.editor); - doc.savepoint = None; - cxt.editor.clear_idle_timer(); // don't retrigger + self.clear_completion(cxt.editor); } } } @@ -1007,11 +1011,7 @@ impl Component for EditorView { if let Some(completion) = &mut self.completion { completion.update(&mut cxt); if completion.is_empty() { - self.completion = None; - // Clear any savepoints - let (_, doc) = current!(cxt.editor); - doc.savepoint = None; - cxt.editor.clear_idle_timer(); // don't retrigger + self.clear_completion(cxt.editor); } } } From f140a2a00eecfe47115634cef3bad4fd51e03b71 Mon Sep 17 00:00:00 2001 From: Gygaxis Vainhardt <44003709+AloeareV@users.noreply.github.com> Date: Fri, 29 Oct 2021 22:48:00 -0300 Subject: [PATCH 17/20] Add arrow-key bindings for window switching (#933) --- book/src/keymap.md | 8 ++++---- helix-term/src/keymap.rs | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/book/src/keymap.md b/book/src/keymap.md index 2ff8bfe6b80c4..9ed35f771471c 100644 --- a/book/src/keymap.md +++ b/book/src/keymap.md @@ -188,10 +188,10 @@ This layer is similar to vim keybindings as kakoune does not support window. | `w`, `Ctrl-w` | Switch to next window | `rotate_view` | | `v`, `Ctrl-v` | Vertical right split | `vsplit` | | `s`, `Ctrl-s` | Horizontal bottom split | `hsplit` | -| `h`, `Ctrl-h` | Move to left split | `jump_view_left` | -| `j`, `Ctrl-j` | Move to split below | `jump_view_down` | -| `k`, `Ctrl-k` | Move to split above | `jump_view_up` | -| `l`, `Ctrl-l` | Move to right split | `jump_view_right` | +| `h`, `Ctrl-h`, `left` | Move to left split | `jump_view_left` | +| `j`, `Ctrl-j`, `down` | Move to split below | `jump_view_down` | +| `k`, `Ctrl-k`, `up` | Move to split above | `jump_view_up` | +| `l`, `Ctrl-l`, `right` | Move to right split | `jump_view_right` | | `q`, `Ctrl-q` | Close current window | `wclose` | #### Space mode diff --git a/helix-term/src/keymap.rs b/helix-term/src/keymap.rs index 5453020ec634f..cd953c5c4f6b0 100644 --- a/helix-term/src/keymap.rs +++ b/helix-term/src/keymap.rs @@ -540,10 +540,10 @@ impl Default for Keymaps { "C-s" | "s" => hsplit, "C-v" | "v" => vsplit, "C-q" | "q" => wclose, - "C-h" | "h" => jump_view_left, - "C-j" | "j" => jump_view_down, - "C-k" | "k" => jump_view_up, - "C-l" | "l" => jump_view_right, + "C-h" | "h" | "left" => jump_view_left, + "C-j" | "j" | "down" => jump_view_down, + "C-k" | "k" | "up" => jump_view_up, + "C-l" | "l" | "right" => jump_view_right, }, // move under c From ea452bec80d8701c91e8fa3aadbd960d46ecc6fb Mon Sep 17 00:00:00 2001 From: Gokul Soumya Date: Sat, 30 Oct 2021 10:47:51 +0530 Subject: [PATCH 18/20] Update onedark theme (#936) - Use named color palette - Remove blue highlight for variables (too much noise) - Add purple highlight for control statements (if, match, etc) --- runtime/themes/onedark.toml | 103 +++++++++++++++++++++--------------- 1 file changed, 60 insertions(+), 43 deletions(-) diff --git a/runtime/themes/onedark.toml b/runtime/themes/onedark.toml index 37057f5830ea1..40ed1abe4f600 100644 --- a/runtime/themes/onedark.toml +++ b/runtime/themes/onedark.toml @@ -1,54 +1,71 @@ # Author : Gokul Soumya -"attribute" = { fg = "#E5C07B" } -"comment" = { fg = "#5C6370", modifiers = ['italic'] } -"constant" = { fg = "#56B6C2" } -"constant.builtin" = { fg = "#61AFEF" } -"constructor" = { fg = "#61AFEF" } -"escape" = { fg = "#D19A66" } -"function" = { fg = "#61AFEF" } -"function.builtin" = { fg = "#61AFEF" } -"function.macro" = { fg = "#C678DD" } -"keyword" = { fg = "#E06C75" } -"keyword.directive" = { fg = "#C678DD" } -"label" = { fg = "#C678DD" } -"namespace" = { fg = "#61AFEF" } -"number" = { fg = "#D19A66" } -"operator" = { fg = "#C678DD" } -"property" = { fg = "#E06C75" } -"special" = { fg = "#61AFEF" } -"string" = { fg = "#98C379" } -"type" = { fg = "#E5C07B" } -"type.builtin" = { fg = "#E5C07B" } -"variable" = { fg = "#61AFEF" } -"variable.builtin" = { fg = "#61AFEF" } -"variable.parameter" = { fg = "#E06C75" } +"attribute" = { fg = "yellow" } +"comment" = { fg = "light-gray", modifiers = ["italic"] } +"constant" = { fg = "cyan" } +"constant.builtin" = { fg = "blue" } +"constructor" = { fg = "blue" } +"escape" = { fg = "gold" } +"function" = { fg = "blue" } +"function.builtin" = { fg = "blue" } +"function.macro" = { fg = "purple" } +"keyword" = { fg = "red" } +"keyword.control" = { fg = "purple" } +"keyword.directive" = { fg = "purple" } +"label" = { fg = "purple" } +"namespace" = { fg = "blue" } +"number" = { fg = "gold" } +"operator" = { fg = "purple" } +"property" = { fg = "red" } +"special" = { fg = "blue" } +"string" = { fg = "green" } +"type" = { fg = "yellow" } +"type.builtin" = { fg = "yellow" } +# "variable" = { fg = "blue" } +"variable.builtin" = { fg = "blue" } +"variable.parameter" = { fg = "red" } diagnostic = { modifiers = ["underlined"] } -"info" = { fg = "#61afef", modifiers = ['bold'] } -"hint" = { fg = "#98c379", modifiers = ['bold'] } -"warning" = { fg = "#e5c07b", modifiers = ['bold'] } -"error" = { fg = "#e06c75", modifiers = ['bold'] } +"info" = { fg = "blue", modifiers = ["bold"] } +"hint" = { fg = "green", modifiers = ["bold"] } +"warning" = { fg = "yellow", modifiers = ["bold"] } +"error" = { fg = "red", modifiers = ["bold"] } -"ui.background" = { bg = "#282C34" } +"ui.background" = { bg = "black" } -"ui.cursor" = { fg = "#ABB2BF", modifiers = ["reversed"] } -"ui.cursor.primary" = { fg = "#ABB2BF", modifiers = ["reversed"] } -"ui.cursor.match" = { fg = "#61AFEF", modifiers = ['underlined']} +"ui.cursor" = { fg = "white", modifiers = ["reversed"] } +"ui.cursor.primary" = { fg = "white", modifiers = ["reversed"] } +"ui.cursor.match" = { fg = "blue", modifiers = ["underlined"]} -"ui.selection" = { bg = "#5C6370" } -"ui.selection.primary" = { bg = "#3E4452" } +"ui.selection" = { bg = "light-gray" } +"ui.selection.primary" = { bg = "gray" } -"ui.linenr" = { fg = "#4B5263", modifiers = ['dim'] } -"ui.linenr.selected" = { fg = "#ABB2BF" } +"ui.linenr" = { fg = "linenr", modifiers = ["dim"] } +"ui.linenr.selected" = { fg = "white" } -"ui.statusline" = { fg = "#ABB2BF", bg = "#2C323C" } -"ui.statusline.inactive" = { fg = "#5C6370", bg = "#2C323C" } +"ui.statusline" = { fg = "white", bg = "light-black" } +"ui.statusline.inactive" = { fg = "light-gray", bg = "light-black" } -"ui.text" = { fg = "#ABB2BF" } -"ui.text.focus" = { fg = "#ABB2BF", bg = "#2C323C", modifiers = ['bold'] } +"ui.text" = { fg = "white" } +"ui.text.focus" = { fg = "white", bg = "light-black", modifiers = ["bold"] } -"ui.help" = { bg = "#3E4452" } -"ui.popup" = { bg = "#3E4452" } -"ui.window" = { bg = "#3E4452" } -"ui.menu.selected" = { fg = "#282C34", bg = "#61AFEF" } +"ui.help" = { bg = "gray" } +"ui.popup" = { bg = "gray" } +"ui.window" = { bg = "gray" } +"ui.menu.selected" = { fg = "black", bg = "blue" } + +[palette] + +yellow = "#E5C07B" +blue = "#61AFEF" +red = "#E06C75" +purple = "#C678DD" +green = "#98C379" +gold = "#D19A66" +cyan = "#56B6C2" +white = "#ABB2BF" +black = "#282C34" +light-black = "#2C323C" +gray = "#3E4452" +light-gray = "#5C6370" +linenr = "#4B5263" From 592fba11005ef6f2eda09285b34b24eeea5efc25 Mon Sep 17 00:00:00 2001 From: kabirz Date: Sat, 30 Oct 2021 14:07:45 +0800 Subject: [PATCH 19/20] add cmake-language-server as cmake language server --- languages.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/languages.toml b/languages.toml index a393b4a6b1217..b2726d820b931 100644 --- a/languages.toml +++ b/languages.toml @@ -354,3 +354,4 @@ file-types = ["cmake", "CMakeLists.txt"] roots = [] comment-token = "#" indent = { tab-width = 2, unit = " " } +language-server = { command = "cmake-language-server" } From 2f8ad7f890d99dfcad7c7a5e0b35ee5a39fcd3d0 Mon Sep 17 00:00:00 2001 From: Omnikar Date: Sat, 30 Oct 2021 20:42:49 -0400 Subject: [PATCH 20/20] If switching away from an empty scratch buffer, remove it (#935) * If switching away from an empty scratch buffer, remove it * Move `view.jumps.push` call into `else` clause * Refactor --- helix-view/src/editor.rs | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/helix-view/src/editor.rs b/helix-view/src/editor.rs index 09fc333410b7b..21a6465104184 100644 --- a/helix-view/src/editor.rs +++ b/helix-view/src/editor.rs @@ -232,15 +232,29 @@ impl Editor { match action { Action::Replace => { - let view = view!(self); - let jump = ( - view.doc, - self.documents[view.doc].selection(view.id).clone(), - ); - + let (view, doc) = current_ref!(self); + // If the current view is an empty scratch buffer and is not displayed in any other views, delete it. + // Boolean value is determined before the call to `view_mut` because the operation requires a borrow + // of `self.tree`, which is mutably borrowed when `view_mut` is called. + let remove_empty_scratch = !doc.is_modified() + // If the buffer has no path and is not modified, it is an empty scratch buffer. + && doc.path().is_none() + // Ensure the buffer is not displayed in any other splits. + && !self + .tree + .traverse() + .any(|(_, v)| v.doc == doc.id && v.id != view.id); let view = view_mut!(self); - view.jumps.push(jump); - view.last_accessed_doc = Some(view.doc); + if remove_empty_scratch { + // Copy `doc.id` into a variable before calling `self.documents.remove`, which requires a mutable + // borrow, invalidating direct access to `doc.id`. + let id = doc.id; + self.documents.remove(id); + } else { + let jump = (view.doc, doc.selection(view.id).clone()); + view.jumps.push(jump); + view.last_accessed_doc = Some(view.doc); + } view.doc = id; view.offset = Position::default();