From 5e256e4a98561c2085b1ecae1e39e27bf3744724 Mon Sep 17 00:00:00 2001 From: Matthias Deiml Date: Sat, 29 Oct 2022 17:24:33 +0200 Subject: [PATCH 001/491] Make shell_impl concurrent (#3180) --- helix-term/src/commands.rs | 41 +++++++++++++++++++++++++------------- 1 file changed, 27 insertions(+), 14 deletions(-) diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index fca55b682558..172a7b2e7fd0 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -8,7 +8,7 @@ use tui::text::Spans; pub use typed::*; use helix_core::{ - comment, coords_at_pos, find_first_non_whitespace_char, find_root, graphemes, + comment, coords_at_pos, encoding, find_first_non_whitespace_char, find_root, graphemes, history::UndoKind, increment::date_time::DateTimeIncrementor, increment::{number::NumberIncrementor, Increment}, @@ -4630,7 +4630,7 @@ fn shell_keep_pipe(cx: &mut Context) { for (i, range) in selection.ranges().iter().enumerate() { let fragment = range.slice(text); - let (_output, success) = match shell_impl(shell, input, Some(fragment)) { + let (_output, success) = match shell_impl(shell, input, Some(fragment.into())) { Ok(result) => result, Err(err) => { cx.editor.set_error(err.to_string()); @@ -4658,13 +4658,17 @@ fn shell_keep_pipe(cx: &mut Context) { ); } -fn shell_impl( +fn shell_impl(shell: &[String], cmd: &str, input: Option) -> anyhow::Result<(Tendril, bool)> { + tokio::task::block_in_place(|| helix_lsp::block_on(shell_impl_async(shell, cmd, input))) +} + +async fn shell_impl_async( shell: &[String], cmd: &str, - input: Option, + input: Option, ) -> anyhow::Result<(Tendril, bool)> { - use std::io::Write; - use std::process::{Command, Stdio}; + use std::process::Stdio; + use tokio::process::Command; ensure!(!shell.is_empty(), "No shell set"); let mut process = Command::new(&shell[0]); @@ -4687,13 +4691,22 @@ fn shell_impl( return Err(e.into()); } }; - if let Some(input) = input { - let mut stdin = process.stdin.take().unwrap(); - for chunk in input.chunks() { - stdin.write_all(chunk.as_bytes())?; - } - } - let output = process.wait_with_output()?; + let output = if let Some(mut stdin) = process.stdin.take() { + let input_task = tokio::spawn(async move { + if let Some(input) = input { + helix_view::document::to_writer(&mut stdin, encoding::UTF_8, &input).await?; + } + Ok::<_, anyhow::Error>(()) + }); + let (output, _) = tokio::join! { + process.wait_with_output(), + input_task, + }; + output? + } else { + // Process has no stdin, so we just take the output + process.wait_with_output().await? + }; if !output.status.success() { if !output.stderr.is_empty() { @@ -4731,7 +4744,7 @@ fn shell(cx: &mut compositor::Context, cmd: &str, behavior: &ShellBehavior) { for range in selection.ranges() { let fragment = range.slice(text); - let (output, success) = match shell_impl(shell, cmd, pipe.then(|| fragment)) { + let (output, success) = match shell_impl(shell, cmd, pipe.then(|| fragment.into())) { Ok(result) => result, Err(err) => { cx.editor.set_error(err.to_string()); From b5e7501935472f4e68bf42ac9759d54688ccb5e6 Mon Sep 17 00:00:00 2001 From: Jaden Date: Sat, 29 Oct 2022 08:33:23 -0700 Subject: [PATCH 002/491] feat(lang): add kdl grammar (#4481) --- book/src/generated/lang-support.md | 1 + languages.toml | 12 ++++++++++++ runtime/queries/kdl/highlights.scm | 22 ++++++++++++++++++++++ 3 files changed, 35 insertions(+) create mode 100644 runtime/queries/kdl/highlights.scm diff --git a/book/src/generated/lang-support.md b/book/src/generated/lang-support.md index c166af2967ed..ee54114a8680 100644 --- a/book/src/generated/lang-support.md +++ b/book/src/generated/lang-support.md @@ -60,6 +60,7 @@ | jsonnet | ✓ | | | `jsonnet-language-server` | | jsx | ✓ | ✓ | ✓ | `typescript-language-server` | | julia | ✓ | | | `julia` | +| kdl | ✓ | | | | | kotlin | ✓ | | | `kotlin-language-server` | | latex | ✓ | ✓ | | `texlab` | | lean | ✓ | | | `lean` | diff --git a/languages.toml b/languages.toml index c5c45afc5017..31a454b0c764 100644 --- a/languages.toml +++ b/languages.toml @@ -1885,3 +1885,15 @@ grammar = "vhs" [[grammar]] name = "vhs" source = { git = "https://github.com/charmbracelet/tree-sitter-vhs", rev = "c6d81f34c011c29ee86dd73b45a8ecc9f2e2bdaf" } + +[[language]] +name = "kdl" +scope = "source.kdl" +file-types = ["kdl"] +roots = [] +comment-token = "//" +injection-regex = "kdl" + +[[grammar]] +name = "kdl" +source = { git = "https://github.com/Unoqwy/tree-sitter-kdl", rev = "e1cd292c6d15df6610484e1d4b5c987ecad52373" } diff --git a/runtime/queries/kdl/highlights.scm b/runtime/queries/kdl/highlights.scm new file mode 100644 index 000000000000..d83bde19ceed --- /dev/null +++ b/runtime/queries/kdl/highlights.scm @@ -0,0 +1,22 @@ +(comment) @comment +(single_line_comment) @comment + +(node + name: (identifier) @function) +(prop (identifier) @attribute) +(type) @type + +(bare_identifier) @variable.other.member + +(keyword) @keyword + +(string) @string +(number) @constant.numeric +(boolean) @constant.builtin.boolean + +"." @punctuation.delimiter + +"=" @operator + +"{" @punctuation.bracket +"}" @punctuation.bracket From e3eaad14790fb72995ce233a7cd6cd8c249997c0 Mon Sep 17 00:00:00 2001 From: Kristoffer Flottorp <2630397+krfl@users.noreply.github.com> Date: Sat, 29 Oct 2022 17:35:35 +0200 Subject: [PATCH 003/491] Fleetish: Adjustments to resemble official theme and reworked diagnostics to reduce subconjunctival hemorrhage (#4487) --- runtime/themes/fleetish.toml | 53 +++++++++++++++++------------------- 1 file changed, 25 insertions(+), 28 deletions(-) diff --git a/runtime/themes/fleetish.toml b/runtime/themes/fleetish.toml index a5b09fe4b189..74340cae8de3 100644 --- a/runtime/themes/fleetish.toml +++ b/runtime/themes/fleetish.toml @@ -1,11 +1,11 @@ # Author: Kristoffer Flottorp -# Based on a few screenshots of Jetbrains Fleet +# A take on the JetBrains Fleet theme sprinkled with some creative freedom -"type" = { fg = "orange" } # .builtin -"constructor" = { fg = "orange" } -"constant" = { fg = "green" } +"type" = { fg = "yellow" } # .builtin +"constructor" = { fg = "yellow" } +"constant" = { fg = "cyan" } # "constant.builtin" = {} # .boolean -"constant.builtin.boolean" = { fg = "green" } # .boolean +"constant.builtin.boolean" = { fg = "cyan" } # .boolean # "constant.character" = {} #.escape "constant.numeric" = { fg = "yellow" } # .integer / .float "string" = { fg = "pink" } # .regexp @@ -16,31 +16,31 @@ "variable" = { fg = "light" } # .builtin / .parameter # "variable.other" = {} # .member "variable.other.member" = { fg = "purple" } -"label" = { fg = "orange" } +"label" = { fg = "yellow" } # "punctuation" = {} # .delimiter / .bracket -"keyword" = { fg = "green" } # .operator / .directive / .function +"keyword" = { fg = "cyan" } # .operator / .directive / .function # "keyword.control" = { fg = "orange" } # .conditional / .repeat / .import / .return / .exception "operator" = { fg = "light" } "function" = { fg = "blue" } # .builtin / .method / .macro / .special -"function.macro" = { fg = "yellow" } -"function.special" = { fg = "yellow" } -"tag" = { fg = "yellow" } -"special" = { fg = "yellow" } +"function.macro" = { fg = "green" } +"function.special" = { fg = "green" } +"tag" = { fg = "green"} +"special" = { fg = "green" } "namespace" = { fg = "light" } "markup" = { fg = "purple" } # .bold / .italic / .quote "markup.heading" = { fg = "light" } # .marker / .1 / .2 / .3 / .4 / .5 / .6 -"markup.heading.1" = { fg = "orange" } -"markup.heading.2" = { fg = "yellow" } +"markup.heading.1" = { fg = "yellow" } +"markup.heading.2" = { fg = "green" } "markup.heading.3" = { fg = "pink" } "markup.heading.4" = { fg = "purple" } -"markup.heading.5" = { fg = "green" } +"markup.heading.5" = { fg = "cyan" } "markup.heading.6" = { fg = "blue" } -"markup.list" = { fg = "green" } # .unnumbered / .numbered -"markup.link" = { fg = "yellow" } # .url / .label / .text +"markup.list" = { fg = "cyan" } # .unnumbered / .numbered +"markup.link" = { fg = "green" } # .url / .label / .text "markup.raw" = { fg = "pink" } # .inline / .block # "diff" = {} # .plus / .minus -"diff.plus" = { fg = "green" } -"diff.minus" = { fg = "orange" } +"diff.plus" = { fg = "cyan" } +"diff.minus" = { fg = "yellow" } "diff.delta" = { fg = "purple" } # .moved # used in theming @@ -74,11 +74,7 @@ "info" = { fg = "yellow_accent" } "warning" = { fg = "orange_accent" } "error" = { fg = "diff_red_accent" } -"diagnostic" = { fg = "orange", bg = "darkest" } # .hint / .info / .warning / .error -"diagnostic.hint" = { fg = "lightest", bg = "blue_accent" } -"diagnostic.info" = { fg = "lightest", bg = "purple_accent" } -"diagnostic.warning" = { fg = "lightest", bg = "yellow_accent" } -"diagnostic.error" = { fg = "lightest", bg = "orange_accent" } +"diagnostic". underline = { style = "curl" } [palette] darkest = "#0F0F0F" @@ -91,12 +87,13 @@ lightest = "#FFFFFF" dark_gray = "#5B5B5B" light_gray = "#757575" -purple = "#A096F9" -blue = "#52A7F6" -pink = "#E878DE" -green = "#78D0BD" +purple = "#AC9CF9" +blue = "#52A7F6" #"#94C1FA" +pink = "#D898D8" +green = "#AFCB85" +cyan = "#78D0BD" orange = "#ECA775" -yellow = "#F9CA6A" +yellow = "#E5C995" purple_accent = "#6363EE" blue_accent = "#2197F3" From 2935e9da197442620578e07d87cd0607ae4145f1 Mon Sep 17 00:00:00 2001 From: Poliorcetics Date: Sat, 29 Oct 2022 17:36:26 +0200 Subject: [PATCH 004/491] feat: Categorize Rust's keywords using more specific scopes (#4510) --- runtime/queries/rust/highlights.scm | 36 +++++++++++++++++++---------- 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/runtime/queries/rust/highlights.scm b/runtime/queries/rust/highlights.scm index 81f05f7a3d33..0afb8388efbb 100644 --- a/runtime/queries/rust/highlights.scm +++ b/runtime/queries/rust/highlights.scm @@ -111,23 +111,31 @@ ; ------- (for_expression - "for" @keyword.control) + "for" @keyword.control.repeat) ((identifier) @keyword.control (#match? @keyword.control "^yield$")) + +"in" @keyword.control + +[ + "match" + "if" + "else" +] @keyword.control.conditional + [ "while" "loop" - "in" +] @keyword.control.repeat + +[ "break" "continue" - "match" - "if" - "else" "return" "await" -] @keyword.control +] @keyword.control.return "use" @keyword.control.import (mod_item "mod" @keyword.control.import !body) @@ -143,24 +151,28 @@ "mod" "extern" - "struct" - "enum" "impl" "where" "trait" "for" - "type" - "union" "unsafe" "default" "macro_rules!" - "let" - "async" ] @keyword +[ + "struct" + "enum" + "union" + + "type" +] @keyword.storage.type + +"let" @keyword.storage + "fn" @keyword.function (mutable_specifier) @keyword.storage.modifier.mut From f054a3f3ed445cdfa8c0dc63698659ef30af57b7 Mon Sep 17 00:00:00 2001 From: Matthew Toohey Date: Sat, 29 Oct 2022 16:41:28 -0400 Subject: [PATCH 005/491] feat(lang): add xml (#4518) --- book/src/generated/lang-support.md | 1 + languages.toml | 20 ++++++++++++++ runtime/queries/xml/highlights.scm | 42 ++++++++++++++++++++++++++++++ runtime/queries/xml/indents.scm | 1 + runtime/queries/xml/injections.scm | 2 ++ 5 files changed, 66 insertions(+) create mode 100644 runtime/queries/xml/highlights.scm create mode 100644 runtime/queries/xml/indents.scm create mode 100644 runtime/queries/xml/injections.scm diff --git a/book/src/generated/lang-support.md b/book/src/generated/lang-support.md index ee54114a8680..545ec635b4b9 100644 --- a/book/src/generated/lang-support.md +++ b/book/src/generated/lang-support.md @@ -127,5 +127,6 @@ | wat | ✓ | | | | | wgsl | ✓ | | | `wgsl_analyzer` | | xit | ✓ | | | | +| xml | ✓ | | ✓ | | | yaml | ✓ | | ✓ | `yaml-language-server` | | zig | ✓ | ✓ | ✓ | `zls` | diff --git a/languages.toml b/languages.toml index 31a454b0c764..00e6459dee2d 100644 --- a/languages.toml +++ b/languages.toml @@ -1897,3 +1897,23 @@ injection-regex = "kdl" [[grammar]] name = "kdl" source = { git = "https://github.com/Unoqwy/tree-sitter-kdl", rev = "e1cd292c6d15df6610484e1d4b5c987ecad52373" } + +[[language]] +name = "xml" +scope = "source.xml" +injection-regex = "xml" +file-types = ["xml"] +indent = { tab-width = 2, unit = " " } +roots = [] + +[language.auto-pairs] +'(' = ')' +'{' = '}' +'[' = ']' +'"' = '"' +"'" = "'" +"<" = ">" + +[[grammar]] +name = "xml" +source = { git = "https://github.com/RenjiSann/tree-sitter-xml", rev = "422528a43630db6dcc1e222d1c5ee3babd559473" } diff --git a/runtime/queries/xml/highlights.scm b/runtime/queries/xml/highlights.scm new file mode 100644 index 000000000000..d5940c8a0691 --- /dev/null +++ b/runtime/queries/xml/highlights.scm @@ -0,0 +1,42 @@ +(comment) @comment + +[ + "DOCTYPE" + "ELEMENT" + "ATTLIST" +] @keyword + +[ + "#REQUIRED" + "#IMPLIED" + "#FIXED" + "#PCDATA" +] @keyword.directive + +[ + "EMPTY" + "ANY" + "SYSTEM" + "PUBLIC" +] @constant + +(doctype) @variable +(element_name) @variable + +"xml" @tag +(tag_name) @tag + +[ + "encoding" + "version" + "standalone" +] @attribute +(attribute_name) @attribute + +(system_literal) @string +(pubid_literal) @string +(attribute_value) @string + +[ + "<" ">" "" "" " Date: Sat, 29 Oct 2022 17:23:18 -0400 Subject: [PATCH 006/491] fix: make `scroll` aware of tabs and wide characters (#4519) --- helix-term/src/commands.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index 172a7b2e7fd0..adb4802d8f45 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -1360,7 +1360,7 @@ pub fn scroll(cx: &mut Context, offset: usize, direction: Direction) { let range = doc.selection(view.id).primary(); let text = doc.text().slice(..); - let cursor = coords_at_pos(text, range.cursor(text)); + let cursor = visual_coords_at_pos(text, range.cursor(text), doc.tab_width()); let doc_last_line = doc.text().len_lines().saturating_sub(1); let last_line = view.last_line(doc); @@ -1392,7 +1392,7 @@ pub fn scroll(cx: &mut Context, offset: usize, direction: Direction) { // If cursor needs moving, replace primary selection if line != cursor.row { - let head = pos_at_coords(text, Position::new(line, cursor.col), true); // this func will properly truncate to line end + let head = pos_at_visual_coords(text, Position::new(line, cursor.col), doc.tab_width()); // this func will properly truncate to line end let anchor = if cx.editor.mode == Mode::Select { range.anchor From 908529ccac153c12fd3b8e051a8f8ef68120d94d Mon Sep 17 00:00:00 2001 From: Triton171 Date: Sun, 30 Oct 2022 17:45:58 +0100 Subject: [PATCH 007/491] Update LaTex grammar (#4528) Fix comment injection & add highlighting for math delimiters. --- languages.toml | 2 +- runtime/queries/latex/highlights.scm | 6 ++++++ runtime/queries/latex/injections.scm | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/languages.toml b/languages.toml index 00e6459dee2d..73915fc29484 100644 --- a/languages.toml +++ b/languages.toml @@ -570,7 +570,7 @@ indent = { tab-width = 4, unit = "\t" } [[grammar]] name = "latex" -source = { git = "https://github.com/latex-lsp/tree-sitter-latex", rev = "b3b2cf27f33e71438ebe46934900b1153901c6f2" } +source = { git = "https://github.com/latex-lsp/tree-sitter-latex", rev = "8c75e93cd08ccb7ce1ccab22c1fbd6360e3bcea6" } [[language]] name = "lean" diff --git a/runtime/queries/latex/highlights.scm b/runtime/queries/latex/highlights.scm index e39226a276c1..3174d80b939c 100644 --- a/runtime/queries/latex/highlights.scm +++ b/runtime/queries/latex/highlights.scm @@ -29,6 +29,12 @@ (#eq? @punctuation.delimiter "&")) ["[" "]" "{" "}"] @punctuation.bracket ; "(" ")" has no syntactical meaning in LaTeX +(math_delimiter + left_command: _ @punctuation.delimiter + left_delimiter: _ @punctuation.delimiter + right_command: _ @punctuation.delimiter + right_delimiter: _ @punctuation.delimiter +) ;; General environments (begin diff --git a/runtime/queries/latex/injections.scm b/runtime/queries/latex/injections.scm index 321c90add371..d3fdb0ca7178 100644 --- a/runtime/queries/latex/injections.scm +++ b/runtime/queries/latex/injections.scm @@ -1,2 +1,2 @@ -((comment) @injection.content +((line_comment) @injection.content (#set! injection.language "comment")) From f6710879d1a1e587d17800682ba0e1045f35e7a9 Mon Sep 17 00:00:00 2001 From: seshotake <116971836+seshotake@users.noreply.github.com> Date: Sun, 30 Oct 2022 16:54:37 +0000 Subject: [PATCH 008/491] Update SQL grammar (#4529) --- languages.toml | 2 +- runtime/queries/sql/highlights.scm | 52 ++++++++++++++++++++++++++---- 2 files changed, 46 insertions(+), 8 deletions(-) diff --git a/languages.toml b/languages.toml index 73915fc29484..9c0293f0bb55 100644 --- a/languages.toml +++ b/languages.toml @@ -1371,7 +1371,7 @@ injection-regex = "sql" [[grammar]] name = "sql" -source = { git = "https://github.com/DerekStride/tree-sitter-sql", rev = "0caa7fa2ee00e0b770493a79d4efacc1fc376cc5" } +source = { git = "https://github.com/DerekStride/tree-sitter-sql", rev = "2743c7b5e710e6854d4e8c14c302548b436e2a1f" } [[language]] name = "gdscript" diff --git a/runtime/queries/sql/highlights.scm b/runtime/queries/sql/highlights.scm index 5025352e7ecc..ece8be333c78 100644 --- a/runtime/queries/sql/highlights.scm +++ b/runtime/queries/sql/highlights.scm @@ -1,3 +1,34 @@ +(keyword_gist) @function.builtin +(keyword_btree) @function.builtin +(keyword_btree) @function.builtin +(keyword_hash) @function.builtin +(keyword_spgist) @function.builtin +(keyword_gin) @function.builtin +(keyword_brin) @function.builtin +(keyword_float) @function.builtin + +(invocation + name: (identifier) @function.builtin + parameter: [(field)]? @variable.other.member) + +(count + name: (identifier) @function.builtin + parameter: [(field)]? @variable.other.member) + +(table_reference + name: (identifier) @namespace) + +(relation + table_alias: (identifier) @variable.parameter) + +(field + name: (identifier) @variable.other.member) + +(field + table_alias: (identifier) @variable.parameter + name: (identifier) @variable.other.member) + + (comment) @comment [ @@ -5,6 +36,12 @@ ")" ] @punctuation.bracket +[ + ";" + "," + "." +] @punctuation.delimiter + [ "*" "+" @@ -29,11 +66,8 @@ (literal) @string -(set_schema schema: (identifier) @namespace) -(table_reference schema: (identifier) @namespace) -(table_expression schema: (identifier) @namespace) -(all_fields schema: (identifier) @namespace) -(field schema: (identifier) @namespace) +((literal) @constant.numeric + (#match? @constant.numeric "^(-?\d*\.?\d*)$")) [ (keyword_select) @@ -54,8 +88,10 @@ (keyword_lateral) (keyword_on) (keyword_not) - (keyword_order_by) - (keyword_group_by) + (keyword_order) + (keyword_group) + (keyword_partition) + (keyword_by) (keyword_having) (keyword_desc) (keyword_asc) @@ -89,6 +125,8 @@ (keyword_auto_increment) (keyword_default) (keyword_cascade) + (keyword_between) + (keyword_window) (keyword_with) (keyword_no) (keyword_data) From f41f28b6627bd2ae0152f468cde80df167889a2d Mon Sep 17 00:00:00 2001 From: Konstantin Podsvirov Date: Sun, 30 Oct 2022 19:55:31 +0300 Subject: [PATCH 009/491] Update windows install instructions (#4530) --- book/src/install.md | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/book/src/install.md b/book/src/install.md index 6e2a1f3dfafc..a041d6511926 100644 --- a/book/src/install.md +++ b/book/src/install.md @@ -52,7 +52,8 @@ sudo xbps-install helix ## Windows -Helix can be installed using [Scoop](https://scoop.sh/) or [Chocolatey](https://chocolatey.org/). +Helix can be installed using [Scoop](https://scoop.sh/), [Chocolatey](https://chocolatey.org/) +or [MSYS2](https://msys2.org/). **Scoop:** @@ -66,6 +67,23 @@ scoop install helix choco install helix ``` +**MSYS2:** + +``` +pacman -S mingw-w64-i686-helix +``` + +or + +``` +pacman -S mingw-w64-x86_64-helix +``` + +or + +``` +pacman -S mingw-w64-ucrt-x86_64-helix +``` ## Build from source From df3c6412acc2c0948450653a67a4993092abf5fb Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 31 Oct 2022 18:21:51 -0500 Subject: [PATCH 010/491] build(deps): bump cachix/cachix-action from 11 to 12 (#4547) Bumps [cachix/cachix-action](https://github.com/cachix/cachix-action) from 11 to 12. - [Release notes](https://github.com/cachix/cachix-action/releases) - [Commits](https://github.com/cachix/cachix-action/compare/v11...v12) --- updated-dependencies: - dependency-name: cachix/cachix-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/cachix.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cachix.yml b/.github/workflows/cachix.yml index bc72bb78df21..20035678707a 100644 --- a/.github/workflows/cachix.yml +++ b/.github/workflows/cachix.yml @@ -17,7 +17,7 @@ jobs: uses: cachix/install-nix-action@v18 - name: Authenticate with Cachix - uses: cachix/cachix-action@v11 + uses: cachix/cachix-action@v12 with: name: helix authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} From 9df43584924a72be88f537ac432e5976430fa3f1 Mon Sep 17 00:00:00 2001 From: hh9527 Date: Tue, 1 Nov 2022 07:48:01 +0800 Subject: [PATCH 011/491] Support WIT grammar (#4525) --- book/src/generated/lang-support.md | 1 + languages.toml | 22 ++++++++++ runtime/queries/wit/highlights.scm | 67 ++++++++++++++++++++++++++++++ runtime/queries/wit/indents.scm | 13 ++++++ 4 files changed, 103 insertions(+) create mode 100644 runtime/queries/wit/highlights.scm create mode 100644 runtime/queries/wit/indents.scm diff --git a/book/src/generated/lang-support.md b/book/src/generated/lang-support.md index 545ec635b4b9..38d121b5ac64 100644 --- a/book/src/generated/lang-support.md +++ b/book/src/generated/lang-support.md @@ -126,6 +126,7 @@ | wast | ✓ | | | | | wat | ✓ | | | | | wgsl | ✓ | | | `wgsl_analyzer` | +| wit | ✓ | | ✓ | | | xit | ✓ | | | | | xml | ✓ | | ✓ | | | yaml | ✓ | | ✓ | `yaml-language-server` | diff --git a/languages.toml b/languages.toml index 9c0293f0bb55..ee31f3728c4d 100644 --- a/languages.toml +++ b/languages.toml @@ -1917,3 +1917,25 @@ roots = [] [[grammar]] name = "xml" source = { git = "https://github.com/RenjiSann/tree-sitter-xml", rev = "422528a43630db6dcc1e222d1c5ee3babd559473" } + +[[language]] +name = "wit" +scope = "source.wit" +injection-regex = "wit" +file-types = ["wit"] +roots = [] +comment-token = "//" +indent = { tab-width = 2, unit = " " } + +[language.auto-pairs] +'(' = ')' +'{' = '}' +'[' = ']' +'"' = '"' +"'" = "'" +"<" = ">" + +[[grammar]] +name = "wit" +source = { git = "https://github.com/hh9527/tree-sitter-wit", rev = "c917790ab9aec50c5fd664cbfad8dd45110cfff3" } + diff --git a/runtime/queries/wit/highlights.scm b/runtime/queries/wit/highlights.scm new file mode 100644 index 000000000000..45754a5a8df2 --- /dev/null +++ b/runtime/queries/wit/highlights.scm @@ -0,0 +1,67 @@ +(line_comment) @comment.line +(block_comment) @comment.block +(ty (ident) @type) + +(item_type name: (ident) @type) +(item_record name: (ident) @type) +(item_variant name: (ident) @type) +(item_flags name: (ident) @type) +(item_enum name: (ident) @type) +(item_union name: (ident) @type) +(item_resource name: (ident) @type) + +(item_use from: (ident) @namespace) +(use_item name: (ident) @type) +(item_func name: (ident) @function) +(method name: (ident) @function.method) +(fields (named_ty name: (ident) @variable.other.member)) +(input (args (named_ty name: (ident) @variable.parameter))) +(output (args (named_ty name: (ident) @variable.other.member))) +(flags (ident) @constant) +(enum_items (ident) @constant) +(variant_item tag: (ident) @type.enum.variant) + +[ + (unit) + + "u8" "u16" "u32" "u64" + "s8" "s16" "s32" "s64" + "float32" "float64" + "char" "bool" "string" +] @type.builtin + +[ + "list" + "option" + "result" + "tuple" + "future" + "stream" +] @function.macro + +[ "," ":" ] @punctuation.delimiter +[ "(" ")" "{" "}" "<" ">" ] @punctuation.bracket +[ "=" "->" ] @operator + +[ + "record" + "flags" + "variant" + "enum" + "union" + "type" + "resource" +] @keyword.storage.type + +"func" @keyword + +[ + "static" +] @keyword.storage.modifier + +[ + (star) + "use" + "as" + "from" +] @keyword.control.import diff --git a/runtime/queries/wit/indents.scm b/runtime/queries/wit/indents.scm new file mode 100644 index 000000000000..db6c148bf52f --- /dev/null +++ b/runtime/queries/wit/indents.scm @@ -0,0 +1,13 @@ +[ + (use_items) + (fields) + (variant_items) + (variant_payload) + (flags) + (enum_items) + (union_items) + (args) + (resource_items) +] @indent + +[ "}" ")" ] @outdent From ed7ea8c9ba639daebdbc81630bd789aeb344e2d4 Mon Sep 17 00:00:00 2001 From: seshotake <116971836+seshotake@users.noreply.github.com> Date: Tue, 1 Nov 2022 02:23:09 +0200 Subject: [PATCH 012/491] add highlights for env and ini file formats (#4536) --- book/src/generated/lang-support.md | 2 ++ languages.toml | 27 ++++++++++++++++++++++++++- runtime/queries/env/highlights.scm | 19 +++++++++++++++++++ runtime/queries/ini/highlights.scm | 6 ++++++ 4 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 runtime/queries/env/highlights.scm create mode 100644 runtime/queries/ini/highlights.scm diff --git a/book/src/generated/lang-support.md b/book/src/generated/lang-support.md index 38d121b5ac64..411e67b8a974 100644 --- a/book/src/generated/lang-support.md +++ b/book/src/generated/lang-support.md @@ -27,6 +27,7 @@ | elixir | ✓ | ✓ | | `elixir-ls` | | elm | ✓ | | | `elm-language-server` | | elvish | ✓ | | | `elvish` | +| env | ✓ | | | | | erb | ✓ | | | | | erlang | ✓ | ✓ | | `erlang_ls` | | esdl | ✓ | | | | @@ -53,6 +54,7 @@ | html | ✓ | | | `vscode-html-language-server` | | idris | | | | `idris2-lsp` | | iex | ✓ | | | | +| ini | ✓ | | | | | java | ✓ | | | `jdtls` | | javascript | ✓ | ✓ | ✓ | `typescript-language-server` | | jsdoc | ✓ | | | | diff --git a/languages.toml b/languages.toml index ee31f3728c4d..95c37945a8c6 100644 --- a/languages.toml +++ b/languages.toml @@ -1938,4 +1938,29 @@ indent = { tab-width = 2, unit = " " } [[grammar]] name = "wit" source = { git = "https://github.com/hh9527/tree-sitter-wit", rev = "c917790ab9aec50c5fd664cbfad8dd45110cfff3" } - + +[[language]] +name = "env" +scope = "source.env" +file-types = [".env", ".env.local", ".env.development", ".env.production"] +injection-regex = "env" +comment-token = "#" +indent = { tab-width = 4, unit = "\t" } +roots = [] + +[[grammar]] +name = "env" +source = { git = "https://github.com/seshotake/tree-sitter-env", rev = "e6c6bb1e7b51d481cba463fe949f083cf22d81f7" } + +[[language]] +name = "ini" +scope = "source.ini" +file-types = ["ini"] +injection-regex = "ini" +comment-token = "#" +indent = { tab-width = 4, unit = "\t" } +roots = [] + +[[grammar]] +name = "ini" +source = { git = "https://github.com/justinmk/tree-sitter-ini", rev = "4d247fb876b4ae6b347687de4a179511bf67fcbc" } diff --git a/runtime/queries/env/highlights.scm b/runtime/queries/env/highlights.scm new file mode 100644 index 000000000000..6a27e8e5a049 --- /dev/null +++ b/runtime/queries/env/highlights.scm @@ -0,0 +1,19 @@ +(env_variable (quoted_string)) @string +(env_variable (unquoted_string)) @string + +(env_key) @keyword + +((variable) @keyword + (#match? @keyword "^([A-Z][A-Z_0-9]*)$")) + +[ + "{" + "}" +] @punctuation.bracket + +[ + "$" + "=" +] @operator + +(comment) @comment \ No newline at end of file diff --git a/runtime/queries/ini/highlights.scm b/runtime/queries/ini/highlights.scm new file mode 100644 index 000000000000..6277a0676b0d --- /dev/null +++ b/runtime/queries/ini/highlights.scm @@ -0,0 +1,6 @@ +(section_name) @namespace + +(setting_name) @keyword +(setting_value) @string + +(comment) @comment From 9b247b1104ab34d55ca383daafab2a26dae31253 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Ho=C3=9F?= Date: Tue, 1 Nov 2022 01:27:53 +0100 Subject: [PATCH 013/491] Update SSH client config grammar & highlight queries (#4538) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Sebastian Hoß --- languages.toml | 2 +- .../queries/sshclientconfig/highlights.scm | 170 +++++++++--------- 2 files changed, 86 insertions(+), 86 deletions(-) diff --git a/languages.toml b/languages.toml index 95c37945a8c6..adce81c5948e 100644 --- a/languages.toml +++ b/languages.toml @@ -1518,7 +1518,7 @@ roots = [] [[grammar]] name = "sshclientconfig" -source = { git = "https://github.com/metio/tree-sitter-ssh-client-config", rev = "769d7a01a2e5493b4bb5a51096c6bf4be130b024" } +source = { git = "https://github.com/metio/tree-sitter-ssh-client-config", rev = "e45c6d5c71657344d4ecaf87dafae7736f776c57" } [[language]] name = "scheme" diff --git a/runtime/queries/sshclientconfig/highlights.scm b/runtime/queries/sshclientconfig/highlights.scm index 83a212a20a42..b54da58758ee 100644 --- a/runtime/queries/sshclientconfig/highlights.scm +++ b/runtime/queries/sshclientconfig/highlights.scm @@ -1,17 +1,17 @@ -(host) @keyword -(host_value) @identifier +(host) @namespace +(host_value) @string -(match) @keyword -(match_value) @identifier +(match) @namespace +(match_value) @string (add_keys_to_agent) @keyword -(add_keys_to_agent_value) @boolean +(add_keys_to_agent_value) @constant.builtin.boolean (address_family) @keyword -(address_family_value) @type +(address_family_value) @constant.builtin (batch_mode) @keyword -(batch_mode_value) @boolean +(batch_mode_value) @constant.builtin.boolean (bind_address) @keyword (bind_address_value) @string @@ -20,165 +20,165 @@ (bind_interface_value) @string (canonical_domains) @keyword -(canonical_domains_value) @identifier +(canonical_domains_value) @string (canonicalize_fallback_local) @keyword -(canonicalize_fallback_local_value) @boolean +(canonicalize_fallback_local_value) @constant.builtin.boolean (canonicalize_hostname) @keyword -(canonicalize_hostname_value) @boolean +(canonicalize_hostname_value) @constant.builtin (canonicalize_max_dots) @keyword -(canonicalize_max_dots_value) @number +(canonicalize_max_dots_value) @constant.numeric.integer (canonicalize_permitted_cnames) @keyword -(canonicalize_permitted_cnames_value) @identifier +(canonicalize_permitted_cnames_value) @string (ca_signature_algorithms) @keyword -(ca_signature_algorithms_value) @identifier +(ca_signature_algorithms_value) @string (certificate_file) @keyword -(certificate_file_value) @file +(certificate_file_value) @string.special.path (challenge_response_authentication) @keyword -(challenge_response_authentication_value) @boolean +(challenge_response_authentication_value) @constant.builtin.boolean (check_host_ip) @keyword -(check_host_ip_value) @boolean +(check_host_ip_value) @constant.builtin.boolean (cipher) @keyword -(cipher_value) @identifier +(cipher_value) @string (ciphers) @keyword -(ciphers_value) @identifier +(ciphers_value) @string (clear_all_forwardings) @keyword -(clear_all_forwardings_value) @boolean +(clear_all_forwardings_value) @constant.builtin.boolean (comment) @comment (compression) @keyword -(compression_value) @boolean +(compression_value) @constant.builtin.boolean (connect_timeout) @keyword -(connect_timeout_value) @number +(connect_timeout_value) @constant.numeric.integer (connection_attempts) @keyword -(connection_attempts_value) @number +(connection_attempts_value) @constant.numeric.integer (control_master) @keyword -(control_master_value) @type +(control_master_value) @constant.builtin (control_path) @keyword -(control_path_value) @file +(control_path_value) @string.special.path (control_persist) @keyword -(control_persist_value) @type +(control_persist_value) @constant.builtin (dynamic_forward) @keyword (dynamic_forward_value) @string (enable_ssh_keysign) @keyword -(enable_ssh_keysign_value) @boolean +(enable_ssh_keysign_value) @constant.builtin.boolean (escape_char) @keyword -(escape_char_value) @string +(escape_char_value) @constant.character.escape (exit_on_forward_failure) @keyword -(exit_on_forward_failure_value) @boolean +(exit_on_forward_failure_value) @constant.builtin.boolean (fingerprint_hash) @keyword -(fingerprint_hash_value) @identifier +(fingerprint_hash_value) @constant.builtin (fork_after_authentication) @keyword -(fork_after_authentication_value) @boolean +(fork_after_authentication_value) @constant.builtin.boolean (forward_agent) @keyword -(forward_agent_value) @boolean +(forward_agent_value) @string (forward_x11) @keyword -(forward_x11_value) @boolean +(forward_x11_value) @constant.builtin.boolean (forward_x11_timeout) @keyword -(forward_x11_timeout_value) @time +(forward_x11_timeout_value) @constant.numeric.integer (forward_x11_trusted) @keyword -(forward_x11_trusted_value) @boolean +(forward_x11_trusted_value) @constant.builtin.boolean (gateway_ports) @keyword -(gateway_ports_value) @boolean +(gateway_ports_value) @constant.builtin.boolean (global_known_hosts_file) @keyword -(global_known_hosts_file_value) @file +(global_known_hosts_file_value) @string.special.path (gssapi_authentication) @keyword -(gssapi_authentication_value) @boolean +(gssapi_authentication_value) @constant.builtin.boolean (gssapi_client_identity) @keyword (gssapi_client_identity_value) @string (gssapi_delegate_credentials) @keyword -(gssapi_delegate_credentials_value) @boolean +(gssapi_delegate_credentials_value) @constant.builtin.boolean (gssapi_kex_algorithms) @keyword -(gssapi_kex_algorithms_value) @identifier +(gssapi_kex_algorithms_value) @string (gssapi_key_exchange) @keyword -(gssapi_key_exchange_value) @boolean +(gssapi_key_exchange_value) @constant.builtin.boolean (gssapi_renewal_forces_rekey) @keyword -(gssapi_renewal_forces_rekey_value) @boolean +(gssapi_renewal_forces_rekey_value) @constant.builtin.boolean (gssapi_server_identity) @keyword (gssapi_server_identity_value) @string (gssapi_trust_dns) @keyword -(gssapi_trust_dns_value) @boolean +(gssapi_trust_dns_value) @constant.builtin.boolean (hash_known_hosts) @keyword -(hash_known_hosts_value) @boolean +(hash_known_hosts_value) @constant.builtin.boolean (host_key_algorithms) @keyword -(host_key_algorithms_value) @identifier +(host_key_algorithms_value) @string (host_key_alias) @keyword (host_key_alias_value) @string (hostbased_accepted_algorithms) @keyword -(hostbased_accepted_algorithms_value) @identifier +(hostbased_accepted_algorithms_value) @string (hostbased_authentication) @keyword -(hostbased_authentication_value) @boolean +(hostbased_authentication_value) @constant.builtin.boolean (hostname) @keyword (hostname_value) @string (identities_only) @keyword -(identities_only_value) @boolean +(identities_only_value) @constant.builtin.boolean (identity_agent) @keyword (identity_agent_value) @string (identity_file) @keyword -(identity_file_value) @file +(identity_file_value) @string.special.path (ignore_unknown) @keyword (ignore_unknown_value) @string -(include) @keyword -(include_value) @file +(include) @function.macro +(include_value) @string.special.path (ip_qos) @keyword -(ip_qos_value) @type +(ip_qos_value) @constant.builtin (kbd_interactive_authentication) @keyword -(kbd_interactive_authentication_value) @boolean +(kbd_interactive_authentication_value) @constant.builtin.boolean (kbd_interactive_devices) @keyword -(kbd_interactive_devices_value) @type +(kbd_interactive_devices_value) @string (kex_algorithms) @keyword -(kex_algorithms_value) @identifier +(kex_algorithms_value) @string (known_hosts_command) @keyword (known_hosts_command_value) @string @@ -190,25 +190,25 @@ (local_forward_value) @string (log_level) @keyword -(log_level_value) @type +(log_level_value) @constant.builtin (log_verbose) @keyword (log_verbose_value) @string (macs) @keyword -(macs_value) @identifier +(macs_value) @string (no_host_authentication_for_localhost) @keyword -(no_host_authentication_for_localhost_value) @boolean +(no_host_authentication_for_localhost_value) @constant.builtin.boolean (number_of_password_prompts) @keyword -(number_of_password_prompts_value) @number +(number_of_password_prompts_value) @constant.numeric.integer (password_authentication) @keyword -(password_authentication_value) @boolean +(password_authentication_value) @constant.builtin.boolean (permit_local_command) @keyword -(permit_local_command_value) @boolean +(permit_local_command_value) @constant.builtin.boolean (permit_remote_open) @keyword (permit_remote_open_value) @string @@ -217,13 +217,13 @@ (pkcs11_provider_value) @string (port) @keyword -(port_value) @number +(port_value) @constant.numeric.integer (preferred_authentications) @keyword -(preferred_authentications_value) @type +(preferred_authentications_value) @string (protocol) @keyword -(protocol_value) @number +(protocol_value) @constant.numeric.integer (proxy_command) @keyword (proxy_command_value) @string @@ -232,16 +232,16 @@ (proxy_jump_value) @string (proxy_use_fdpass) @keyword -(proxy_use_fdpass_value) @boolean +(proxy_use_fdpass_value) @constant.builtin.boolean (pubkey_accepted_algorithms) @keyword -(pubkey_accepted_algorithms_value) @identifier +(pubkey_accepted_algorithms_value) @string (pubkey_accepted_key_types) @keyword -(pubkey_accepted_key_types_value) @identifier +(pubkey_accepted_key_types_value) @string (pubkey_authentication) @keyword -(pubkey_authentication_value) @boolean +(pubkey_authentication_value) @constant.builtin (rekey_limit) @keyword (rekey_limit_value) @string @@ -253,10 +253,10 @@ (remote_forward_value) @string (request_tty) @keyword -(request_tty_value) @type +(request_tty_value) @constant.builtin (revoked_host_keys) @keyword -(revoked_host_keys_value) @file +(revoked_host_keys_value) @string.special.path (security_key_provider) @keyword (security_key_provider_value) @string @@ -265,60 +265,60 @@ (send_env_value) @string (server_alive_count_max) @keyword -(server_alive_count_max_value) @number +(server_alive_count_max_value) @constant.numeric.integer (server_alive_interval) @keyword -(server_alive_interval_value) @number +(server_alive_interval_value) @constant.numeric.integer (session_type) @keyword -(session_type_value) @type +(session_type_value) @constant.builtin (set_env) @keyword (set_env_value) @string (stdin_null) @keyword -(stdin_null_value) @boolean +(stdin_null_value) @constant.builtin.boolean (stream_local_bind_mask) @keyword (stream_local_bind_mask_value) @string (stream_local_bind_unlink) @keyword -(stream_local_bind_unlink_value) @boolean +(stream_local_bind_unlink_value) @constant.builtin.boolean (strict_host_key_checking) @keyword -(strict_host_key_checking_value) @type +(strict_host_key_checking_value) @constant.builtin (syslog_facility) @keyword -(syslog_facility_value) @type +(syslog_facility_value) @constant.builtin (tcp_keep_alive) @keyword -(tcp_keep_alive_value) @boolean +(tcp_keep_alive_value) @constant.builtin.boolean (keep_alive) @keyword -(keep_alive_value) @boolean +(keep_alive_value) @constant.builtin.boolean (tunnel) @keyword -(tunnel_value) @type +(tunnel_value) @constant.builtin (tunnel_device) @keyword (tunnel_device_value) @string (update_host_keys) @keyword -(update_host_keys_value) @type +(update_host_keys_value) @constant.builtin (use_keychain) @keyword -(use_keychain_value) @boolean +(use_keychain_value) @constant.builtin.boolean (user) @keyword (user_value) @string (user_known_hosts_file) @keyword -(user_known_hosts_file_value) @file +(user_known_hosts_file_value) @string.special.path (verify_host_key_dns) @keyword -(verify_host_key_dns_value) @type +(verify_host_key_dns_value) @constant.builtin (visual_host_key) @keyword -(visual_host_key_value) @boolean +(visual_host_key_value) @constant.builtin.boolean (xauth_location) @keyword -(xauth_location_value) @file +(xauth_location_value) @string.special.path From 92b13f9e71c7d8adae4a6c1fa5f0135137c3c290 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 31 Oct 2022 19:29:01 -0500 Subject: [PATCH 014/491] build(deps): bump cc from 1.0.73 to 1.0.74 (#4549) Bumps [cc](https://github.com/rust-lang/cc-rs) from 1.0.73 to 1.0.74. - [Release notes](https://github.com/rust-lang/cc-rs/releases) - [Commits](https://github.com/rust-lang/cc-rs/compare/1.0.73...1.0.74) --- updated-dependencies: - dependency-name: cc dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 163b3ad48bb7..e4d4568ad4b4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -92,9 +92,9 @@ checksum = "df8670b8c7b9dae1793364eafadf7239c40d669904660c5960d74cfd80b46a53" [[package]] name = "cc" -version = "1.0.73" +version = "1.0.74" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11" +checksum = "581f5dba903aac52ea3feb5ec4810848460ee833876f1f9b0fdeab1f19091574" [[package]] name = "cfg-if" From 3792d9ebb7ffc3294987d3fae0c14511cbdbb615 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 31 Oct 2022 19:29:32 -0500 Subject: [PATCH 015/491] build(deps): bump lsp-types from 0.93.1 to 0.93.2 (#4550) Bumps [lsp-types](https://github.com/gluon-lang/lsp-types) from 0.93.1 to 0.93.2. - [Release notes](https://github.com/gluon-lang/lsp-types/releases) - [Changelog](https://github.com/gluon-lang/lsp-types/blob/master/CHANGELOG.md) - [Commits](https://github.com/gluon-lang/lsp-types/compare/v0.93.1...v0.93.2) --- updated-dependencies: - dependency-name: lsp-types dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e4d4568ad4b4..ecbc0a14d7d6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -684,9 +684,9 @@ dependencies = [ [[package]] name = "lsp-types" -version = "0.93.1" +version = "0.93.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3bcfee315dde785ba887edb540b08765fd7df75a7d948844be6bf5712246734" +checksum = "9be6e9c7e2d18f651974370d7aff703f9513e0df6e464fd795660edc77e6ca51" dependencies = [ "bitflags", "serde", From 79c7203a388e1ac7aa6aebfc2e4c9a91b6efc97a Mon Sep 17 00:00:00 2001 From: Jonas Everaert <62475953+Jomy10@users.noreply.github.com> Date: Tue, 1 Nov 2022 01:30:08 +0100 Subject: [PATCH 016/491] Added missing keywords to wat (wasm) hightlights (#4542) added "if", "then", "else", "block", "loop", "end" and "mut" to the wat highlights. --- runtime/queries/wat/highlights.scm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/runtime/queries/wat/highlights.scm b/runtime/queries/wat/highlights.scm index 007e3bbff8e0..93f03aac09c5 100644 --- a/runtime/queries/wat/highlights.scm +++ b/runtime/queries/wat/highlights.scm @@ -1,4 +1,7 @@ -["module" "func" "param" "result" "type" "memory" "elem" "data" "table" "global"] @keyword +[ + "module" "func" "param" "result" "type" "memory" "elem" "data" "table" "global" + "if" "then" "else" "block" "loop" "end" "mut" +] @keyword ["import" "export"] @keyword.control.import From e5319ea8c52d6c97ce901426c2714a26f535be0b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 31 Oct 2022 19:31:08 -0500 Subject: [PATCH 017/491] build(deps): bump once_cell from 1.15.0 to 1.16.0 (#4548) Bumps [once_cell](https://github.com/matklad/once_cell) from 1.15.0 to 1.16.0. - [Release notes](https://github.com/matklad/once_cell/releases) - [Changelog](https://github.com/matklad/once_cell/blob/master/CHANGELOG.md) - [Commits](https://github.com/matklad/once_cell/compare/v1.15.0...v1.16.0) --- updated-dependencies: - dependency-name: once_cell dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Cargo.lock | 4 ++-- helix-core/Cargo.toml | 2 +- helix-loader/Cargo.toml | 2 +- helix-term/Cargo.toml | 2 +- helix-view/Cargo.toml | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ecbc0a14d7d6..93459aa07fa6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -753,9 +753,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.15.0" +version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e82dad04139b71a90c080c8463fe0dc7902db5192d939bd0950f074d014339e1" +checksum = "86f0b0d4bf799edbc74508c1e8bf170ff5f41238e5f8225603ca7caaae2b7860" [[package]] name = "parking_lot" diff --git a/helix-core/Cargo.toml b/helix-core/Cargo.toml index 7585c347607c..45272f980058 100644 --- a/helix-core/Cargo.toml +++ b/helix-core/Cargo.toml @@ -26,7 +26,7 @@ unicode-general-category = "0.6" # slab = "0.4.2" slotmap = "1.0" tree-sitter = "0.20" -once_cell = "1.15" +once_cell = "1.16" arc-swap = "1" regex = "1" bitflags = "1.3" diff --git a/helix-loader/Cargo.toml b/helix-loader/Cargo.toml index b4541de5f147..760205e1f208 100644 --- a/helix-loader/Cargo.toml +++ b/helix-loader/Cargo.toml @@ -19,7 +19,7 @@ serde = { version = "1.0", features = ["derive"] } toml = "0.5" etcetera = "0.4" tree-sitter = "0.20" -once_cell = "1.15" +once_cell = "1.16" log = "0.4" # TODO: these two should be on !wasm32 only diff --git a/helix-term/Cargo.toml b/helix-term/Cargo.toml index 30de5589fb9c..485cabe90819 100644 --- a/helix-term/Cargo.toml +++ b/helix-term/Cargo.toml @@ -32,7 +32,7 @@ helix-dap = { version = "0.6", path = "../helix-dap" } helix-loader = { version = "0.6", path = "../helix-loader" } anyhow = "1" -once_cell = "1.15" +once_cell = "1.16" which = "4.2" diff --git a/helix-view/Cargo.toml b/helix-view/Cargo.toml index b96a537d089f..a2a88001bffd 100644 --- a/helix-view/Cargo.toml +++ b/helix-view/Cargo.toml @@ -23,7 +23,7 @@ helix-dap = { version = "0.6", path = "../helix-dap" } crossterm = { version = "0.25", optional = true } # Conversion traits -once_cell = "1.15" +once_cell = "1.16" url = "2" arc-swap = { version = "1.5.1" } From 3881fef39d01c94a09b8f5da67decc2c3ccb3660 Mon Sep 17 00:00:00 2001 From: Yusuf Bera Ertan Date: Tue, 1 Nov 2022 03:52:03 +0300 Subject: [PATCH 018/491] build(nix): update nci, fixup flake (#4537) --- flake.lock | 71 ++++++++++++----- flake.nix | 225 ++++++++++++++++++++++++++--------------------------- 2 files changed, 165 insertions(+), 131 deletions(-) diff --git a/flake.lock b/flake.lock index f28ec884d255..cfa227e31784 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,22 @@ { "nodes": { + "all-cabal-json": { + "flake": false, + "locked": { + "lastModified": 1665552503, + "narHash": "sha256-r14RmRSwzv5c+bWKUDaze6pXM7nOsiz1H8nvFHJvufc=", + "owner": "nix-community", + "repo": "all-cabal-json", + "rev": "d7c0434eebffb305071404edcf9d5cd99703878e", + "type": "github" + }, + "original": { + "owner": "nix-community", + "ref": "hackage", + "repo": "all-cabal-json", + "type": "github" + } + }, "crane": { "flake": false, "locked": { @@ -19,11 +36,11 @@ "devshell": { "flake": false, "locked": { - "lastModified": 1660811669, - "narHash": "sha256-V6lmsaLNFz41myppL0yxglta92ijkSvpZ+XVygAh+bU=", + "lastModified": 1666548262, + "narHash": "sha256-4DyN4KXqQQsCw0vCXkMThw4b5Q4/q87ZZgRb4st8COc=", "owner": "numtide", "repo": "devshell", - "rev": "c2feacb46ee69949124c835419861143c4016fb5", + "rev": "c8ce8ed81726079c398f5f29c4b68a7d6a3c2fa2", "type": "github" }, "original": { @@ -38,6 +55,7 @@ "nci", "nixpkgs" ], + "all-cabal-json": "all-cabal-json", "crane": "crane", "devshell": [ "nci", @@ -47,6 +65,7 @@ "nci", "nixpkgs" ], + "ghc-utils": "ghc-utils", "gomod2nix": [ "nci", "nixpkgs" @@ -69,11 +88,11 @@ ] }, "locked": { - "lastModified": 1662176993, - "narHash": "sha256-Sy7DsGAveDUFBb6YDsUSYZd/AcXfP/MOMIwMt/NgY84=", + "lastModified": 1666993587, + "narHash": "sha256-4cLrs+CwWnceYXnCpL5gO3bybS9CjLxUoTEKjB2QFtg=", "owner": "nix-community", "repo": "dream2nix", - "rev": "809bc5940214744eb29778a9a0b03f161979c1b2", + "rev": "2b7456e3d2f0053bc2474fb0c461dd468545277f", "type": "github" }, "original": { @@ -84,11 +103,11 @@ }, "flake-utils": { "locked": { - "lastModified": 1656928814, - "narHash": "sha256-RIFfgBuKz6Hp89yRr7+NR5tzIAbn52h8vT6vXkYjZoM=", + "lastModified": 1659877975, + "narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=", "owner": "numtide", "repo": "flake-utils", - "rev": "7e2a3b3dfd9af950a856d66b0a7d01e3c18aa249", + "rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0", "type": "github" }, "original": { @@ -97,6 +116,22 @@ "type": "github" } }, + "ghc-utils": { + "flake": false, + "locked": { + "lastModified": 1662774800, + "narHash": "sha256-1Rd2eohGUw/s1tfvkepeYpg8kCEXiIot0RijapUjAkE=", + "ref": "refs/heads/master", + "rev": "bb3a2d3dc52ff0253fb9c2812bd7aa2da03e0fea", + "revCount": 1072, + "type": "git", + "url": "https://gitlab.haskell.org/bgamari/ghc-utils" + }, + "original": { + "type": "git", + "url": "https://gitlab.haskell.org/bgamari/ghc-utils" + } + }, "nci": { "inputs": { "devshell": "devshell", @@ -109,11 +144,11 @@ ] }, "locked": { - "lastModified": 1662177071, - "narHash": "sha256-x6XF//RdZlw81tFAYM1TkjY+iQIpyMCWZ46r9o4wVQY=", + "lastModified": 1667232647, + "narHash": "sha256-cFo7G8BqYShgL9m7yD6p+SHAZ+aIt2guuF69LV235n8=", "owner": "yusdacra", "repo": "nix-cargo-integration", - "rev": "65270dea87bb82fc02102a15221677eea237680e", + "rev": "16082f7b4e42ce140a562fa630bcf8e96eadeb59", "type": "github" }, "original": { @@ -124,11 +159,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1662019588, - "narHash": "sha256-oPEjHKGGVbBXqwwL+UjsveJzghWiWV0n9ogo1X6l4cw=", + "lastModified": 1667142599, + "narHash": "sha256-OLJxsg9VqfKjFkerOxWtNIkibsCvxsv5A8wNWO1MeWk=", "owner": "nixos", "repo": "nixpkgs", - "rev": "2da64a81275b68fdad38af669afeda43d401e94b", + "rev": "412b9917cea092f3d39f9cd5dead4effd5bc4053", "type": "github" }, "original": { @@ -153,11 +188,11 @@ ] }, "locked": { - "lastModified": 1662087605, - "narHash": "sha256-Gpf2gp2JenKGf+TylX/YJpttY2bzsnvAMLdLaxoZRyU=", + "lastModified": 1667184938, + "narHash": "sha256-/kuCiXuAxiD0c0zrfDvJ1Yba3FuVdRk/ROfb393AeX4=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "60c2cfaa8b90ed8cebd18b214fac8682dcf222dd", + "rev": "8f81faec35508647ced65c44fd3e8648a5518afb", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 8cb4b66379fb..b1d3f01eb681 100644 --- a/flake.nix +++ b/flake.nix @@ -21,57 +21,124 @@ ... }: let lib = nixpkgs.lib; + ncl = nci.lib.nci-lib; mkRootPath = rel: builtins.path { path = "${toString ./.}/${rel}"; name = rel; }; + filteredSource = let + pathsToIgnore = [ + ".envrc" + ".ignore" + ".github" + "runtime" + "screenshot.png" + "book" + "contrib" + "docs" + "README.md" + "CHANGELOG.md" + "shell.nix" + "default.nix" + "grammars.nix" + "flake.nix" + "flake.lock" + ]; + ignorePaths = path: type: let + # split the nix store path into its components + components = lib.splitString "/" path; + # drop off the `/nix/hash-source` section from the path + relPathComponents = lib.drop 4 components; + # reassemble the path components + relPath = lib.concatStringsSep "/" relPathComponents; + in + lib.all (p: ! (lib.hasPrefix p relPath)) pathsToIgnore; + in + builtins.path { + name = "helix-source"; + path = toString ./.; + # filter out unnecessary paths + filter = ignorePaths; + }; outputs = nci.lib.makeOutputs { root = ./.; - renameOutputs = {"helix-term" = "helix";}; - # Set default app to hx (binary is from helix-term release build) - # Set default package to helix-term release build - defaultOutputs = { - app = "hx"; - package = "helix"; + config = common: { + outputs = { + # rename helix-term to helix since it's our main package + rename = {"helix-term" = "helix";}; + # Set default app to hx (binary is from helix-term release build) + # Set default package to helix-term release build + defaults = { + app = "hx"; + package = "helix"; + }; + }; + cCompiler.package = with common.pkgs; + if stdenv.isLinux + then gcc + else clang; + shell = { + packages = with common.pkgs; + [lld_13 cargo-flamegraph rust-analyzer] + ++ (lib.optional (stdenv.isx86_64 && stdenv.isLinux) cargo-tarpaulin) + ++ (lib.optional stdenv.isLinux lldb); + env = [ + { + name = "HELIX_RUNTIME"; + eval = "$PWD/runtime"; + } + { + name = "RUST_BACKTRACE"; + value = "1"; + } + { + name = "RUSTFLAGS"; + value = + if common.pkgs.stdenv.isLinux + then "-C link-arg=-fuse-ld=lld -C target-cpu=native -Clink-arg=-Wl,--no-rosegment" + else ""; + } + ]; + }; }; - overrides = { - cCompiler = common: - with common.pkgs; - if stdenv.isLinux - then gcc - else clang; - crateOverrides = common: _: { - helix-term = prev: { - src = builtins.path { - name = "helix-source"; - path = toString ./.; - # filter out unneeded stuff that cause rebuilds - filter = path: type: - lib.all - (n: builtins.baseNameOf path != n) - [ - ".envrc" - ".ignore" - ".github" - "runtime" - "screenshot.png" - "book" - "contrib" - "docs" - "README.md" - "shell.nix" - "default.nix" - "grammars.nix" - "flake.nix" - "flake.lock" - ]; - }; + pkgConfig = common: { + helix-term = { + # Wrap helix with runtime + wrapper = _: old: let + inherit (common) pkgs; + makeOverridableHelix = old: config: let + grammars = pkgs.callPackage ./grammars.nix config; + runtimeDir = pkgs.runCommand "helix-runtime" {} '' + mkdir -p $out + ln -s ${mkRootPath "runtime"}/* $out + rm -r $out/grammars + ln -s ${grammars} $out/grammars + ''; + helix-wrapped = + common.internal.pkgsSet.utils.wrapDerivation old + { + nativeBuildInputs = [pkgs.makeWrapper]; + makeWrapperArgs = config.makeWrapperArgs or []; + } + '' + rm -rf $out/bin + mkdir -p $out/bin + ln -sf ${old}/bin/* $out/bin/ + wrapProgram "$out/bin/hx" ''${makeWrapperArgs[@]} --set HELIX_RUNTIME "${runtimeDir}" + ''; + in + helix-wrapped + // {override = makeOverridableHelix old;}; + in + makeOverridableHelix old {}; + overrides.fix-build.overrideAttrs = prev: { + src = filteredSource; # disable fetching and building of tree-sitter grammars in the helix-term build.rs HELIX_DISABLE_AUTO_GRAMMAR_BUILD = "1"; - buildInputs = (prev.buildInputs or []) ++ [common.cCompiler.cc.lib]; + buildInputs = ncl.addBuildInputs prev [common.config.cCompiler.package.cc.lib]; # link languages and theme toml files since helix-term expects them (for tests) preConfigure = '' @@ -87,88 +154,20 @@ meta.mainProgram = "hx"; }; }; - shell = common: prev: { - packages = - prev.packages - ++ ( - with common.pkgs; - [lld_13 cargo-flamegraph rust-analyzer] - ++ (lib.optional (stdenv.isx86_64 && stdenv.isLinux) cargo-tarpaulin) - ++ (lib.optional stdenv.isLinux lldb) - ); - env = - prev.env - ++ [ - { - name = "HELIX_RUNTIME"; - eval = "$PWD/runtime"; - } - { - name = "RUST_BACKTRACE"; - value = "1"; - } - { - name = "RUSTFLAGS"; - value = - if common.pkgs.stdenv.isLinux - then "-C link-arg=-fuse-ld=lld -C target-cpu=native -Clink-arg=-Wl,--no-rosegment" - else ""; - } - ]; - }; }; }; - makeOverridableHelix = system: old: config: let - pkgs = nixpkgs.legacyPackages.${system}; - grammars = pkgs.callPackage ./grammars.nix config; - runtimeDir = pkgs.runCommand "helix-runtime" {} '' - mkdir -p $out - ln -s ${mkRootPath "runtime"}/* $out - rm -r $out/grammars - ln -s ${grammars} $out/grammars - ''; - helix-wrapped = - pkgs.runCommand "${old.name}-wrapped" - { - inherit (old) pname version meta; - - nativeBuildInputs = [pkgs.makeWrapper]; - makeWrapperArgs = config.makeWrapperArgs or []; - } - '' - mkdir -p $out - cp -r --no-preserve=mode,ownership ${old}/* $out/ - chmod +x $out/bin/* - wrapProgram "$out/bin/hx" ''${makeWrapperArgs[@]} --set HELIX_RUNTIME "${runtimeDir}" - ''; - in - helix-wrapped - // {override = makeOverridableHelix system old;}; in outputs // { - apps = - lib.mapAttrs - ( - system: apps: rec { - default = hx; - hx = { - type = "app"; - program = lib.getExe self.${system}.packages.helix; - }; - } - ) - outputs.apps; packages = lib.mapAttrs ( - system: packages: rec { - default = helix; - helix = makeOverridableHelix system helix-unwrapped {}; - helix-debug = makeOverridableHelix system helix-unwrapped-debug {}; - helix-unwrapped = packages.helix; - helix-unwrapped-debug = packages.helix-debug; - } + system: packages: + packages + // { + helix-unwrapped = packages.helix.passthru.unwrapped; + helix-unwrapped-debug = packages.helix-debug.passthru.unwrapped; + } ) outputs.packages; }; From 8584b38cfbe6ffe3e5d539ad953c413e44e90bfa Mon Sep 17 00:00:00 2001 From: Armin Ronacher Date: Tue, 1 Nov 2022 12:48:37 +0100 Subject: [PATCH 019/491] Correctly handle escaping in completion (#4316) * Correctly handle escaping in completion * Added escaping tests --- helix-core/src/shellwords.rs | 31 +++++++++++++++++++++++++++++++ helix-term/src/commands/typed.rs | 9 ++++----- helix-term/src/ui/prompt.rs | 6 +++++- 3 files changed, 40 insertions(+), 6 deletions(-) diff --git a/helix-core/src/shellwords.rs b/helix-core/src/shellwords.rs index afc83496f263..6edf3cc7e00d 100644 --- a/helix-core/src/shellwords.rs +++ b/helix-core/src/shellwords.rs @@ -1,5 +1,22 @@ use std::borrow::Cow; +/// Auto escape for shellwords usage. +pub fn escape(input: &str) -> Cow<'_, str> { + if !input.chars().any(|x| x.is_ascii_whitespace()) { + Cow::Borrowed(input) + } else if cfg!(unix) { + Cow::Owned(input.chars().fold(String::new(), |mut buf, c| { + if c.is_ascii_whitespace() { + buf.push('\\'); + } + buf.push(c); + buf + })) + } else { + Cow::Owned(format!("\"{}\"", input)) + } +} + /// Get the vec of escaped / quoted / doublequoted filenames from the input str pub fn shellwords(input: &str) -> Vec> { enum State { @@ -226,4 +243,18 @@ mod test { ]; assert_eq!(expected, result); } + + #[cfg(unix)] + fn test_escaping_unix() { + assert_eq!(escape("foobar"), Cow::Borrowed("foobar")); + assert_eq!(escape("foo bar"), Cow::Borrowed("foo\\ bar")); + assert_eq!(escape("foo\tbar"), Cow::Borrowed("foo\\\tbar")); + } + + #[test] + #[cfg(windows)] + fn test_escaping_windows() { + assert_eq!(escape("foobar"), Cow::Borrowed("foobar")); + assert_eq!(escape("foo bar"), Cow::Borrowed("\"foo bar\"")); + } } diff --git a/helix-term/src/commands/typed.rs b/helix-term/src/commands/typed.rs index 0cf75ada91e7..f4dfce7a8c53 100644 --- a/helix-term/src/commands/typed.rs +++ b/helix-term/src/commands/typed.rs @@ -2183,12 +2183,10 @@ pub(super) fn command_mode(cx: &mut Context) { static FUZZY_MATCHER: Lazy = Lazy::new(fuzzy_matcher::skim::SkimMatcherV2::default); - // we use .this over split_whitespace() because we care about empty segments - let parts = input.split(' ').collect::>(); - // simple heuristic: if there's no just one part, complete command name. // if there's a space, per command completion kicks in. - if parts.len() <= 1 { + // we use .this over split_whitespace() because we care about empty segments + if input.split(' ').count() <= 1 { let mut matches: Vec<_> = typed::TYPABLE_COMMAND_LIST .iter() .filter_map(|command| { @@ -2204,12 +2202,13 @@ pub(super) fn command_mode(cx: &mut Context) { .map(|(name, _)| (0.., name.into())) .collect() } else { + let parts = shellwords::shellwords(input); let part = parts.last().unwrap(); if let Some(typed::TypableCommand { completer: Some(completer), .. - }) = typed::TYPABLE_COMMAND_MAP.get(parts[0]) + }) = typed::TYPABLE_COMMAND_MAP.get(&parts[0] as &str) { completer(editor, part) .into_iter() diff --git a/helix-term/src/ui/prompt.rs b/helix-term/src/ui/prompt.rs index db3bd62d7589..d0991d3c00c5 100644 --- a/helix-term/src/ui/prompt.rs +++ b/helix-term/src/ui/prompt.rs @@ -1,5 +1,6 @@ use crate::compositor::{Component, Compositor, Context, Event, EventResult}; use crate::{alt, ctrl, key, shift, ui}; +use helix_core::shellwords; use helix_view::input::KeyEvent; use helix_view::keyboard::KeyCode; use std::{borrow::Cow, ops::RangeFrom}; @@ -335,7 +336,10 @@ impl Prompt { let (range, item) = &self.completion[index]; - self.line.replace_range(range.clone(), item); + // since we are using shellwords to parse arguments, make sure + // that whitespace in files is properly escaped. + let item = shellwords::escape(item); + self.line.replace_range(range.clone(), &item); self.move_end(); } From 8ff92c749287fb3ac4a68661d0ee99cb56cc6295 Mon Sep 17 00:00:00 2001 From: Poliorcetics Date: Tue, 1 Nov 2022 13:37:19 +0100 Subject: [PATCH 020/491] Add missed test attribute in #4316 (#4557) --- helix-core/src/shellwords.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/helix-core/src/shellwords.rs b/helix-core/src/shellwords.rs index 6edf3cc7e00d..e8c5945b726b 100644 --- a/helix-core/src/shellwords.rs +++ b/helix-core/src/shellwords.rs @@ -244,6 +244,7 @@ mod test { assert_eq!(expected, result); } + #[test] #[cfg(unix)] fn test_escaping_unix() { assert_eq!(escape("foobar"), Cow::Borrowed("foobar")); From c803ef8753bc828c9c68f40878d9467ead50dc0d Mon Sep 17 00:00:00 2001 From: Yuriy Gabuev Date: Tue, 1 Nov 2022 15:48:43 +0100 Subject: [PATCH 021/491] Fix `delete_char_backward` for paired characters (#4558) When backward-deleting a character, if this character and the following character form a Pair, we want to delete both. However, there is a bug that deletes both characters also if both characters are closers of some Pair. This commit fixes that by adding an additional check that the deleted character should be an opener in a Pair. Closes https://github.com/helix-editor/helix/issues/4544. --- helix-term/src/commands.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index adb4802d8f45..354394312278 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -3198,6 +3198,7 @@ pub mod insert { (Some(_x), Some(_y), Some(ap)) if range.is_single_grapheme(text) && ap.get(_x).is_some() + && ap.get(_x).unwrap().open == _x && ap.get(_x).unwrap().close == _y => // delete both autopaired characters { From 185236c3a40ef89f9978358d02b83f47ca4da0eb Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Tue, 1 Nov 2022 17:44:56 -0700 Subject: [PATCH 022/491] Fix D unittest injection query. (#4562) --- runtime/queries/d/textobjects.scm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/runtime/queries/d/textobjects.scm b/runtime/queries/d/textobjects.scm index 9ca071605e14..6e9e623a943c 100644 --- a/runtime/queries/d/textobjects.scm +++ b/runtime/queries/d/textobjects.scm @@ -4,6 +4,6 @@ (class_declaration (aggregate_body) @class.inside) @class.around (interface_declaration (aggregate_body) @class.inside) @class.around (struct_declaration (aggregate_body) @class.inside) @class.around -(unittest_declaration (block_statement) @test.insid) @test.around +(unittest_declaration (block_statement) @test.inside) @test.around (parameter) @parameter.inside -(template_parameter) @parameter.inside \ No newline at end of file +(template_parameter) @parameter.inside From db3383c76e93a696a7dedb8b644ba12b379da9b4 Mon Sep 17 00:00:00 2001 From: Jonathan LEI Date: Wed, 2 Nov 2022 09:08:25 +0800 Subject: [PATCH 023/491] Exit select mode on replace commands (#4554) --- helix-term/src/commands.rs | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index 354394312278..ee9bad980487 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -1304,6 +1304,7 @@ fn replace(cx: &mut Context) { }); apply_transaction(&transaction, doc, view); + exit_select_mode(cx); } }) } @@ -3581,18 +3582,19 @@ fn replace_with_yanked(cx: &mut Context) { }); apply_transaction(&transaction, doc, view); + exit_select_mode(cx); } } } fn replace_selections_with_clipboard_impl( - editor: &mut Editor, + cx: &mut Context, clipboard_type: ClipboardType, - count: usize, ) -> anyhow::Result<()> { - let (view, doc) = current!(editor); + let count = cx.count(); + let (view, doc) = current!(cx.editor); - match editor.clipboard_provider.get_contents(clipboard_type) { + match cx.editor.clipboard_provider.get_contents(clipboard_type) { Ok(contents) => { let selection = doc.selection(view.id); let transaction = Transaction::change_by_selection(doc.text(), selection, |range| { @@ -3605,18 +3607,20 @@ fn replace_selections_with_clipboard_impl( apply_transaction(&transaction, doc, view); doc.append_changes_to_history(view.id); - Ok(()) } - Err(e) => Err(e.context("Couldn't get system clipboard contents")), + Err(e) => return Err(e.context("Couldn't get system clipboard contents")), } + + exit_select_mode(cx); + Ok(()) } fn replace_selections_with_clipboard(cx: &mut Context) { - let _ = replace_selections_with_clipboard_impl(cx.editor, ClipboardType::Clipboard, cx.count()); + let _ = replace_selections_with_clipboard_impl(cx, ClipboardType::Clipboard); } fn replace_selections_with_primary_clipboard(cx: &mut Context) { - let _ = replace_selections_with_clipboard_impl(cx.editor, ClipboardType::Selection, cx.count()); + let _ = replace_selections_with_clipboard_impl(cx, ClipboardType::Selection); } fn paste(cx: &mut Context, pos: Paste) { From e0b034dcd1a99683efa429e55657dd68ebd9a301 Mon Sep 17 00:00:00 2001 From: Yuriy Date: Tue, 1 Nov 2022 18:01:01 +0100 Subject: [PATCH 024/491] Add syntax highlighting for Python pattern matching Add syntax highlighting for `match` and `case` keywords in Python (https://peps.python.org/pep-0636/). --- runtime/queries/python/highlights.scm | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/runtime/queries/python/highlights.scm b/runtime/queries/python/highlights.scm index a94d7cafa144..70b91efbe65b 100644 --- a/runtime/queries/python/highlights.scm +++ b/runtime/queries/python/highlights.scm @@ -2,7 +2,7 @@ (dotted_name (identifier)* @namespace) - + (aliased_import alias: (identifier) @namespace) @@ -67,7 +67,7 @@ (parameters (dictionary_splat_pattern ; **kwargs (identifier) @variable.parameter)) - + (lambda_parameters (identifier) @variable.parameter) @@ -97,7 +97,7 @@ (#match? @constant "^[A-Z_]{2,}$")) ((identifier) @type - (#match? @type "^[A-Z]")) + (#match? @type "^[A-Z]")) (attribute attribute: (identifier) @variable.other.member) (identifier) @variable @@ -168,6 +168,8 @@ "if" "elif" "else" + "match" + "case" ] @keyword.control.conditional [ From b156f5761804a7e9a95268f80ff5e34dea783200 Mon Sep 17 00:00:00 2001 From: Yuriy Date: Tue, 1 Nov 2022 18:49:33 +0100 Subject: [PATCH 025/491] Add indentation for Python pattern matching Add indentation for `match` and `case`. --- runtime/queries/python/indents.scm | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/runtime/queries/python/indents.scm b/runtime/queries/python/indents.scm index b7b499c07ae9..743971adb8d2 100644 --- a/runtime/queries/python/indents.scm +++ b/runtime/queries/python/indents.scm @@ -9,6 +9,8 @@ (while_statement) (with_statement) (try_statement) + (match_statement) + (case_clause) (import_from_statement) (parenthesized_expression) @@ -33,6 +35,8 @@ (while_statement) (with_statement) (try_statement) + (match_statement) + (case_clause) (function_definition) (class_definition) From 1bed2f30435cfa45502ad2c481a1f4ffe4a1119a Mon Sep 17 00:00:00 2001 From: Charlie Groves Date: Tue, 1 Nov 2022 21:12:40 -0400 Subject: [PATCH 026/491] Use OSC 52 as a fallback for setting the system clipboard (#3220) This adds a simple base64 implementation to keep us from adding a crate for one function. It's mostly based on https://github.com/marshallpierce/rust-base64/blob/a675443d327e175f735a37f574de803d6a332591/src/engine/naive.rs#L42 --- helix-view/src/base64.rs | 163 ++++++++++++++++++++++++++++++++++ helix-view/src/clipboard.rs | 172 +++++++++++++++++++++++------------- helix-view/src/editor.rs | 10 +-- helix-view/src/env.rs | 8 ++ helix-view/src/lib.rs | 2 + 5 files changed, 288 insertions(+), 67 deletions(-) create mode 100644 helix-view/src/base64.rs create mode 100644 helix-view/src/env.rs diff --git a/helix-view/src/base64.rs b/helix-view/src/base64.rs new file mode 100644 index 000000000000..a0dc167fe6f8 --- /dev/null +++ b/helix-view/src/base64.rs @@ -0,0 +1,163 @@ +// A minimal base64 implementation to keep from pulling in a crate for just that. It's based on +// https://github.com/marshallpierce/rust-base64 but without all the customization options. +// The biggest portion comes from +// https://github.com/marshallpierce/rust-base64/blob/a675443d327e175f735a37f574de803d6a332591/src/engine/naive.rs#L42 +// Thanks, rust-base64! + +// The MIT License (MIT) + +// Copyright (c) 2015 Alice Maz + +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: + +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. + +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +use std::ops::{BitAnd, BitOr, Shl, Shr}; + +const PAD_BYTE: u8 = b'='; +const ENCODE_TABLE: &[u8] = + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".as_bytes(); +const LOW_SIX_BITS: u32 = 0x3F; + +pub fn encode(input: &[u8]) -> String { + let rem = input.len() % 3; + let complete_chunks = input.len() / 3; + let remainder_chunk = if rem == 0 { 0 } else { 1 }; + let encoded_size = (complete_chunks + remainder_chunk) * 4; + + let mut output = vec![0; encoded_size]; + + // complete chunks first + let complete_chunk_len = input.len() - rem; + + let mut input_index = 0_usize; + let mut output_index = 0_usize; + while input_index < complete_chunk_len { + let chunk = &input[input_index..input_index + 3]; + + // populate low 24 bits from 3 bytes + let chunk_int: u32 = + (chunk[0] as u32).shl(16) | (chunk[1] as u32).shl(8) | (chunk[2] as u32); + // encode 4x 6-bit output bytes + output[output_index] = ENCODE_TABLE[chunk_int.shr(18) as usize]; + output[output_index + 1] = ENCODE_TABLE[chunk_int.shr(12_u8).bitand(LOW_SIX_BITS) as usize]; + output[output_index + 2] = ENCODE_TABLE[chunk_int.shr(6_u8).bitand(LOW_SIX_BITS) as usize]; + output[output_index + 3] = ENCODE_TABLE[chunk_int.bitand(LOW_SIX_BITS) as usize]; + + input_index += 3; + output_index += 4; + } + + // then leftovers + if rem == 2 { + let chunk = &input[input_index..input_index + 2]; + + // high six bits of chunk[0] + output[output_index] = ENCODE_TABLE[chunk[0].shr(2) as usize]; + // bottom 2 bits of [0], high 4 bits of [1] + output[output_index + 1] = ENCODE_TABLE + [(chunk[0].shl(4_u8).bitor(chunk[1].shr(4_u8)) as u32).bitand(LOW_SIX_BITS) as usize]; + // bottom 4 bits of [1], with the 2 bottom bits as zero + output[output_index + 2] = + ENCODE_TABLE[(chunk[1].shl(2_u8) as u32).bitand(LOW_SIX_BITS) as usize]; + output[output_index + 3] = PAD_BYTE; + } else if rem == 1 { + let byte = input[input_index]; + output[output_index] = ENCODE_TABLE[byte.shr(2) as usize]; + output[output_index + 1] = + ENCODE_TABLE[(byte.shl(4_u8) as u32).bitand(LOW_SIX_BITS) as usize]; + output[output_index + 2] = PAD_BYTE; + output[output_index + 3] = PAD_BYTE; + } + String::from_utf8(output).expect("Invalid UTF8") +} + +#[cfg(test)] +mod tests { + fn compare_encode(expected: &str, target: &[u8]) { + assert_eq!(expected, super::encode(target)); + } + + #[test] + fn encode_rfc4648_0() { + compare_encode("", b""); + } + + #[test] + fn encode_rfc4648_1() { + compare_encode("Zg==", b"f"); + } + + #[test] + fn encode_rfc4648_2() { + compare_encode("Zm8=", b"fo"); + } + + #[test] + fn encode_rfc4648_3() { + compare_encode("Zm9v", b"foo"); + } + + #[test] + fn encode_rfc4648_4() { + compare_encode("Zm9vYg==", b"foob"); + } + + #[test] + fn encode_rfc4648_5() { + compare_encode("Zm9vYmE=", b"fooba"); + } + + #[test] + fn encode_rfc4648_6() { + compare_encode("Zm9vYmFy", b"foobar"); + } + + #[test] + fn encode_all_ascii() { + let mut ascii = Vec::::with_capacity(128); + + for i in 0..128 { + ascii.push(i); + } + + compare_encode( + "AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ1Njc4OTo7P\ + D0+P0BBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWltcXV5fYGFiY2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6e3x9fn8\ + =", + &ascii, + ); + } + + #[test] + fn encode_all_bytes() { + let mut bytes = Vec::::with_capacity(256); + + for i in 0..255 { + bytes.push(i); + } + bytes.push(255); //bug with "overflowing" ranges? + + compare_encode( + "AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ1Njc4OTo7P\ + D0+P0BBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWltcXV5fYGFiY2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6e3x9fn\ + +AgYKDhIWGh4iJiouMjY6PkJGSk5SVlpeYmZqbnJ2en6ChoqOkpaanqKmqq6ytrq+wsbKztLW2t7i5uru8vb6\ + /wMHCw8TFxsfIycrLzM3Oz9DR0tPU1dbX2Nna29zd3t/g4eLj5OXm5+jp6uvs7e7v8PHy8/T19vf4+fr7/P3+/w==", + &bytes, + ); + } +} diff --git a/helix-view/src/clipboard.rs b/helix-view/src/clipboard.rs index ad6f621a5ae7..19fade69c7b6 100644 --- a/helix-view/src/clipboard.rs +++ b/helix-view/src/clipboard.rs @@ -3,6 +3,7 @@ use anyhow::Result; use std::borrow::Cow; +#[derive(Clone, Copy, Debug)] pub enum ClipboardType { Clipboard, Selection, @@ -72,45 +73,48 @@ pub fn get_clipboard_provider() -> Box { #[cfg(target_os = "macos")] pub fn get_clipboard_provider() -> Box { - use provider::command::exists; + use crate::env::binary_exists; - if exists("pbcopy") && exists("pbpaste") { + if binary_exists("pbcopy") && binary_exists("pbpaste") { command_provider! { paste => "pbpaste"; copy => "pbcopy"; } } else { - Box::new(provider::NopProvider::new()) + Box::new(provider::FallbackProvider::new()) } } #[cfg(target_os = "wasm32")] pub fn get_clipboard_provider() -> Box { // TODO: - Box::new(provider::NopProvider::new()) + Box::new(provider::FallbackProvider::new()) } #[cfg(not(any(windows, target_os = "wasm32", target_os = "macos")))] pub fn get_clipboard_provider() -> Box { - use provider::command::{env_var_is_set, exists, is_exit_success}; + use crate::env::{binary_exists, env_var_is_set}; + use provider::command::is_exit_success; // TODO: support for user-defined provider, probably when we have plugin support by setting a // variable? - if env_var_is_set("WAYLAND_DISPLAY") && exists("wl-copy") && exists("wl-paste") { + if env_var_is_set("WAYLAND_DISPLAY") && binary_exists("wl-copy") && binary_exists("wl-paste") { command_provider! { paste => "wl-paste", "--no-newline"; copy => "wl-copy", "--type", "text/plain"; primary_paste => "wl-paste", "-p", "--no-newline"; primary_copy => "wl-copy", "-p", "--type", "text/plain"; } - } else if env_var_is_set("DISPLAY") && exists("xclip") { + } else if env_var_is_set("DISPLAY") && binary_exists("xclip") { command_provider! { paste => "xclip", "-o", "-selection", "clipboard"; copy => "xclip", "-i", "-selection", "clipboard"; primary_paste => "xclip", "-o"; primary_copy => "xclip", "-i"; } - } else if env_var_is_set("DISPLAY") && exists("xsel") && is_exit_success("xsel", &["-o", "-b"]) + } else if env_var_is_set("DISPLAY") + && binary_exists("xsel") + && is_exit_success("xsel", &["-o", "-b"]) { // FIXME: check performance of is_exit_success command_provider! { @@ -119,43 +123,78 @@ pub fn get_clipboard_provider() -> Box { primary_paste => "xsel", "-o"; primary_copy => "xsel", "-i"; } - } else if exists("win32yank.exe") { + } else if binary_exists("win32yank.exe") { command_provider! { paste => "win32yank.exe", "-o", "--lf"; copy => "win32yank.exe", "-i", "--crlf"; } - } else if exists("termux-clipboard-set") && exists("termux-clipboard-get") { + } else if binary_exists("termux-clipboard-set") && binary_exists("termux-clipboard-get") { command_provider! { paste => "termux-clipboard-get"; copy => "termux-clipboard-set"; } - } else if env_var_is_set("TMUX") && exists("tmux") { + } else if env_var_is_set("TMUX") && binary_exists("tmux") { command_provider! { paste => "tmux", "save-buffer", "-"; copy => "tmux", "load-buffer", "-"; } } else { - Box::new(provider::NopProvider::new()) + Box::new(provider::FallbackProvider::new()) } } +#[cfg(not(target_os = "windows"))] pub mod provider { use super::{ClipboardProvider, ClipboardType}; use anyhow::Result; use std::borrow::Cow; - #[cfg(not(target_os = "windows"))] + #[cfg(feature = "term")] + mod osc52 { + use {super::ClipboardType, crate::base64, crossterm}; + + #[derive(Debug)] + pub struct SetClipboardCommand { + encoded_content: String, + clipboard_type: ClipboardType, + } + + impl SetClipboardCommand { + pub fn new(content: &str, clipboard_type: ClipboardType) -> Self { + Self { + encoded_content: base64::encode(content.as_bytes()), + clipboard_type, + } + } + } + + impl crossterm::Command for SetClipboardCommand { + fn write_ansi(&self, f: &mut impl std::fmt::Write) -> std::fmt::Result { + let kind = match &self.clipboard_type { + ClipboardType::Clipboard => "c", + ClipboardType::Selection => "p", + }; + // Send an OSC 52 set command: https://terminalguide.namepad.de/seq/osc-52/ + write!(f, "\x1b]52;{};{}\x1b\\", kind, &self.encoded_content) + } + } + } + #[derive(Debug)] - pub struct NopProvider { + pub struct FallbackProvider { buf: String, primary_buf: String, } - #[cfg(not(target_os = "windows"))] - impl NopProvider { + impl FallbackProvider { pub fn new() -> Self { + #[cfg(feature = "term")] + log::debug!( + "No native clipboard provider found. Yanking by OSC 52 and pasting will be internal to Helix" + ); + #[cfg(not(feature = "term"))] log::warn!( - "No clipboard provider found! Yanking and pasting will be internal to Helix" + "No native clipboard provider found! Yanking and pasting will be internal to Helix" ); Self { buf: String::new(), @@ -164,20 +203,27 @@ pub mod provider { } } - #[cfg(not(target_os = "windows"))] - impl Default for NopProvider { + impl Default for FallbackProvider { fn default() -> Self { Self::new() } } - #[cfg(not(target_os = "windows"))] - impl ClipboardProvider for NopProvider { + impl ClipboardProvider for FallbackProvider { + #[cfg(feature = "term")] + fn name(&self) -> Cow { + Cow::Borrowed("termcode") + } + + #[cfg(not(feature = "term"))] fn name(&self) -> Cow { Cow::Borrowed("none") } fn get_contents(&self, clipboard_type: ClipboardType) -> Result { + // This is the same noop if term is enabled or not. + // We don't use the get side of OSC 52 as it isn't often enabled, it's a security hole, + // and it would require this to be async to listen for the response let value = match clipboard_type { ClipboardType::Clipboard => self.buf.clone(), ClipboardType::Selection => self.primary_buf.clone(), @@ -187,6 +233,12 @@ pub mod provider { } fn set_contents(&mut self, content: String, clipboard_type: ClipboardType) -> Result<()> { + #[cfg(feature = "term")] + crossterm::execute!( + std::io::stdout(), + osc52::SetClipboardCommand::new(&content, clipboard_type) + )?; + // Set our internal variables to use in get_content regardless of using OSC 52 match clipboard_type { ClipboardType::Clipboard => self.buf = content, ClipboardType::Selection => self.primary_buf = content, @@ -195,52 +247,11 @@ pub mod provider { } } - #[cfg(target_os = "windows")] - #[derive(Default, Debug)] - pub struct WindowsProvider; - - #[cfg(target_os = "windows")] - impl ClipboardProvider for WindowsProvider { - fn name(&self) -> Cow { - log::info!("Using clipboard-win to interact with the system clipboard"); - Cow::Borrowed("clipboard-win") - } - - fn get_contents(&self, clipboard_type: ClipboardType) -> Result { - match clipboard_type { - ClipboardType::Clipboard => { - let contents = clipboard_win::get_clipboard(clipboard_win::formats::Unicode)?; - Ok(contents) - } - ClipboardType::Selection => Ok(String::new()), - } - } - - fn set_contents(&mut self, contents: String, clipboard_type: ClipboardType) -> Result<()> { - match clipboard_type { - ClipboardType::Clipboard => { - clipboard_win::set_clipboard(clipboard_win::formats::Unicode, contents)?; - } - ClipboardType::Selection => {} - }; - Ok(()) - } - } - #[cfg(not(target_arch = "wasm32"))] pub mod command { use super::*; use anyhow::{bail, Context as _, Result}; - pub fn exists(executable_name: &str) -> bool { - which::which(executable_name).is_ok() - } - - #[cfg(not(windows))] - pub fn env_var_is_set(env_var_name: &str) -> bool { - std::env::var_os(env_var_name).is_some() - } - #[cfg(not(any(windows, target_os = "macos")))] pub fn is_exit_success(program: &str, args: &[&str]) -> bool { std::process::Command::new(program) @@ -343,3 +354,40 @@ pub mod provider { } } } + +#[cfg(target_os = "windows")] +mod provider { + use super::{ClipboardProvider, ClipboardType}; + use anyhow::Result; + use std::borrow::Cow; + + #[derive(Default, Debug)] + pub struct WindowsProvider; + + impl ClipboardProvider for WindowsProvider { + fn name(&self) -> Cow { + log::info!("Using clipboard-win to interact with the system clipboard"); + Cow::Borrowed("clipboard-win") + } + + fn get_contents(&self, clipboard_type: ClipboardType) -> Result { + match clipboard_type { + ClipboardType::Clipboard => { + let contents = clipboard_win::get_clipboard(clipboard_win::formats::Unicode)?; + Ok(contents) + } + ClipboardType::Selection => Ok(String::new()), + } + } + + fn set_contents(&mut self, contents: String, clipboard_type: ClipboardType) -> Result<()> { + match clipboard_type { + ClipboardType::Clipboard => { + clipboard_win::set_clipboard(clipboard_win::formats::Unicode, contents)?; + } + ClipboardType::Selection => {} + }; + Ok(()) + } + } +} diff --git a/helix-view/src/editor.rs b/helix-view/src/editor.rs index af69ceeae19a..47edf30392ca 100644 --- a/helix-view/src/editor.rs +++ b/helix-view/src/editor.rs @@ -187,9 +187,9 @@ pub struct TerminalConfig { #[cfg(windows)] pub fn get_terminal_provider() -> Option { - use crate::clipboard::provider::command::exists; + use crate::env::binary_exists; - if exists("wt") { + if binary_exists("wt") { return Some(TerminalConfig { command: "wt".to_string(), args: vec![ @@ -210,16 +210,16 @@ pub fn get_terminal_provider() -> Option { #[cfg(not(any(windows, target_os = "wasm32")))] pub fn get_terminal_provider() -> Option { - use crate::clipboard::provider::command::{env_var_is_set, exists}; + use crate::env::{binary_exists, env_var_is_set}; - if env_var_is_set("TMUX") && exists("tmux") { + if env_var_is_set("TMUX") && binary_exists("tmux") { return Some(TerminalConfig { command: "tmux".to_string(), args: vec!["split-window".to_string()], }); } - if env_var_is_set("WEZTERM_UNIX_SOCKET") && exists("wezterm") { + if env_var_is_set("WEZTERM_UNIX_SOCKET") && binary_exists("wezterm") { return Some(TerminalConfig { command: "wezterm".to_string(), args: vec!["cli".to_string(), "split-pane".to_string()], diff --git a/helix-view/src/env.rs b/helix-view/src/env.rs new file mode 100644 index 000000000000..c68cc609a3b0 --- /dev/null +++ b/helix-view/src/env.rs @@ -0,0 +1,8 @@ +pub fn binary_exists(binary_name: &str) -> bool { + which::which(binary_name).is_ok() +} + +#[cfg(not(windows))] +pub fn env_var_is_set(env_var_name: &str) -> bool { + std::env::var_os(env_var_name).is_some() +} diff --git a/helix-view/src/lib.rs b/helix-view/src/lib.rs index 276be44186a7..52044ac7d8b4 100644 --- a/helix-view/src/lib.rs +++ b/helix-view/src/lib.rs @@ -4,12 +4,14 @@ pub mod macros; pub mod clipboard; pub mod document; pub mod editor; +pub mod env; pub mod graphics; pub mod gutter; pub mod handlers { pub mod dap; pub mod lsp; } +pub mod base64; pub mod info; pub mod input; pub mod keyboard; From ba394dca6d3a5b52622c4d7b0d3aba7c30af9701 Mon Sep 17 00:00:00 2001 From: Michael Davis Date: Thu, 3 Nov 2022 01:09:21 -0500 Subject: [PATCH 027/491] Fix panic from two windows editing the same document (#4570) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Clamp highlighting range to be within document This fixes a panic possible when two vsplits of the same document exist and enough lines are deleted from the document so that one of the windows focuses past the end of the document. * Ensure cursor is in view on window change If two windows are editing the same document, one may delete enough of the document so that the other window is pointing at a blank page (past the document end). In this change we ensure that the cursor is within view whenever we switch to a new window (for example with `w`). * Update helix-term/src/ui/editor.rs Co-authored-by: Blaž Hrastnik Co-authored-by: Blaž Hrastnik --- helix-term/src/ui/editor.rs | 16 ++++++++-------- helix-view/src/editor.rs | 8 ++++++-- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/helix-term/src/ui/editor.rs b/helix-term/src/ui/editor.rs index 72c9d15e6d0a..2cd2ad056b53 100644 --- a/helix-term/src/ui/editor.rs +++ b/helix-term/src/ui/editor.rs @@ -227,16 +227,16 @@ impl EditorView { _theme: &Theme, ) -> Box + 'doc> { let text = doc.text().slice(..); - let last_line = std::cmp::min( - // Saturating subs to make it inclusive zero indexing. - (offset.row + height as usize).saturating_sub(1), - doc.text().len_lines().saturating_sub(1), - ); let range = { - // calculate viewport byte ranges - let start = text.line_to_byte(offset.row); - let end = text.line_to_byte(last_line + 1); + // Calculate viewport byte ranges: + // Saturating subs to make it inclusive zero indexing. + let last_line = doc.text().len_lines().saturating_sub(1); + let last_visible_line = (offset.row + height as usize) + .saturating_sub(1) + .min(last_line); + let start = text.line_to_byte(offset.row.min(last_line)); + let end = text.line_to_byte(last_visible_line + 1); start..end }; diff --git a/helix-view/src/editor.rs b/helix-view/src/editor.rs index 47edf30392ca..bb9616e82f09 100644 --- a/helix-view/src/editor.rs +++ b/helix-view/src/editor.rs @@ -1223,9 +1223,11 @@ impl Editor { pub fn focus(&mut self, view_id: ViewId) { let prev_id = std::mem::replace(&mut self.tree.focus, view_id); - // if leaving the view: mode should reset + // if leaving the view: mode should reset and the cursor should be + // within view if prev_id != view_id { self.mode = Mode::Normal; + self.ensure_cursor_in_view(view_id); } } @@ -1234,9 +1236,11 @@ impl Editor { self.tree.focus_next(); let id = self.tree.focus; - // if leaving the view: mode should reset + // if leaving the view: mode should reset and the cursor should be + // within view if prev_id != id { self.mode = Mode::Normal; + self.ensure_cursor_in_view(id); } } From c667ff8da3fa664c6fe37d2da8d9d22a4dd823e1 Mon Sep 17 00:00:00 2001 From: ChrHorn Date: Fri, 4 Nov 2022 03:17:06 +0100 Subject: [PATCH 028/491] Increase default language server timeout for Julia (#4575) --- languages.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/languages.toml b/languages.toml index adce81c5948e..94b3e75f3cb4 100644 --- a/languages.toml +++ b/languages.toml @@ -593,7 +593,7 @@ injection-regex = "julia" file-types = ["jl"] roots = ["Manifest.toml", "Project.toml"] comment-token = "#" -language-server = { command = "julia", args = [ +language-server = { command = "julia", timeout = 60, args = [ "--startup-file=no", "--history-file=no", "--quiet", From d357f1673fecfadd96983c025057b63a3d3b45e0 Mon Sep 17 00:00:00 2001 From: throwaway-helix-zsh <117384672+throwaway-helix-zsh@users.noreply.github.com> Date: Fri, 4 Nov 2022 02:18:24 +0000 Subject: [PATCH 029/491] Use language=bash when shebang line uses zsh (#4582) This PR makes the editor use language=bash when the shebang line uses zsh. This is in the same line as using language=bash for zsh related file (~/.zshrc, ~/.zshenv etc.) as we already do. --- languages.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/languages.toml b/languages.toml index 94b3e75f3cb4..071c2e40afdc 100644 --- a/languages.toml +++ b/languages.toml @@ -522,7 +522,7 @@ name = "bash" scope = "source.bash" injection-regex = "(shell|bash|zsh|sh)" file-types = ["sh", "bash", "zsh", ".bash_login", ".bash_logout", ".bash_profile", ".bashrc", ".profile", ".zshenv", ".zlogin", ".zlogout", ".zprofile", ".zshrc", "APKBUILD", "PKGBUILD", "eclass", "ebuild", "bazelrc"] -shebangs = ["sh", "bash", "dash"] +shebangs = ["sh", "bash", "dash", "zsh"] roots = [] comment-token = "#" language-server = { command = "bash-language-server", args = ["start"] } From 921d3510132b0bd89d4ac0a542371c3ae90e2e02 Mon Sep 17 00:00:00 2001 From: Antoine Stevan <44101798+amtoine@users.noreply.github.com> Date: Fri, 4 Nov 2022 03:20:14 +0100 Subject: [PATCH 030/491] bump up LhKipp/tree-sitter-nu's version to latest (#4583) --- languages.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/languages.toml b/languages.toml index 071c2e40afdc..061d141449d2 100644 --- a/languages.toml +++ b/languages.toml @@ -1414,7 +1414,7 @@ indent = { tab-width = 2, unit = " " } [[grammar]] name = "nu" -source = { git = "https://github.com/LhKipp/tree-sitter-nu", rev = "db4e990b78824c8abef3618e0f93b7fe1e8f4c0d" } +source = { git = "https://github.com/LhKipp/tree-sitter-nu", rev = "eb95bdac3abd73ef47e53f19c63e74a31405ebd2" } [[language]] name = "vala" From c2c1280f02b83a468da67d88350c199915427535 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bla=C5=BE=20Hrastnik?= Date: Fri, 4 Nov 2022 21:01:17 +0900 Subject: [PATCH 031/491] Resolve a bunch of upcoming clippy lints --- helix-core/src/history.rs | 2 +- helix-core/src/increment/number.rs | 4 +- helix-core/src/line_ending.rs | 2 +- helix-core/src/surround.rs | 2 +- helix-core/src/syntax.rs | 14 ++-- helix-dap/src/transport.rs | 2 +- helix-dap/src/types.rs | 100 ++++++++++++++--------------- helix-loader/src/grammar.rs | 4 +- helix-lsp/src/jsonrpc.rs | 26 ++++---- helix-term/build.rs | 2 +- helix-term/src/application.rs | 4 +- helix-term/src/commands.rs | 15 ++--- helix-term/src/commands/lsp.rs | 6 +- helix-term/src/ui/menu.rs | 2 +- helix-term/src/ui/prompt.rs | 4 +- helix-tui/src/buffer.rs | 4 +- helix-tui/src/layout.rs | 2 +- helix-tui/src/text.rs | 8 +-- helix-tui/src/widgets/block.rs | 16 ++--- helix-tui/src/widgets/table.rs | 6 +- helix-view/src/editor.rs | 4 +- helix-view/src/graphics.rs | 8 +-- 22 files changed, 113 insertions(+), 124 deletions(-) diff --git a/helix-core/src/history.rs b/helix-core/src/history.rs index b608097ca383..5cd72b077ddf 100644 --- a/helix-core/src/history.rs +++ b/helix-core/src/history.rs @@ -282,7 +282,7 @@ impl History { } /// Whether to undo by a number of edits or a duration of time. -#[derive(Debug, PartialEq, Clone, Copy)] +#[derive(Debug, PartialEq, Eq, Clone, Copy)] pub enum UndoKind { Steps(usize), TimePeriod(std::time::Duration), diff --git a/helix-core/src/increment/number.rs b/helix-core/src/increment/number.rs index 62b4a19dc0e9..9126872937dc 100644 --- a/helix-core/src/increment/number.rs +++ b/helix-core/src/increment/number.rs @@ -110,8 +110,8 @@ impl<'a> Increment for NumberIncrementor<'a> { let (lower_count, upper_count): (usize, usize) = old_text.chars().skip(2).fold((0, 0), |(lower, upper), c| { ( - lower + c.is_ascii_lowercase().then(|| 1).unwrap_or(0), - upper + c.is_ascii_uppercase().then(|| 1).unwrap_or(0), + lower + usize::from(c.is_ascii_lowercase()), + upper + usize::from(c.is_ascii_uppercase()), ) }); if upper_count > lower_count { diff --git a/helix-core/src/line_ending.rs b/helix-core/src/line_ending.rs index 3e8a6cae9f2e..09e9252306e7 100644 --- a/helix-core/src/line_ending.rs +++ b/helix-core/src/line_ending.rs @@ -6,7 +6,7 @@ pub const DEFAULT_LINE_ENDING: LineEnding = LineEnding::Crlf; pub const DEFAULT_LINE_ENDING: LineEnding = LineEnding::LF; /// Represents one of the valid Unicode line endings. -#[derive(PartialEq, Copy, Clone, Debug)] +#[derive(PartialEq, Eq, Copy, Clone, Debug)] pub enum LineEnding { Crlf, // CarriageReturn followed by LineFeed LF, // U+000A -- LineFeed diff --git a/helix-core/src/surround.rs b/helix-core/src/surround.rs index 6244b3805df6..a3de3cd17509 100644 --- a/helix-core/src/surround.rs +++ b/helix-core/src/surround.rs @@ -13,7 +13,7 @@ pub const PAIRS: &[(char, char)] = &[ ('(', ')'), ]; -#[derive(Debug, PartialEq)] +#[derive(Debug, PartialEq, Eq)] pub enum Error { PairNotFound, CursorOverlap, diff --git a/helix-core/src/syntax.rs b/helix-core/src/syntax.rs index c17655a90bbd..0f62577f869c 100644 --- a/helix-core/src/syntax.rs +++ b/helix-core/src/syntax.rs @@ -218,7 +218,7 @@ pub struct FormatterConfiguration { pub args: Vec, } -#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] +#[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)] #[serde(rename_all = "kebab-case")] pub struct AdvancedCompletion { pub name: Option, @@ -226,14 +226,14 @@ pub struct AdvancedCompletion { pub default: Option, } -#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] +#[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)] #[serde(rename_all = "kebab-case", untagged)] pub enum DebugConfigCompletion { Named(String), Advanced(AdvancedCompletion), } -#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] +#[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)] #[serde(untagged)] pub enum DebugArgumentValue { String(String), @@ -241,7 +241,7 @@ pub enum DebugArgumentValue { Boolean(bool), } -#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] +#[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)] #[serde(rename_all = "kebab-case")] pub struct DebugTemplate { pub name: String, @@ -250,7 +250,7 @@ pub struct DebugTemplate { pub args: HashMap, } -#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] +#[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)] #[serde(rename_all = "kebab-case")] pub struct DebugAdapterConfig { pub name: String, @@ -266,7 +266,7 @@ pub struct DebugAdapterConfig { } // Different workarounds for adapters' differences -#[derive(Debug, Default, PartialEq, Clone, Serialize, Deserialize)] +#[derive(Debug, Default, PartialEq, Eq, Clone, Serialize, Deserialize)] pub struct DebuggerQuirks { #[serde(default)] pub absolute_paths: bool, @@ -280,7 +280,7 @@ pub struct IndentationConfiguration { } /// Configuration for auto pairs -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] #[serde(rename_all = "kebab-case", deny_unknown_fields, untagged)] pub enum AutoPairConfig { /// Enables or disables auto pairing. False means disabled. True means to use the default pairs. diff --git a/helix-dap/src/transport.rs b/helix-dap/src/transport.rs index 783a6f5d0fab..dd03e56856b8 100644 --- a/helix-dap/src/transport.rs +++ b/helix-dap/src/transport.rs @@ -22,7 +22,7 @@ pub struct Request { pub arguments: Option, } -#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] +#[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)] pub struct Response { // seq is omitted as unused and is not sent by some implementations pub request_seq: u64, diff --git a/helix-dap/src/types.rs b/helix-dap/src/types.rs index 51ecfe1b60de..0a9ebe5e9540 100644 --- a/helix-dap/src/types.rs +++ b/helix-dap/src/types.rs @@ -22,7 +22,7 @@ pub trait Request { const COMMAND: &'static str; } -#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] +#[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct ColumnDescriptor { pub attribute_name: String, @@ -35,7 +35,7 @@ pub struct ColumnDescriptor { pub width: Option, } -#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] +#[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct ExceptionBreakpointsFilter { pub filter: String, @@ -50,7 +50,7 @@ pub struct ExceptionBreakpointsFilter { pub condition_description: Option, } -#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] +#[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct DebuggerCapabilities { #[serde(skip_serializing_if = "Option::is_none")] @@ -131,14 +131,14 @@ pub struct DebuggerCapabilities { pub supported_checksum_algorithms: Option>, } -#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] +#[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct Checksum { pub algorithm: String, pub checksum: String, } -#[derive(Debug, Default, PartialEq, Clone, Deserialize, Serialize)] +#[derive(Debug, Default, PartialEq, Eq, Clone, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct Source { #[serde(skip_serializing_if = "Option::is_none")] @@ -159,7 +159,7 @@ pub struct Source { pub checksums: Option>, } -#[derive(Debug, Default, PartialEq, Clone, Deserialize, Serialize)] +#[derive(Debug, Default, PartialEq, Eq, Clone, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct SourceBreakpoint { pub line: usize, @@ -173,7 +173,7 @@ pub struct SourceBreakpoint { pub log_message: Option, } -#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] +#[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct Breakpoint { #[serde(skip_serializing_if = "Option::is_none")] @@ -197,7 +197,7 @@ pub struct Breakpoint { pub offset: Option, } -#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] +#[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct StackFrameFormat { #[serde(skip_serializing_if = "Option::is_none")] @@ -216,7 +216,7 @@ pub struct StackFrameFormat { pub include_all: Option, } -#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] +#[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct StackFrame { pub id: usize, @@ -239,14 +239,14 @@ pub struct StackFrame { pub presentation_hint: Option, } -#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] +#[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct Thread { pub id: ThreadId, pub name: String, } -#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] +#[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct Scope { pub name: String, @@ -270,14 +270,14 @@ pub struct Scope { pub end_column: Option, } -#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] +#[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct ValueFormat { #[serde(skip_serializing_if = "Option::is_none")] pub hex: Option, } -#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] +#[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct VariablePresentationHint { #[serde(skip_serializing_if = "Option::is_none")] @@ -288,7 +288,7 @@ pub struct VariablePresentationHint { pub visibility: Option, } -#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] +#[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct Variable { pub name: String, @@ -308,7 +308,7 @@ pub struct Variable { pub memory_reference: Option, } -#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] +#[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct Module { pub id: String, // TODO: || number @@ -333,7 +333,7 @@ pub struct Module { pub mod requests { use super::*; - #[derive(Debug, Default, PartialEq, Clone, Deserialize, Serialize)] + #[derive(Debug, Default, PartialEq, Eq, Clone, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct InitializeArguments { #[serde(rename = "clientID", skip_serializing_if = "Option::is_none")] @@ -409,7 +409,7 @@ pub mod requests { const COMMAND: &'static str = "configurationDone"; } - #[derive(Debug, Default, PartialEq, Clone, Deserialize, Serialize)] + #[derive(Debug, Default, PartialEq, Eq, Clone, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct SetBreakpointsArguments { pub source: Source, @@ -420,7 +420,7 @@ pub mod requests { pub source_modified: Option, } - #[derive(Debug, Default, PartialEq, Clone, Deserialize, Serialize)] + #[derive(Debug, Default, PartialEq, Eq, Clone, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct SetBreakpointsResponse { #[serde(skip_serializing_if = "Option::is_none")] @@ -436,13 +436,13 @@ pub mod requests { const COMMAND: &'static str = "setBreakpoints"; } - #[derive(Debug, Default, PartialEq, Clone, Deserialize, Serialize)] + #[derive(Debug, Default, PartialEq, Eq, Clone, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct ContinueArguments { pub thread_id: ThreadId, } - #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] + #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct ContinueResponse { #[serde(skip_serializing_if = "Option::is_none")] @@ -458,7 +458,7 @@ pub mod requests { const COMMAND: &'static str = "continue"; } - #[derive(Debug, Default, PartialEq, Clone, Deserialize, Serialize)] + #[derive(Debug, Default, PartialEq, Eq, Clone, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct StackTraceArguments { pub thread_id: ThreadId, @@ -470,7 +470,7 @@ pub mod requests { pub format: Option, } - #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] + #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct StackTraceResponse { #[serde(skip_serializing_if = "Option::is_none")] @@ -487,7 +487,7 @@ pub mod requests { const COMMAND: &'static str = "stackTrace"; } - #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] + #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct ThreadsResponse { pub threads: Vec, @@ -502,13 +502,13 @@ pub mod requests { const COMMAND: &'static str = "threads"; } - #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] + #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct ScopesArguments { pub frame_id: usize, } - #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] + #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct ScopesResponse { pub scopes: Vec, @@ -523,7 +523,7 @@ pub mod requests { const COMMAND: &'static str = "scopes"; } - #[derive(Debug, Default, PartialEq, Clone, Deserialize, Serialize)] + #[derive(Debug, Default, PartialEq, Eq, Clone, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct VariablesArguments { pub variables_reference: usize, @@ -537,7 +537,7 @@ pub mod requests { pub format: Option, } - #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] + #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct VariablesResponse { pub variables: Vec, @@ -552,7 +552,7 @@ pub mod requests { const COMMAND: &'static str = "variables"; } - #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] + #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct StepInArguments { pub thread_id: ThreadId, @@ -571,7 +571,7 @@ pub mod requests { const COMMAND: &'static str = "stepIn"; } - #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] + #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct StepOutArguments { pub thread_id: ThreadId, @@ -588,7 +588,7 @@ pub mod requests { const COMMAND: &'static str = "stepOut"; } - #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] + #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct NextArguments { pub thread_id: ThreadId, @@ -605,7 +605,7 @@ pub mod requests { const COMMAND: &'static str = "next"; } - #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] + #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct PauseArguments { pub thread_id: ThreadId, @@ -620,7 +620,7 @@ pub mod requests { const COMMAND: &'static str = "pause"; } - #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] + #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct EvaluateArguments { pub expression: String, @@ -632,7 +632,7 @@ pub mod requests { pub format: Option, } - #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] + #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct EvaluateResponse { pub result: String, @@ -658,7 +658,7 @@ pub mod requests { const COMMAND: &'static str = "evaluate"; } - #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] + #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct SetExceptionBreakpointsArguments { pub filters: Vec, @@ -666,7 +666,7 @@ pub mod requests { // pub exceptionOptions: Option>, // needs capability } - #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] + #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct SetExceptionBreakpointsResponse { #[serde(skip_serializing_if = "Option::is_none")] @@ -684,7 +684,7 @@ pub mod requests { // Reverse Requests - #[derive(Debug, Default, PartialEq, Clone, Deserialize, Serialize)] + #[derive(Debug, Default, PartialEq, Eq, Clone, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct RunInTerminalResponse { #[serde(skip_serializing_if = "Option::is_none")] @@ -693,7 +693,7 @@ pub mod requests { pub shell_process_id: Option, } - #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] + #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct RunInTerminalArguments { #[serde(skip_serializing_if = "Option::is_none")] @@ -745,7 +745,7 @@ pub mod events { Memory(Memory), } - #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] + #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct Stopped { pub reason: String, @@ -763,7 +763,7 @@ pub mod events { pub hit_breakpoint_ids: Option>, } - #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] + #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct Continued { pub thread_id: ThreadId, @@ -771,27 +771,27 @@ pub mod events { pub all_threads_continued: Option, } - #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] + #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct Exited { pub exit_code: usize, } - #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] + #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct Terminated { #[serde(skip_serializing_if = "Option::is_none")] pub restart: Option, } - #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] + #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct Thread { pub reason: String, pub thread_id: ThreadId, } - #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] + #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct Output { pub output: String, @@ -811,28 +811,28 @@ pub mod events { pub data: Option, } - #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] + #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct Breakpoint { pub reason: String, pub breakpoint: super::Breakpoint, } - #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] + #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct Module { pub reason: String, pub module: super::Module, } - #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] + #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct LoadedSource { pub reason: String, pub source: super::Source, } - #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] + #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct Process { pub name: String, @@ -846,13 +846,13 @@ pub mod events { pub pointer_size: Option, } - #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] + #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct Capabilities { pub capabilities: super::DebuggerCapabilities, } - // #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] + // #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)] // #[serde(rename_all = "camelCase")] // pub struct Invalidated { // pub areas: Vec, @@ -860,7 +860,7 @@ pub mod events { // pub stack_frame_id: Option, // } - #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] + #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct Memory { pub memory_reference: String, diff --git a/helix-loader/src/grammar.rs b/helix-loader/src/grammar.rs index a92cadb64b62..833616e046d9 100644 --- a/helix-loader/src/grammar.rs +++ b/helix-loader/src/grammar.rs @@ -67,7 +67,7 @@ pub fn get_language(name: &str) -> Result { #[cfg(not(target_arch = "wasm32"))] pub fn get_language(name: &str) -> Result { use libloading::{Library, Symbol}; - let mut library_path = crate::runtime_dir().join("grammars").join(&name); + let mut library_path = crate::runtime_dir().join("grammars").join(name); library_path.set_extension(DYLIB_EXTENSION); let library = unsafe { Library::new(&library_path) } @@ -429,7 +429,7 @@ fn build_tree_sitter_library( if cfg!(all(windows, target_env = "msvc")) { command - .args(&["/nologo", "/LD", "/I"]) + .args(["/nologo", "/LD", "/I"]) .arg(header_path) .arg("/Od") .arg("/utf-8"); diff --git a/helix-lsp/src/jsonrpc.rs b/helix-lsp/src/jsonrpc.rs index b9b3fd2c0e1a..75ac9309bdf0 100644 --- a/helix-lsp/src/jsonrpc.rs +++ b/helix-lsp/src/jsonrpc.rs @@ -13,7 +13,7 @@ use serde::{Deserialize, Serialize}; use serde_json::Value; // https://www.jsonrpc.org/specification#error_object -#[derive(Debug, PartialEq, Clone)] +#[derive(Debug, PartialEq, Eq, Clone)] pub enum ErrorCode { ParseError, InvalidRequest, @@ -68,7 +68,7 @@ impl Serialize for ErrorCode { } } -#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)] +#[derive(Debug, PartialEq, Eq, Clone, Serialize, Deserialize)] pub struct Error { pub code: ErrorCode, pub message: String, @@ -100,7 +100,7 @@ impl std::error::Error for Error {} // https://www.jsonrpc.org/specification#request_object /// Request ID -#[derive(Debug, PartialEq, Clone, Hash, Eq, Deserialize, Serialize)] +#[derive(Debug, PartialEq, Eq, Clone, Hash, Deserialize, Serialize)] #[serde(untagged)] pub enum Id { Null, @@ -109,7 +109,7 @@ pub enum Id { } /// Protocol Version -#[derive(Debug, PartialEq, Clone, Copy, Hash, Eq)] +#[derive(Debug, PartialEq, Eq, Clone, Copy, Hash)] pub enum Version { V2, } @@ -153,7 +153,7 @@ impl<'de> Deserialize<'de> for Version { } } -#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)] +#[derive(Debug, PartialEq, Eq, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum Params { None, @@ -182,7 +182,7 @@ impl From for Value { } } -#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] +#[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] #[serde(deny_unknown_fields)] pub struct MethodCall { pub jsonrpc: Option, @@ -192,7 +192,7 @@ pub struct MethodCall { pub id: Id, } -#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] +#[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] #[serde(deny_unknown_fields)] pub struct Notification { pub jsonrpc: Option, @@ -201,7 +201,7 @@ pub struct Notification { pub params: Params, } -#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] +#[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] #[serde(deny_unknown_fields)] #[serde(untagged)] pub enum Call { @@ -235,7 +235,7 @@ impl From for Call { } } -#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] +#[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] #[serde(deny_unknown_fields)] #[serde(untagged)] pub enum Request { @@ -245,7 +245,7 @@ pub enum Request { // https://www.jsonrpc.org/specification#response_object -#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)] +#[derive(Debug, PartialEq, Eq, Clone, Serialize, Deserialize)] pub struct Success { #[serde(skip_serializing_if = "Option::is_none")] pub jsonrpc: Option, @@ -253,7 +253,7 @@ pub struct Success { pub id: Id, } -#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] +#[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)] pub struct Failure { #[serde(skip_serializing_if = "Option::is_none")] pub jsonrpc: Option, @@ -264,7 +264,7 @@ pub struct Failure { // Note that failure comes first because we're not using // #[serde(deny_unknown_field)]: we want a request that contains // both `result` and `error` to be a `Failure`. -#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] +#[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)] #[serde(untagged)] pub enum Output { Failure(Failure), @@ -280,7 +280,7 @@ impl From for Result { } } -#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] +#[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] #[serde(untagged)] pub enum Response { Single(Output), diff --git a/helix-term/build.rs b/helix-term/build.rs index 74c35a3a30a8..719113ff2c37 100644 --- a/helix-term/build.rs +++ b/helix-term/build.rs @@ -6,7 +6,7 @@ const VERSION: &str = include_str!("../VERSION"); fn main() { let git_hash = Command::new("git") - .args(&["rev-parse", "HEAD"]) + .args(["rev-parse", "HEAD"]) .output() .ok() .filter(|output| output.status.success()) diff --git a/helix-term/src/application.rs b/helix-term/src/application.rs index 173c5d49a55b..e356c1f9e7ee 100644 --- a/helix-term/src/application.rs +++ b/helix-term/src/application.rs @@ -168,7 +168,7 @@ impl Application { } else if !args.files.is_empty() { let first = &args.files[0].0; // we know it's not empty if first.is_dir() { - std::env::set_current_dir(&first).context("set current dir")?; + std::env::set_current_dir(first).context("set current dir")?; editor.new_file(Action::VerticalSplit); let picker = ui::file_picker(".".into(), &config.load().editor); compositor.push(Box::new(overlayed(picker))); @@ -228,7 +228,7 @@ impl Application { #[cfg(windows)] let signals = futures_util::stream::empty(); #[cfg(not(windows))] - let signals = Signals::new(&[signal::SIGTSTP, signal::SIGCONT, signal::SIGUSR1]) + let signals = Signals::new([signal::SIGTSTP, signal::SIGCONT, signal::SIGUSR1]) .context("build signal handler")?; let app = Self { diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index ee9bad980487..aae9979d00ac 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -3933,15 +3933,12 @@ pub fn completion(cx: &mut Context) { }; if !prefix.is_empty() { - items = items - .into_iter() - .filter(|item| { - item.filter_text - .as_ref() - .unwrap_or(&item.label) - .starts_with(&prefix) - }) - .collect(); + items.retain(|item| { + item.filter_text + .as_ref() + .unwrap_or(&item.label) + .starts_with(&prefix) + }); } if items.is_empty() { diff --git a/helix-term/src/commands/lsp.rs b/helix-term/src/commands/lsp.rs index d7617c50ab19..5498fc83f857 100644 --- a/helix-term/src/commands/lsp.rs +++ b/helix-term/src/commands/lsp.rs @@ -57,7 +57,7 @@ impl ui::menu::Item for lsp::Location { // allocation, for `to_file_path`, else there will be two (2), with `to_string_lossy`. let mut write_path_to_res = || -> Option<()> { let path = self.uri.to_file_path().ok()?; - res.push_str(&path.strip_prefix(&cwdir).unwrap_or(&path).to_string_lossy()); + res.push_str(&path.strip_prefix(cwdir).unwrap_or(&path).to_string_lossy()); Some(()) }; write_path_to_res(); @@ -634,7 +634,7 @@ pub fn apply_document_resource_op(op: &lsp::ResourceOp) -> std::io::Result<()> { // Create directory if it does not exist if let Some(dir) = path.parent() { if !dir.is_dir() { - fs::create_dir_all(&dir)?; + fs::create_dir_all(dir)?; } } @@ -910,7 +910,7 @@ pub fn goto_reference(cx: &mut Context) { ); } -#[derive(PartialEq)] +#[derive(PartialEq, Eq)] pub enum SignatureHelpInvoked { Manual, Automatic, diff --git a/helix-term/src/ui/menu.rs b/helix-term/src/ui/menu.rs index 99c2473d6f40..1baaf40a3185 100644 --- a/helix-term/src/ui/menu.rs +++ b/helix-term/src/ui/menu.rs @@ -40,7 +40,7 @@ impl Item for PathBuf { type Data = PathBuf; fn label(&self, root_path: &Self::Data) -> Spans { - self.strip_prefix(&root_path) + self.strip_prefix(root_path) .unwrap_or(self) .to_string_lossy() .into() diff --git a/helix-term/src/ui/prompt.rs b/helix-term/src/ui/prompt.rs index d0991d3c00c5..ca2872a7d0a4 100644 --- a/helix-term/src/ui/prompt.rs +++ b/helix-term/src/ui/prompt.rs @@ -32,7 +32,7 @@ pub struct Prompt { next_char_handler: Option, } -#[derive(Clone, Copy, PartialEq)] +#[derive(Clone, Copy, PartialEq, Eq)] pub enum PromptEvent { /// The prompt input has been updated. Update, @@ -408,7 +408,7 @@ impl Prompt { surface.set_stringn( area.x + col * (1 + col_width), area.y + row, - &completion, + completion, col_width.saturating_sub(1) as usize, color, ); diff --git a/helix-tui/src/buffer.rs b/helix-tui/src/buffer.rs index 23ba43f1b2f1..5169196a47e6 100644 --- a/helix-tui/src/buffer.rs +++ b/helix-tui/src/buffer.rs @@ -6,7 +6,7 @@ use unicode_segmentation::UnicodeSegmentation; use helix_view::graphics::{Color, Modifier, Rect, Style, UnderlineStyle}; /// A buffer cell -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Clone, PartialEq, Eq)] pub struct Cell { pub symbol: String, pub fg: Color, @@ -119,7 +119,7 @@ impl Default for Cell { /// buf[(5, 0)].set_char('x'); /// assert_eq!(buf[(5, 0)].symbol, "x"); /// ``` -#[derive(Debug, Default, Clone, PartialEq)] +#[derive(Debug, Default, Clone, PartialEq, Eq)] pub struct Buffer { /// The area represented by this buffer pub area: Rect, diff --git a/helix-tui/src/layout.rs b/helix-tui/src/layout.rs index 7c72a7789cd1..1f3ddc6e6f57 100644 --- a/helix-tui/src/layout.rs +++ b/helix-tui/src/layout.rs @@ -46,7 +46,7 @@ impl Constraint { } } -#[derive(Debug, Clone, Copy, PartialEq)] +#[derive(Debug, Clone, Copy, PartialEq, Eq)] pub enum Alignment { Left, Center, diff --git a/helix-tui/src/text.rs b/helix-tui/src/text.rs index 1bfe5ee1f757..ccdafad5fdfe 100644 --- a/helix-tui/src/text.rs +++ b/helix-tui/src/text.rs @@ -53,14 +53,14 @@ use std::borrow::Cow; use unicode_segmentation::UnicodeSegmentation; /// A grapheme associated to a style. -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Clone, PartialEq, Eq)] pub struct StyledGrapheme<'a> { pub symbol: &'a str, pub style: Style, } /// A string where all graphemes have the same style. -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Clone, PartialEq, Eq)] pub struct Span<'a> { pub content: Cow<'a, str>, pub style: Style, @@ -209,7 +209,7 @@ impl<'a> From> for Span<'a> { } /// A string composed of clusters of graphemes, each with their own style. -#[derive(Debug, Default, Clone, PartialEq)] +#[derive(Debug, Default, Clone, PartialEq, Eq)] pub struct Spans<'a>(pub Vec>); impl<'a> Spans<'a> { @@ -297,7 +297,7 @@ impl<'a> From<&Spans<'a>> for String { /// text.extend(Text::styled("Some more lines\nnow with more style!", style)); /// assert_eq!(6, text.height()); /// ``` -#[derive(Debug, Default, Clone, PartialEq)] +#[derive(Debug, Default, Clone, PartialEq, Eq)] pub struct Text<'a> { pub lines: Vec>, } diff --git a/helix-tui/src/widgets/block.rs b/helix-tui/src/widgets/block.rs index bd025a3167ff..98f84abe28ef 100644 --- a/helix-tui/src/widgets/block.rs +++ b/helix-tui/src/widgets/block.rs @@ -7,7 +7,7 @@ use crate::{ use helix_view::graphics::{Rect, Style}; /// Border render type. Defaults to [`BorderType::Plain`]. -#[derive(Debug, Clone, Copy, PartialEq)] +#[derive(Debug, Clone, Copy, PartialEq, Eq)] pub enum BorderType { Plain, Rounded, @@ -47,7 +47,7 @@ impl Default for BorderType { /// .border_type(BorderType::Rounded) /// .style(Style::default().bg(Color::Black)); /// ``` -#[derive(Debug, Default, Clone, PartialEq)] +#[derive(Debug, Default, Clone, PartialEq, Eq)] pub struct Block<'a> { /// Optional title place on the upper left of the block title: Option>, @@ -187,16 +187,8 @@ impl<'a> Widget for Block<'a> { } if let Some(title) = self.title { - let lx = if self.borders.intersects(Borders::LEFT) { - 1 - } else { - 0 - }; - let rx = if self.borders.intersects(Borders::RIGHT) { - 1 - } else { - 0 - }; + let lx = u16::from(self.borders.intersects(Borders::LEFT)); + let rx = u16::from(self.borders.intersects(Borders::RIGHT)); let width = area.width.saturating_sub(lx).saturating_sub(rx); buf.set_spans(area.left() + lx, area.top(), &title, width); } diff --git a/helix-tui/src/widgets/table.rs b/helix-tui/src/widgets/table.rs index eb03704ea05f..a8f428a7a65a 100644 --- a/helix-tui/src/widgets/table.rs +++ b/helix-tui/src/widgets/table.rs @@ -34,7 +34,7 @@ use std::collections::HashMap; /// /// You can apply a [`Style`] on the entire [`Cell`] using [`Cell::style`] or rely on the styling /// capabilities of [`Text`]. -#[derive(Debug, Clone, PartialEq, Default)] +#[derive(Debug, Clone, PartialEq, Eq, Default)] pub struct Cell<'a> { pub content: Text<'a>, style: Style, @@ -79,7 +79,7 @@ where /// ``` /// /// By default, a row has a height of 1 but you can change this using [`Row::height`]. -#[derive(Debug, Clone, PartialEq, Default)] +#[derive(Debug, Clone, PartialEq, Eq, Default)] pub struct Row<'a> { pub cells: Vec>, height: u16, @@ -179,7 +179,7 @@ impl<'a> Row<'a> { /// // ...and potentially show a symbol in front of the selection. /// .highlight_symbol(">>"); /// ``` -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Clone, PartialEq, Eq)] pub struct Table<'a> { /// A block to wrap the widget in block: Option>, diff --git a/helix-view/src/editor.rs b/helix-view/src/editor.rs index bb9616e82f09..bcd8dedb8c81 100644 --- a/helix-view/src/editor.rs +++ b/helix-view/src/editor.rs @@ -111,7 +111,7 @@ impl Default for FilePickerConfig { } } -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] #[serde(rename_all = "kebab-case", default, deny_unknown_fields)] pub struct Config { /// Padding to keep between the edge of the screen and the cursor when scrolling. Defaults to 5. @@ -346,7 +346,7 @@ pub enum StatusLineElement { // Cursor shape is read and used on every rendered frame and so needs // to be fast. Therefore we avoid a hashmap and use an enum indexed array. -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Clone, PartialEq, Eq)] pub struct CursorShapeConfig([CursorKind; 3]); impl CursorShapeConfig { diff --git a/helix-view/src/graphics.rs b/helix-view/src/graphics.rs index cbae873a42f9..9264c50f8294 100644 --- a/helix-view/src/graphics.rs +++ b/helix-view/src/graphics.rs @@ -5,7 +5,7 @@ use std::{ str::FromStr, }; -#[derive(Debug, Clone, Copy, PartialEq, Deserialize, Serialize)] +#[derive(Debug, Clone, Copy, PartialEq, Eq, Deserialize, Serialize)] #[serde(rename_all = "lowercase")] /// UNSTABLE pub enum CursorKind { @@ -250,7 +250,7 @@ impl Rect { } } -#[derive(Debug, Clone, Copy, PartialEq)] +#[derive(Debug, Clone, Copy, PartialEq, Eq)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] pub enum Color { Reset, @@ -303,7 +303,7 @@ impl From for crossterm::style::Color { } } -#[derive(Debug, Clone, Copy, PartialEq)] +#[derive(Debug, Clone, Copy, PartialEq, Eq)] pub enum UnderlineStyle { Reset, Line, @@ -449,7 +449,7 @@ impl FromStr for Modifier { /// buffer[(0, 0)].style(), /// ); /// ``` -#[derive(Debug, Clone, Copy, PartialEq)] +#[derive(Debug, Clone, Copy, PartialEq, Eq)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] pub struct Style { pub fg: Option, From 9a898be95934bec46c5a77c61d77314ecb4d71fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bla=C5=BE=20Hrastnik?= Date: Fri, 4 Nov 2022 21:01:34 +0900 Subject: [PATCH 032/491] nix: Bump flake dependencies --- flake.lock | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/flake.lock b/flake.lock index cfa227e31784..74206d2b3dd9 100644 --- a/flake.lock +++ b/flake.lock @@ -36,11 +36,11 @@ "devshell": { "flake": false, "locked": { - "lastModified": 1666548262, - "narHash": "sha256-4DyN4KXqQQsCw0vCXkMThw4b5Q4/q87ZZgRb4st8COc=", + "lastModified": 1667210711, + "narHash": "sha256-IoErjXZAkzYWHEpQqwu/DeRNJGFdR7X2OGbkhMqMrpw=", "owner": "numtide", "repo": "devshell", - "rev": "c8ce8ed81726079c398f5f29c4b68a7d6a3c2fa2", + "rev": "96a9dd12b8a447840cc246e17a47b81a4268bba7", "type": "github" }, "original": { @@ -88,11 +88,11 @@ ] }, "locked": { - "lastModified": 1666993587, - "narHash": "sha256-4cLrs+CwWnceYXnCpL5gO3bybS9CjLxUoTEKjB2QFtg=", + "lastModified": 1667429039, + "narHash": "sha256-Lu6da25JioHzerkLHAHSO9suCQFzJ/XBjkcGCIbasLM=", "owner": "nix-community", "repo": "dream2nix", - "rev": "2b7456e3d2f0053bc2474fb0c461dd468545277f", + "rev": "5252794e58eedb02d607fa3187ffead7becc81b0", "type": "github" }, "original": { @@ -144,11 +144,11 @@ ] }, "locked": { - "lastModified": 1667232647, - "narHash": "sha256-cFo7G8BqYShgL9m7yD6p+SHAZ+aIt2guuF69LV235n8=", + "lastModified": 1667542401, + "narHash": "sha256-mdWjP5tjSf8n6FAtpSgL23kX4+eWBwLrSYo9iY3mA8Q=", "owner": "yusdacra", "repo": "nix-cargo-integration", - "rev": "16082f7b4e42ce140a562fa630bcf8e96eadeb59", + "rev": "cd5e5cbd81c80dc219455dd3b1e0ddb55fae51ec", "type": "github" }, "original": { @@ -159,11 +159,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1667142599, - "narHash": "sha256-OLJxsg9VqfKjFkerOxWtNIkibsCvxsv5A8wNWO1MeWk=", + "lastModified": 1667482890, + "narHash": "sha256-pua0jp87iwN7NBY5/ypx0s9L9CG49Ju/NI4wGwurHc4=", "owner": "nixos", "repo": "nixpkgs", - "rev": "412b9917cea092f3d39f9cd5dead4effd5bc4053", + "rev": "a2a777538d971c6b01c6e54af89ddd6567c055e8", "type": "github" }, "original": { @@ -188,11 +188,11 @@ ] }, "locked": { - "lastModified": 1667184938, - "narHash": "sha256-/kuCiXuAxiD0c0zrfDvJ1Yba3FuVdRk/ROfb393AeX4=", + "lastModified": 1667487142, + "narHash": "sha256-bVuzLs1ZVggJAbJmEDVO9G6p8BH3HRaolK70KXvnWnU=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "8f81faec35508647ced65c44fd3e8648a5518afb", + "rev": "cf668f737ac986c0a89e83b6b2e3c5ddbd8cf33b", "type": "github" }, "original": { From d6323b7cbc21a9d3ba29738c76581dad93f9f415 Mon Sep 17 00:00:00 2001 From: Michael Davis Date: Fri, 4 Nov 2022 11:02:19 -0500 Subject: [PATCH 033/491] Select text inserted by shell or paste (#4458) This follows changes in Kakoune to the same effects: * p/p: https://github.com/mawww/kakoune/commit/266d1c37d0d970a7eff747f5e6a5773a3cea39d8 * !/: https://github.com/mawww/kakoune/commit/85b78dda2e29d70b620836b04224b104426bdbae Selecting the new data inserted by shell or pasting is often more useful than retaining a selection of the pre-paste/insert content. --- helix-term/src/commands.rs | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index aae9979d00ac..a6ee626305a1 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -3471,6 +3471,8 @@ fn paste_impl(values: &[String], doc: &mut Document, view: &mut View, action: Pa let text = doc.text(); let selection = doc.selection(view.id); + let mut ranges = SmallVec::with_capacity(selection.len()); + let transaction = Transaction::change_by_selection(text, selection, |range| { let pos = match (action, linewise) { // paste linewise before @@ -3487,8 +3489,21 @@ fn paste_impl(values: &[String], doc: &mut Document, view: &mut View, action: Pa // paste at cursor (Paste::Cursor, _) => range.cursor(text.slice(..)), }; - (pos, pos, values.next()) + + let value = values.next(); + + let value_len = value + .as_ref() + .map(|content| content.chars().count()) + .unwrap_or_default(); + + ranges.push(Range::new(pos, pos + value_len)); + + (pos, pos, value) }); + + let transaction = transaction.with_selection(Selection::new(ranges, selection.primary_index())); + apply_transaction(&transaction, doc, view); } @@ -4742,6 +4757,7 @@ fn shell(cx: &mut compositor::Context, cmd: &str, behavior: &ShellBehavior) { let selection = doc.selection(view.id); let mut changes = Vec::with_capacity(selection.len()); + let mut ranges = SmallVec::with_capacity(selection.len()); let text = doc.text().slice(..); for range in selection.ranges() { @@ -4765,11 +4781,13 @@ fn shell(cx: &mut compositor::Context, cmd: &str, behavior: &ShellBehavior) { ShellBehavior::Append => (range.to(), range.to()), _ => (range.from(), range.from()), }; + ranges.push(Range::new(to, to + output.chars().count())); changes.push((from, to, Some(output))); } if behavior != &ShellBehavior::Ignore { - let transaction = Transaction::change(doc.text(), changes.into_iter()); + let transaction = Transaction::change(doc.text(), changes.into_iter()) + .with_selection(Selection::new(ranges, selection.primary_index())); apply_transaction(&transaction, doc, view); doc.append_changes_to_history(view.id); } From 38149872989477f62222ce68dc32d2d6018ae165 Mon Sep 17 00:00:00 2001 From: Michael Davis Date: Fri, 4 Nov 2022 11:04:16 -0500 Subject: [PATCH 034/491] Fix panic on paste from blackhole register (#4497) The sequence "_y"_p panics because the blackhole register contains an empty values vec. This causes a panic when pasting since it unwraps a `slice::last`. --- helix-term/src/commands.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index a6ee626305a1..ef963477f39e 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -3447,7 +3447,12 @@ enum Paste { } fn paste_impl(values: &[String], doc: &mut Document, view: &mut View, action: Paste, count: usize) { + if values.is_empty() { + return; + } + let repeat = std::iter::repeat( + // `values` is asserted to have at least one entry above. values .last() .map(|value| Tendril::from(value.repeat(count))) From 4ec2a21c6e21ab4e515f1bd7ee1049094af2a6b2 Mon Sep 17 00:00:00 2001 From: ChrHorn Date: Sat, 5 Nov 2022 19:30:40 +0100 Subject: [PATCH 035/491] Update Julia grammar, queries (#4588) --- languages.toml | 2 +- runtime/queries/julia/highlights.scm | 42 ++++++++++++++++++++++++---- runtime/queries/julia/locals.scm | 3 +- 3 files changed, 39 insertions(+), 8 deletions(-) diff --git a/languages.toml b/languages.toml index 061d141449d2..41558e10e9ad 100644 --- a/languages.toml +++ b/languages.toml @@ -604,7 +604,7 @@ indent = { tab-width = 4, unit = " " } [[grammar]] name = "julia" -source = { git = "https://github.com/tree-sitter/tree-sitter-julia", rev = "fc60b7cce87da7a1b7f8cb0f9371c3dc8b684500" } +source = { git = "https://github.com/tree-sitter/tree-sitter-julia", rev = "8fb38abff74652c4faddbf04d2d5bbbc6b4bae25" } [[language]] name = "java" diff --git a/runtime/queries/julia/highlights.scm b/runtime/queries/julia/highlights.scm index 9271615fbb1b..90baee21355d 100644 --- a/runtime/queries/julia/highlights.scm +++ b/runtime/queries/julia/highlights.scm @@ -7,13 +7,22 @@ (block_comment) ] @comment -(((identifier) @constant.builtin) (match? @constant.builtin "^(nothing|missing|Inf|NaN)$")) -(((identifier) @constant.builtin.boolean) (#eq? @constant.builtin.boolean "true")) -(((identifier) @constant.builtin.boolean) (#eq? @constant.builtin.boolean "false")) +( + ((identifier) @constant.builtin) + (#match? @constant.builtin "^(nothing|missing|undef)$")) + +[ + (true) + (false) +] @constant.builtin.boolean (integer_literal) @constant.numeric.integer (float_literal) @constant.numeric.float +( + ((identifier) @constant.numeric.float) + (#match? @constant.numeric.float "^((Inf|NaN)(16|32|64)?)$")) + (character_literal) @constant.character (escape_sequence) @constant.character.escape @@ -66,7 +75,7 @@ (type_parameter_list (identifier) @type) -(constrained_parameter +(constrained_type_parameter (identifier) @type) (subtype_clause @@ -81,13 +90,32 @@ (type_argument_list (identifier) @type) +(where_clause + (identifier) @type) + ; ------------------- ; Function definition ; ------------------- ( (function_definition - name: (identifier) @function) + name: [ + (identifier) @function + (scoped_identifier + (identifier) @namespace + (identifier) @function) + ]) + ; prevent constructors (PascalCase) to be highlighted as functions + (#match? @function "^[^A-Z]")) + +( + (short_function_definition + name: [ + (identifier) @function + (scoped_identifier + (identifier) @namespace + (identifier) @function) + ]) ; prevent constructors (PascalCase) to be highlighted as functions (#match? @function "^[^A-Z]")) @@ -101,7 +129,7 @@ (optional_parameter . (identifier) @variable.parameter) -(spread_parameter +(slurp_parameter (identifier) @variable.parameter) (function_expression @@ -185,6 +213,7 @@ [ "abstract" + "baremodule" "begin" "const" "do" @@ -198,6 +227,7 @@ "return" "struct" "type" + "where" ] @keyword ; TODO: fix this diff --git a/runtime/queries/julia/locals.scm b/runtime/queries/julia/locals.scm index 07b96f2c66e1..70b31e50924b 100644 --- a/runtime/queries/julia/locals.scm +++ b/runtime/queries/julia/locals.scm @@ -21,7 +21,7 @@ (optional_parameter . (identifier) @local.definition) -(spread_parameter +(slurp_parameter (identifier) @local.definition) (function_expression @@ -33,6 +33,7 @@ [ (function_definition) + (short_function_definition) (macro_definition) ] @local.scope From 48a3965ab43718ce2a49724cbcc294b04c328b81 Mon Sep 17 00:00:00 2001 From: Michael Davis Date: Sun, 6 Nov 2022 08:56:45 -0600 Subject: [PATCH 036/491] Fix range offsets in multi-selection paste (#4608) * Fix range offsets in multi-selection paste d6323b7cbc21a9d3ba29738c76581dad93f9f415 introduced a regression with multi-selection paste where pasting would not adjust the ranges correctly. To fix it, we need to track the total number of characters inserted in each changed selection and use that offset to slide each new range forwards. * Inherit selection directions on paste * Add an integration-test for multi-selection pasting --- helix-term/src/commands.rs | 6 +++++- helix-term/tests/test/commands.rs | 22 ++++++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index ef963477f39e..ae9e35f1ff47 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -3476,6 +3476,7 @@ fn paste_impl(values: &[String], doc: &mut Document, view: &mut View, action: Pa let text = doc.text(); let selection = doc.selection(view.id); + let mut offset = 0; let mut ranges = SmallVec::with_capacity(selection.len()); let transaction = Transaction::change_by_selection(text, selection, |range| { @@ -3501,8 +3502,11 @@ fn paste_impl(values: &[String], doc: &mut Document, view: &mut View, action: Pa .as_ref() .map(|content| content.chars().count()) .unwrap_or_default(); + let anchor = offset + pos; - ranges.push(Range::new(pos, pos + value_len)); + let new_range = Range::new(anchor, anchor + value_len).with_direction(range.direction()); + ranges.push(new_range); + offset += value_len; (pos, pos, value) }); diff --git a/helix-term/tests/test/commands.rs b/helix-term/tests/test/commands.rs index aadf104bb427..e78e6c9f9964 100644 --- a/helix-term/tests/test/commands.rs +++ b/helix-term/tests/test/commands.rs @@ -193,3 +193,25 @@ async fn test_goto_file_impl() -> anyhow::Result<()> { Ok(()) } + +#[tokio::test(flavor = "multi_thread")] +async fn test_multi_selection_paste() -> anyhow::Result<()> { + test(( + platform_line(indoc! {"\ + #[|lorem]# + #(|ipsum)# + #(|dolor)# + "}) + .as_str(), + "yp", + platform_line(indoc! {"\ + lorem#[|lorem]# + ipsum#(|ipsum)# + dolor#(|dolor)# + "}) + .as_str(), + )) + .await?; + + Ok(()) +} From 1536a6528968f38adfac2e991b29006f5ded5968 Mon Sep 17 00:00:00 2001 From: Michael Davis Date: Thu, 3 Nov 2022 20:55:13 -0500 Subject: [PATCH 037/491] Fix whitespace handling in command-mode completion 8584b38cfbe6ffe3e5d539ad953c413e44e90bfa switched to shellwords for completion in command-mode. This changes the conditions for choosing whether to complete the command or use the command's completer. This change processes the input as shellwords up-front and uses shellword logic about whitespace to determine whether the command or argument should be completed. --- helix-core/src/shellwords.rs | 84 ++++++++++++++++++++++++++++---- helix-term/src/commands/typed.rs | 18 ++++--- 2 files changed, 86 insertions(+), 16 deletions(-) diff --git a/helix-core/src/shellwords.rs b/helix-core/src/shellwords.rs index e8c5945b726b..3375bef19df2 100644 --- a/helix-core/src/shellwords.rs +++ b/helix-core/src/shellwords.rs @@ -17,18 +17,18 @@ pub fn escape(input: &str) -> Cow<'_, str> { } } +enum State { + OnWhitespace, + Unquoted, + UnquotedEscaped, + Quoted, + QuoteEscaped, + Dquoted, + DquoteEscaped, +} + /// Get the vec of escaped / quoted / doublequoted filenames from the input str pub fn shellwords(input: &str) -> Vec> { - enum State { - OnWhitespace, - Unquoted, - UnquotedEscaped, - Quoted, - QuoteEscaped, - Dquoted, - DquoteEscaped, - } - use State::*; let mut state = Unquoted; @@ -140,6 +140,70 @@ pub fn shellwords(input: &str) -> Vec> { args } +/// Checks that the input ends with an ascii whitespace character which is +/// not escaped. +/// +/// # Examples +/// +/// ```rust +/// use helix_core::shellwords::ends_with_whitespace; +/// assert_eq!(ends_with_whitespace(" "), true); +/// assert_eq!(ends_with_whitespace(":open "), true); +/// assert_eq!(ends_with_whitespace(":open foo.txt "), true); +/// assert_eq!(ends_with_whitespace(":open"), false); +/// #[cfg(unix)] +/// assert_eq!(ends_with_whitespace(":open a\\ "), false); +/// #[cfg(unix)] +/// assert_eq!(ends_with_whitespace(":open a\\ b.txt"), false); +/// ``` +pub fn ends_with_whitespace(input: &str) -> bool { + use State::*; + + // Fast-lane: the input must end with a whitespace character + // regardless of quoting. + if !input.ends_with(|c: char| c.is_ascii_whitespace()) { + return false; + } + + let mut state = Unquoted; + + for c in input.chars() { + state = match state { + OnWhitespace => match c { + '"' => Dquoted, + '\'' => Quoted, + '\\' if cfg!(unix) => UnquotedEscaped, + '\\' => OnWhitespace, + c if c.is_ascii_whitespace() => OnWhitespace, + _ => Unquoted, + }, + Unquoted => match c { + '\\' if cfg!(unix) => UnquotedEscaped, + '\\' => Unquoted, + c if c.is_ascii_whitespace() => OnWhitespace, + _ => Unquoted, + }, + UnquotedEscaped => Unquoted, + Quoted => match c { + '\\' if cfg!(unix) => QuoteEscaped, + '\\' => Quoted, + '\'' => OnWhitespace, + _ => Quoted, + }, + QuoteEscaped => Quoted, + Dquoted => match c { + '\\' if cfg!(unix) => DquoteEscaped, + '\\' => Dquoted, + '"' => OnWhitespace, + _ => Dquoted, + }, + DquoteEscaped => Dquoted, + } + } + + matches!(state, OnWhitespace) +} + #[cfg(test)] mod test { use super::*; diff --git a/helix-term/src/commands/typed.rs b/helix-term/src/commands/typed.rs index f4dfce7a8c53..304b30f93ea0 100644 --- a/helix-term/src/commands/typed.rs +++ b/helix-term/src/commands/typed.rs @@ -2183,10 +2183,11 @@ pub(super) fn command_mode(cx: &mut Context) { static FUZZY_MATCHER: Lazy = Lazy::new(fuzzy_matcher::skim::SkimMatcherV2::default); - // simple heuristic: if there's no just one part, complete command name. - // if there's a space, per command completion kicks in. - // we use .this over split_whitespace() because we care about empty segments - if input.split(' ').count() <= 1 { + let parts = shellwords::shellwords(input); + let ends_with_whitespace = shellwords::ends_with_whitespace(input); + + if parts.is_empty() || (parts.len() == 1 && !ends_with_whitespace) { + // If the command has not been finished yet, complete commands. let mut matches: Vec<_> = typed::TYPABLE_COMMAND_LIST .iter() .filter_map(|command| { @@ -2202,8 +2203,13 @@ pub(super) fn command_mode(cx: &mut Context) { .map(|(name, _)| (0.., name.into())) .collect() } else { - let parts = shellwords::shellwords(input); - let part = parts.last().unwrap(); + // Otherwise, use the command's completer and the last shellword + // as completion input. + let part = if parts.len() == 1 { + &Cow::Borrowed("") + } else { + parts.last().unwrap() + }; if let Some(typed::TypableCommand { completer: Some(completer), From 3d283b2ca43bb077f52c48fec5e4870cd314b4e3 Mon Sep 17 00:00:00 2001 From: Michael Davis Date: Thu, 3 Nov 2022 20:58:54 -0500 Subject: [PATCH 038/491] Escape filenames in command completion This changes the completion items to be rendered with shellword escaping, so a file `a b.txt` is rendered as `a\ b.txt` which matches how it should be inputted. --- helix-core/src/shellwords.rs | 14 +++++++------- helix-term/src/commands/typed.rs | 1 + helix-term/src/ui/prompt.rs | 6 +----- 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/helix-core/src/shellwords.rs b/helix-core/src/shellwords.rs index 3375bef19df2..7742896c2866 100644 --- a/helix-core/src/shellwords.rs +++ b/helix-core/src/shellwords.rs @@ -1,9 +1,9 @@ use std::borrow::Cow; /// Auto escape for shellwords usage. -pub fn escape(input: &str) -> Cow<'_, str> { +pub fn escape(input: Cow) -> Cow { if !input.chars().any(|x| x.is_ascii_whitespace()) { - Cow::Borrowed(input) + input } else if cfg!(unix) { Cow::Owned(input.chars().fold(String::new(), |mut buf, c| { if c.is_ascii_whitespace() { @@ -311,15 +311,15 @@ mod test { #[test] #[cfg(unix)] fn test_escaping_unix() { - assert_eq!(escape("foobar"), Cow::Borrowed("foobar")); - assert_eq!(escape("foo bar"), Cow::Borrowed("foo\\ bar")); - assert_eq!(escape("foo\tbar"), Cow::Borrowed("foo\\\tbar")); + assert_eq!(escape("foobar".into()), Cow::Borrowed("foobar")); + assert_eq!(escape("foo bar".into()), Cow::Borrowed("foo\\ bar")); + assert_eq!(escape("foo\tbar".into()), Cow::Borrowed("foo\\\tbar")); } #[test] #[cfg(windows)] fn test_escaping_windows() { - assert_eq!(escape("foobar"), Cow::Borrowed("foobar")); - assert_eq!(escape("foo bar"), Cow::Borrowed("\"foo bar\"")); + assert_eq!(escape("foobar".into()), Cow::Borrowed("foobar")); + assert_eq!(escape("foo bar".into()), Cow::Borrowed("\"foo bar\"")); } } diff --git a/helix-term/src/commands/typed.rs b/helix-term/src/commands/typed.rs index 304b30f93ea0..36080d39265e 100644 --- a/helix-term/src/commands/typed.rs +++ b/helix-term/src/commands/typed.rs @@ -2219,6 +2219,7 @@ pub(super) fn command_mode(cx: &mut Context) { completer(editor, part) .into_iter() .map(|(range, file)| { + let file = shellwords::escape(file); // offset ranges to input let offset = input.len() - part.len(); let range = (range.start + offset)..; diff --git a/helix-term/src/ui/prompt.rs b/helix-term/src/ui/prompt.rs index ca2872a7d0a4..51ef688d7647 100644 --- a/helix-term/src/ui/prompt.rs +++ b/helix-term/src/ui/prompt.rs @@ -1,6 +1,5 @@ use crate::compositor::{Component, Compositor, Context, Event, EventResult}; use crate::{alt, ctrl, key, shift, ui}; -use helix_core::shellwords; use helix_view::input::KeyEvent; use helix_view::keyboard::KeyCode; use std::{borrow::Cow, ops::RangeFrom}; @@ -336,10 +335,7 @@ impl Prompt { let (range, item) = &self.completion[index]; - // since we are using shellwords to parse arguments, make sure - // that whitespace in files is properly escaped. - let item = shellwords::escape(item); - self.line.replace_range(range.clone(), &item); + self.line.replace_range(range.clone(), item); self.move_end(); } From 140df92d7936e1fd036128d98ab565d92e9d2bd8 Mon Sep 17 00:00:00 2001 From: Michael Davis Date: Thu, 3 Nov 2022 21:02:26 -0500 Subject: [PATCH 039/491] Fix command-mode completion behavior when input is escaped If `a\ b.txt` were a local file, `:o a\ ` would fill the prompt with `:o aa\ b.txt` because the replacement range was calculated using the shellwords-parsed part. Escaping the part before calculating its length fixes this edge-case. --- helix-term/src/commands/typed.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/helix-term/src/commands/typed.rs b/helix-term/src/commands/typed.rs index 36080d39265e..2f387bfd1a2e 100644 --- a/helix-term/src/commands/typed.rs +++ b/helix-term/src/commands/typed.rs @@ -2216,12 +2216,15 @@ pub(super) fn command_mode(cx: &mut Context) { .. }) = typed::TYPABLE_COMMAND_MAP.get(&parts[0] as &str) { + let part_len = shellwords::escape(part.clone()).len(); + completer(editor, part) .into_iter() .map(|(range, file)| { let file = shellwords::escape(file); + // offset ranges to input - let offset = input.len() - part.len(); + let offset = input.len() - part_len; let range = (range.start + offset)..; (range, file) }) From eddf9f0b7f2eacac690afad05abdae398bb17366 Mon Sep 17 00:00:00 2001 From: Jonathan LEI Date: Mon, 7 Nov 2022 12:39:18 +0800 Subject: [PATCH 040/491] Run clippy on workspace in CI (#4614) --- .github/workflows/build.yml | 2 +- helix-core/src/test.rs | 1 + xtask/src/querycheck.rs | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ef47a277b1b9..157343618bf4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -101,7 +101,7 @@ jobs: uses: actions-rs/cargo@v1 with: command: clippy - args: --all-targets -- -D warnings + args: --workspace --all-targets -- -D warnings - name: Run cargo doc uses: actions-rs/cargo@v1 diff --git a/helix-core/src/test.rs b/helix-core/src/test.rs index 3e54d2c245f3..17523ed76107 100644 --- a/helix-core/src/test.rs +++ b/helix-core/src/test.rs @@ -148,6 +148,7 @@ pub fn plain(s: &str, selection: Selection) -> String { } #[cfg(test)] +#[allow(clippy::module_inception)] mod test { use super::*; diff --git a/xtask/src/querycheck.rs b/xtask/src/querycheck.rs index 7014c7d6f5d5..454d0e5cd9cb 100644 --- a/xtask/src/querycheck.rs +++ b/xtask/src/querycheck.rs @@ -17,8 +17,8 @@ pub fn query_check() -> Result<(), DynError> { let language_name = &language.language_id; let grammar_name = language.grammar.as_ref().unwrap_or(language_name); for query_file in query_files { - let language = get_language(&grammar_name); - let query_text = read_query(&language_name, query_file); + let language = get_language(grammar_name); + let query_text = read_query(language_name, query_file); if let Ok(lang) = language { if !query_text.is_empty() { if let Err(reason) = Query::new(lang, &query_text) { From da8f29eaa7d51be7b0417111281b6cc526842f85 Mon Sep 17 00:00:00 2001 From: Ryan Palmer Date: Mon, 7 Nov 2022 05:32:40 -0800 Subject: [PATCH 041/491] Fixed disorienting selection palette on Gruvbox theme (#4626) Co-authored-by: ryan.palmer --- runtime/themes/gruvbox.toml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/runtime/themes/gruvbox.toml b/runtime/themes/gruvbox.toml index aa7a464a4e0f..4f0a7d9f880c 100644 --- a/runtime/themes/gruvbox.toml +++ b/runtime/themes/gruvbox.toml @@ -52,9 +52,9 @@ "ui.help" = { bg = "bg1", fg = "fg1" } "ui.text" = { fg = "fg1" } "ui.text.focus" = { fg = "fg1" } -"ui.selection" = { bg = "bg3", modifiers = ["reversed"] } -"ui.cursor.primary" = { modifiers = ["reversed"] } -"ui.cursor.match" = { bg = "bg2" } +"ui.selection" = { bg = "bg2" } +"ui.cursor.primary" = { bg = "fg4", fg = "bg1" } +"ui.cursor.match" = { bg = "bg3" } "ui.menu" = { fg = "fg1", bg = "bg2" } "ui.menu.selected" = { fg = "bg2", bg = "blue1", modifiers = ["bold"] } "ui.virtual.whitespace" = "bg2" From 6cafd81e41f353a7005eef4248a09a2b1849bc5c Mon Sep 17 00:00:00 2001 From: Tobias Kohlbau Date: Mon, 7 Nov 2022 14:53:29 +0100 Subject: [PATCH 042/491] tutor: fix wording in recap for chapter 5 (#4629) In recap for chapter 5.1 specify that the cursor is duplicted to the next suitable line instead of the next line. Signed-off-by: Tobias Kohlbau --- runtime/tutor | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/runtime/tutor b/runtime/tutor index 43edb360e83a..eb1d9885350e 100644 --- a/runtime/tutor +++ b/runtime/tutor @@ -596,8 +596,8 @@ _________________________________________________________________ = CHAPTER 5 RECAP = ================================================================= - * Type C to copy the current selection to below and Alt-C for - above. + * Type C to duplicate the cursor to the next suitable line + and Alt-C for previous suitable line. * Type s to select all instances of a regex pattern inside the current selection. From 5bfe84fb4f78379921fdd5eed03f118181e90a4e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 7 Nov 2022 18:06:05 -0600 Subject: [PATCH 043/491] build(deps): bump libloading from 0.7.3 to 0.7.4 (#4639) Bumps [libloading](https://github.com/nagisa/rust_libloading) from 0.7.3 to 0.7.4. - [Release notes](https://github.com/nagisa/rust_libloading/releases) - [Commits](https://github.com/nagisa/rust_libloading/compare/0.7.3...0.7.4) --- updated-dependencies: - dependency-name: libloading dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 93459aa07fa6..a4528289ead9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -655,9 +655,9 @@ checksum = "8371e4e5341c3a96db127eb2465ac681ced4c433e01dd0e938adbef26ba93ba5" [[package]] name = "libloading" -version = "0.7.3" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "efbc0f03f9a775e9f6aed295c6a1ba2253c5757a9e03d55c6caa46a681abcddd" +checksum = "b67380fd3b2fbe7527a606e18729d21c6f3951633d0500574c4dc22d2d638b9f" dependencies = [ "cfg-if", "winapi", From 535cf90093573d86af6e5510c90aee476703fed7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 7 Nov 2022 18:07:21 -0600 Subject: [PATCH 044/491] build(deps): bump regex from 1.6.0 to 1.7.0 (#4640) Bumps [regex](https://github.com/rust-lang/regex) from 1.6.0 to 1.7.0. - [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.6.0...1.7.0) --- updated-dependencies: - dependency-name: regex dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a4528289ead9..f0bf11f2b686 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -876,9 +876,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.6.0" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c4eb3267174b8c6c2f654116623910a0fef09c4753f8dd83db29c48a0df988b" +checksum = "e076559ef8e241f2ae3479e36f97bd5741c0330689e217ad51ce2c76808b868a" dependencies = [ "aho-corasick", "memchr", From 188aff059bf9558b4fa28b03d5929020ff76cdb3 Mon Sep 17 00:00:00 2001 From: Danillo Melo Date: Mon, 7 Nov 2022 22:43:00 -0300 Subject: [PATCH 045/491] Improve Ruby TextObjects (#4601) --- runtime/queries/ruby/textobjects.scm | 50 +++++++++++----------------- 1 file changed, 20 insertions(+), 30 deletions(-) diff --git a/runtime/queries/ruby/textobjects.scm b/runtime/queries/ruby/textobjects.scm index 34888c17d571..2d48fa6fccd7 100644 --- a/runtime/queries/ruby/textobjects.scm +++ b/runtime/queries/ruby/textobjects.scm @@ -1,11 +1,6 @@ -; Class -(class) @class.around - -(class [(constant) (scope_resolution)] !superclass - (_)+ @class.inside) - -(class [(constant) (scope_resolution)] (superclass) - (_)+ @class.inside) +; Class and Modules +(class + body: (_)? @class.inside) @class.around (singleton_class value: (_) @@ -17,37 +12,32 @@ (#match? @class_const "Class") (#match? @class_method "new") (do_block (_)+ @class.inside)) @class.around + +(module + body: (_)? @class.inside) @class.around -; Functions -(method) @function.around +; Functions and Blocks +(singleton_method + body: (_)? @function.inside) @function.around -(method (identifier) (method_parameters) - (_)+ @function.inside) - -(do_block !parameters - (_)+ @function.inside) - -(do_block (block_parameters) - (_)+ @function.inside) - -(block (block_parameters) - (_)+ @function.inside) - -(block !parameters - (_)+ @function.inside) - -(method (identifier) !parameters - (_)+ @function.inside) +(method + body: (_)? @function.inside) @function.around + +(do_block + body: (_)? @function.inside) @function.around + +(block + body: (_)? @function.inside) @function.around ; Parameters (method_parameters - (_) @parameter.inside) + (_) @parameter.inside) @parameter.around (block_parameters - (_) @parameter.inside) + (_) @parameter.inside) @parameter.around (lambda_parameters - (_) @parameter.inside) + (_) @parameter.inside) @parameter.around ; Comments (comment) @comment.inside From 13126823f83cb90a3aabfc2326c0907d1ca2d921 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bla=C5=BE=20Hrastnik?= Date: Tue, 8 Nov 2022 20:48:06 +0900 Subject: [PATCH 046/491] lsp: Support insertReplace Fixes #4473 --- helix-lsp/src/client.rs | 1 + helix-term/src/ui/completion.rs | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/helix-lsp/src/client.rs b/helix-lsp/src/client.rs index 0b443ccf402d..81b7d8adae57 100644 --- a/helix-lsp/src/client.rs +++ b/helix-lsp/src/client.rs @@ -311,6 +311,7 @@ impl Client { String::from("additionalTextEdits"), ], }), + insert_replace_support: Some(true), ..Default::default() }), completion_item_kind: Some(lsp::CompletionItemKindCapability { diff --git a/helix-term/src/ui/completion.rs b/helix-term/src/ui/completion.rs index de7c3232bb3d..5ec8cf892bc6 100644 --- a/helix-term/src/ui/completion.rs +++ b/helix-term/src/ui/completion.rs @@ -113,7 +113,8 @@ impl Completion { let edit = match edit { lsp::CompletionTextEdit::Edit(edit) => edit.clone(), lsp::CompletionTextEdit::InsertAndReplace(item) => { - unimplemented!("completion: insert_and_replace {:?}", item) + // TODO: support using "insert" instead of "replace" via user config + lsp::TextEdit::new(item.replace, item.new_text.clone()) } }; From c94feed83d746e71fb030639d740af85162b0763 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bla=C5=BE=20Hrastnik?= Date: Tue, 8 Nov 2022 21:03:54 +0900 Subject: [PATCH 047/491] core: Move state into the history module --- helix-core/src/comment.rs | 40 ++++++++++++++++++-------------------- helix-core/src/history.rs | 19 +++++++++++++++--- helix-core/src/lib.rs | 2 -- helix-core/src/state.rs | 17 ---------------- helix-term/src/commands.rs | 1 - helix-view/src/document.rs | 4 ++-- 6 files changed, 37 insertions(+), 46 deletions(-) delete mode 100644 helix-core/src/state.rs diff --git a/helix-core/src/comment.rs b/helix-core/src/comment.rs index 44f6cdfecc4f..ec5d7a45aba2 100644 --- a/helix-core/src/comment.rs +++ b/helix-core/src/comment.rs @@ -100,43 +100,41 @@ mod test { #[test] fn test_find_line_comment() { - use crate::State; - // four lines, two space indented, except for line 1 which is blank. - let doc = Rope::from(" 1\n\n 2\n 3"); - - let mut state = State::new(doc); + let mut doc = Rope::from(" 1\n\n 2\n 3"); // select whole document - state.selection = Selection::single(0, state.doc.len_chars() - 1); + let mut selection = Selection::single(0, doc.len_chars() - 1); - let text = state.doc.slice(..); + let text = doc.slice(..); let res = find_line_comment("//", text, 0..3); // (commented = true, to_change = [line 0, line 2], min = col 2, margin = 1) assert_eq!(res, (false, vec![0, 2], 2, 1)); // comment - let transaction = toggle_line_comments(&state.doc, &state.selection, None); - transaction.apply(&mut state.doc); - state.selection = state.selection.map(transaction.changes()); + let transaction = toggle_line_comments(&doc, &selection, None); + transaction.apply(&mut doc); + selection = selection.map(transaction.changes()); - assert_eq!(state.doc, " // 1\n\n // 2\n // 3"); + assert_eq!(doc, " // 1\n\n // 2\n // 3"); // uncomment - let transaction = toggle_line_comments(&state.doc, &state.selection, None); - transaction.apply(&mut state.doc); - state.selection = state.selection.map(transaction.changes()); - assert_eq!(state.doc, " 1\n\n 2\n 3"); + let transaction = toggle_line_comments(&doc, &selection, None); + transaction.apply(&mut doc); + selection = selection.map(transaction.changes()); + assert_eq!(doc, " 1\n\n 2\n 3"); + assert!(selection.len() == 1); // to ignore the selection unused warning // 0 margin comments - state.doc = Rope::from(" //1\n\n //2\n //3"); + doc = Rope::from(" //1\n\n //2\n //3"); // reset the selection. - state.selection = Selection::single(0, state.doc.len_chars() - 1); + selection = Selection::single(0, doc.len_chars() - 1); - let transaction = toggle_line_comments(&state.doc, &state.selection, None); - transaction.apply(&mut state.doc); - state.selection = state.selection.map(transaction.changes()); - assert_eq!(state.doc, " 1\n\n 2\n 3"); + let transaction = toggle_line_comments(&doc, &selection, None); + transaction.apply(&mut doc); + selection = selection.map(transaction.changes()); + assert_eq!(doc, " 1\n\n 2\n 3"); + assert!(selection.len() == 1); // to ignore the selection unused warning // TODO: account for uncommenting with uneven comment indentation } diff --git a/helix-core/src/history.rs b/helix-core/src/history.rs index 5cd72b077ddf..51174c02475e 100644 --- a/helix-core/src/history.rs +++ b/helix-core/src/history.rs @@ -1,9 +1,15 @@ -use crate::{Assoc, ChangeSet, Range, Rope, State, Transaction}; +use crate::{Assoc, ChangeSet, Range, Rope, Selection, Transaction}; use once_cell::sync::Lazy; use regex::Regex; use std::num::NonZeroUsize; use std::time::{Duration, Instant}; +#[derive(Debug, Clone)] +pub struct State { + pub doc: Rope, + pub selection: Selection, +} + /// Stores the history of changes to a buffer. /// /// Currently the history is represented as a vector of revisions. The vector @@ -366,12 +372,16 @@ impl std::str::FromStr for UndoKind { #[cfg(test)] mod test { use super::*; + use crate::Selection; #[test] fn test_undo_redo() { let mut history = History::default(); let doc = Rope::from("hello"); - let mut state = State::new(doc); + let mut state = State { + doc, + selection: Selection::point(0), + }; let transaction1 = Transaction::change(&state.doc, vec![(5, 5, Some(" world!".into()))].into_iter()); @@ -420,7 +430,10 @@ mod test { fn test_earlier_later() { let mut history = History::default(); let doc = Rope::from("a\n"); - let mut state = State::new(doc); + let mut state = State { + doc, + selection: Selection::point(0), + }; fn undo(history: &mut History, state: &mut State) { if let Some(transaction) = history.undo() { diff --git a/helix-core/src/lib.rs b/helix-core/src/lib.rs index 8f869e352de5..5f60c04890de 100644 --- a/helix-core/src/lib.rs +++ b/helix-core/src/lib.rs @@ -21,7 +21,6 @@ pub mod register; pub mod search; pub mod selection; pub mod shellwords; -mod state; pub mod surround; pub mod syntax; pub mod test; @@ -103,7 +102,6 @@ pub use smallvec::{smallvec, SmallVec}; pub use syntax::Syntax; pub use diagnostic::Diagnostic; -pub use state::State; pub use line_ending::{LineEnding, DEFAULT_LINE_ENDING}; pub use transaction::{Assoc, Change, ChangeSet, Operation, Transaction}; diff --git a/helix-core/src/state.rs b/helix-core/src/state.rs deleted file mode 100644 index dcc4b11b7fe4..000000000000 --- a/helix-core/src/state.rs +++ /dev/null @@ -1,17 +0,0 @@ -use crate::{Rope, Selection}; - -#[derive(Debug, Clone)] -pub struct State { - pub doc: Rope, - pub selection: Selection, -} - -impl State { - #[must_use] - pub fn new(doc: Rope) -> Self { - Self { - doc, - selection: Selection::point(0), - } - } -} diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index ae9e35f1ff47..31498a7b51a4 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -3465,7 +3465,6 @@ fn paste_impl(values: &[String], doc: &mut Document, view: &mut View, action: Pa .any(|value| get_line_ending_of_str(value).is_some()); // Only compiled once. - #[allow(clippy::trivial_regex)] static REGEX: Lazy = Lazy::new(|| Regex::new(r"\r\n|\r|\n").unwrap()); let mut values = values .iter() diff --git a/helix-view/src/document.rs b/helix-view/src/document.rs index 9a7febd2def2..087085283391 100644 --- a/helix-view/src/document.rs +++ b/helix-view/src/document.rs @@ -16,11 +16,11 @@ use std::sync::Arc; use helix_core::{ encoding, - history::{History, UndoKind}, + history::{History, State, UndoKind}, indent::{auto_detect_indent_style, IndentStyle}, line_ending::auto_detect_line_ending, syntax::{self, LanguageConfiguration}, - ChangeSet, Diagnostic, LineEnding, Rope, RopeBuilder, Selection, State, Syntax, Transaction, + ChangeSet, Diagnostic, LineEnding, Rope, RopeBuilder, Selection, Syntax, Transaction, DEFAULT_LINE_ENDING, }; From 7ed9e9cf2567ee5e23cd8694ffccb4b38602c02a Mon Sep 17 00:00:00 2001 From: Doug Kelkhoff <18220321+dgkf@users.noreply.github.com> Date: Tue, 8 Nov 2022 07:19:59 -0500 Subject: [PATCH 048/491] Dynamically resize line number gutter width (#3469) * dynamically resize line number gutter width * removing digits lower-bound, permitting spacer * removing max line num char limit; adding notes; qualified successors; notes * updating tests to use new line number width when testing views * linenr width based on document line count * using min width of 2 so line numbers relative is useful * lint rolling; removing unnecessary type parameter lifetime * merge change resolution * reformat code * rename row_styler to style; add int_log resource * adding spacer to gutters default; updating book config entry * adding view.inner_height(), swap for loop for iterator * reverting change of current! to view! now that doc is not needed --- book/src/configuration.md | 2 +- helix-term/src/commands.rs | 16 ++-- helix-term/src/ui/editor.rs | 17 +++-- helix-view/src/editor.rs | 9 ++- helix-view/src/gutter.rs | 57 ++++++++++++-- helix-view/src/lib.rs | 2 +- helix-view/src/tree.rs | 4 +- helix-view/src/view.rs | 145 ++++++++++++++++-------------------- 8 files changed, 143 insertions(+), 109 deletions(-) diff --git a/book/src/configuration.md b/book/src/configuration.md index 9f3fe2fa95bd..20abeba5a216 100644 --- a/book/src/configuration.md +++ b/book/src/configuration.md @@ -46,7 +46,7 @@ on unix operating systems. | `line-number` | Line number display: `absolute` simply shows each line's number, while `relative` shows the distance from the current line. When unfocused or in insert mode, `relative` will still show absolute line numbers. | `absolute` | | `cursorline` | Highlight all lines with a cursor. | `false` | | `cursorcolumn` | Highlight all columns with a cursor. | `false` | -| `gutters` | Gutters to display: Available are `diagnostics` and `line-numbers` and `spacer`, note that `diagnostics` also includes other features like breakpoints, 1-width padding will be inserted if gutters is non-empty | `["diagnostics", "line-numbers"]` | +| `gutters` | Gutters to display: Available are `diagnostics` and `line-numbers` and `spacer`, note that `diagnostics` also includes other features like breakpoints, 1-width padding will be inserted if gutters is non-empty | `["diagnostics", "spacer", "line-numbers"]` | | `auto-completion` | Enable automatic pop up of auto-completion. | `true` | | `auto-format` | Enable automatic formatting on save. | `true` | | `auto-save` | Enable automatic saving on focus moving away from Helix. Requires [focus event support](https://github.com/helix-editor/helix/wiki/Terminal-Support) from your terminal. | `false` | diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index 31498a7b51a4..4e3c321cb8fd 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -870,7 +870,7 @@ fn goto_window(cx: &mut Context, align: Align) { let config = cx.editor.config(); let (view, doc) = current!(cx.editor); - let height = view.inner_area().height as usize; + let height = view.inner_height(); // respect user given count if any // - 1 so we have at least one gap in the middle. @@ -1372,9 +1372,9 @@ pub fn scroll(cx: &mut Context, offset: usize, direction: Direction) { return; } - let height = view.inner_area().height; + let height = view.inner_height(); - let scrolloff = config.scrolloff.min(height as usize / 2); + let scrolloff = config.scrolloff.min(height / 2); view.offset.row = match direction { Forward => view.offset.row + offset, @@ -1412,25 +1412,25 @@ pub fn scroll(cx: &mut Context, offset: usize, direction: Direction) { fn page_up(cx: &mut Context) { let view = view!(cx.editor); - let offset = view.inner_area().height as usize; + let offset = view.inner_height(); scroll(cx, offset, Direction::Backward); } fn page_down(cx: &mut Context) { let view = view!(cx.editor); - let offset = view.inner_area().height as usize; + let offset = view.inner_height(); scroll(cx, offset, Direction::Forward); } fn half_page_up(cx: &mut Context) { let view = view!(cx.editor); - let offset = view.inner_area().height as usize / 2; + let offset = view.inner_height() / 2; scroll(cx, offset, Direction::Backward); } fn half_page_down(cx: &mut Context) { let view = view!(cx.editor); - let offset = view.inner_area().height as usize / 2; + let offset = view.inner_height() / 2; scroll(cx, offset, Direction::Forward); } @@ -4342,7 +4342,7 @@ fn align_view_middle(cx: &mut Context) { view.offset.col = pos .col - .saturating_sub((view.inner_area().width as usize) / 2); + .saturating_sub((view.inner_area(doc).width as usize) / 2); } fn scroll_up(cx: &mut Context) { diff --git a/helix-term/src/ui/editor.rs b/helix-term/src/ui/editor.rs index 2cd2ad056b53..f2a588e338f2 100644 --- a/helix-term/src/ui/editor.rs +++ b/helix-term/src/ui/editor.rs @@ -79,7 +79,7 @@ impl EditorView { surface: &mut Surface, is_focused: bool, ) { - let inner = view.inner_area(); + let inner = view.inner_area(doc); let area = view.area; let theme = &editor.theme; @@ -736,9 +736,10 @@ impl EditorView { // avoid lots of small allocations by reusing a text buffer for each line let mut text = String::with_capacity(8); - for (constructor, width) in view.gutters() { - let gutter = constructor(editor, doc, view, theme, is_focused, *width); - text.reserve(*width); // ensure there's enough space for the gutter + for gutter_type in view.gutters() { + let gutter = gutter_type.style(editor, doc, view, theme, is_focused); + let width = gutter_type.width(view, doc); + text.reserve(width); // ensure there's enough space for the gutter for (i, line) in (view.offset.row..(last_line + 1)).enumerate() { let selected = cursors.contains(&line); let x = viewport.x + offset; @@ -751,13 +752,13 @@ impl EditorView { }; if let Some(style) = gutter(line, selected, &mut text) { - surface.set_stringn(x, y, &text, *width, gutter_style.patch(style)); + surface.set_stringn(x, y, &text, width, gutter_style.patch(style)); } else { surface.set_style( Rect { x, y, - width: *width as u16, + width: width as u16, height: 1, }, gutter_style, @@ -766,7 +767,7 @@ impl EditorView { text.clear(); } - offset += *width as u16; + offset += width as u16; } } @@ -882,7 +883,7 @@ impl EditorView { .or_else(|| theme.try_get_exact("ui.cursorcolumn")) .unwrap_or_else(|| theme.get("ui.cursorline.secondary")); - let inner_area = view.inner_area(); + let inner_area = view.inner_area(doc); let offset = view.offset.col; let selection = doc.selection(view.id); diff --git a/helix-view/src/editor.rs b/helix-view/src/editor.rs index bcd8dedb8c81..db97cbb1472b 100644 --- a/helix-view/src/editor.rs +++ b/helix-view/src/editor.rs @@ -456,6 +456,7 @@ impl std::str::FromStr for GutterType { fn from_str(s: &str) -> Result { match s.to_lowercase().as_str() { "diagnostics" => Ok(Self::Diagnostics), + "spacer" => Ok(Self::Spacer), "line-numbers" => Ok(Self::LineNumbers), _ => anyhow::bail!("Gutter type can only be `diagnostics` or `line-numbers`."), } @@ -589,7 +590,11 @@ impl Default for Config { line_number: LineNumber::Absolute, cursorline: false, cursorcolumn: false, - gutters: vec![GutterType::Diagnostics, GutterType::LineNumbers], + gutters: vec![ + GutterType::Diagnostics, + GutterType::Spacer, + GutterType::LineNumbers, + ], middle_click_paste: true, auto_pairs: AutoPairConfig::default(), auto_completion: true, @@ -1308,7 +1313,7 @@ impl Editor { .primary() .cursor(doc.text().slice(..)); if let Some(mut pos) = view.screen_coords_at_pos(doc, doc.text().slice(..), cursor) { - let inner = view.inner_area(); + let inner = view.inner_area(doc); pos.col += inner.x as usize; pos.row += inner.y as usize; let cursorkind = config.cursor_shape.from_mode(self.mode); diff --git a/helix-view/src/gutter.rs b/helix-view/src/gutter.rs index 2c207d2768d4..61a1779186c3 100644 --- a/helix-view/src/gutter.rs +++ b/helix-view/src/gutter.rs @@ -1,21 +1,54 @@ use std::fmt::Write; use crate::{ + editor::GutterType, graphics::{Color, Style, UnderlineStyle}, Document, Editor, Theme, View, }; +fn count_digits(n: usize) -> usize { + // NOTE: if int_log gets standardized in stdlib, can use checked_log10 + // (https://github.com/rust-lang/rust/issues/70887#issue) + std::iter::successors(Some(n), |&n| (n >= 10).then(|| n / 10)).count() +} + pub type GutterFn<'doc> = Box Option - - - + \ No newline at end of file From 39ce82b7a59de8adcb1626151b1ce8fe7b7a4a8e Mon Sep 17 00:00:00 2001 From: lesleyrs <19632758+lesleyrs@users.noreply.github.com> Date: Fri, 2 Dec 2022 15:02:29 +0100 Subject: [PATCH 183/491] Add Ctrl-i alias for Windows (#4961) --- helix-term/src/keymap/default.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helix-term/src/keymap/default.rs b/helix-term/src/keymap/default.rs index 118764d97585..c0d17a87e065 100644 --- a/helix-term/src/keymap/default.rs +++ b/helix-term/src/keymap/default.rs @@ -198,7 +198,7 @@ pub fn default() -> HashMap { // z family for save/restore/combine from/to sels from register - "tab" => jump_forward, // tab == + "C-i" | "tab" => jump_forward, // tab == "C-o" => jump_backward, "C-s" => save_selection, From d0bc38d6fa60e36ef317e8bbbaa11aeb30470ecc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matou=C5=A1=20Dzivjak?= Date: Fri, 2 Dec 2022 15:06:35 +0100 Subject: [PATCH 184/491] feat(lang): bump tree-sitter-go (#4969) Update tree-sitter-go to latest with updated support for generics. See: https://github.com/tree-sitter/tree-sitter-go/compare/0fa917a7022d1cd2e9b779a6a8fc5dc7fad69c75..05900faa3cdb5d2d8c8bd5e77ee698487e0a8611 for full diff. --- languages.toml | 2 +- runtime/queries/go/indents.scm | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/languages.toml b/languages.toml index 4eb8a4dab1d5..9664d93a654b 100644 --- a/languages.toml +++ b/languages.toml @@ -301,7 +301,7 @@ args = { mode = "local", processId = "{0}" } [[grammar]] name = "go" -source = { git = "https://github.com/tree-sitter/tree-sitter-go", rev = "0fa917a7022d1cd2e9b779a6a8fc5dc7fad69c75" } +source = { git = "https://github.com/tree-sitter/tree-sitter-go", rev = "05900faa3cdb5d2d8c8bd5e77ee698487e0a8611" } [[language]] name = "gomod" diff --git a/runtime/queries/go/indents.scm b/runtime/queries/go/indents.scm index 8bfc7c3fe14a..f72ec9e827b0 100644 --- a/runtime/queries/go/indents.scm +++ b/runtime/queries/go/indents.scm @@ -5,7 +5,7 @@ (type_spec) (func_literal) (literal_value) - (element) + (literal_element) (keyed_element) (expression_case) (default_case) From 59b886cf5e89dadfd73d93b638b2c552ce5537f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?alex=20=E5=AD=99=E6=AC=A3=E4=B9=90?= Date: Fri, 2 Dec 2022 22:24:00 +0800 Subject: [PATCH 185/491] nightfox theme: Use brighter colors for diff scopes (#4966) --- runtime/themes/nightfox.toml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/runtime/themes/nightfox.toml b/runtime/themes/nightfox.toml index 131cab190870..c4cbbce0f726 100644 --- a/runtime/themes/nightfox.toml +++ b/runtime/themes/nightfox.toml @@ -140,10 +140,10 @@ # Diff ============================== # Version control changes. -"diff.plus" = "green-dim" # Additions. -"diff.minus" = "red-dim" # Deletions. -"diff.delta" = "blue-dim" # Modifications. -"diff.delta.moved" = "cyan-dim" # Renamed or moved files. +"diff.plus" = "green" # Additions. +"diff.minus" = "red" # Deletions. +"diff.delta" = "blue" # Modifications. +"diff.delta.moved" = "cyan" # Renamed or moved files. # color palette [palette] From b677c6a019f893c7ed8b9b84d136c50e5445315a Mon Sep 17 00:00:00 2001 From: Pascal Kuthe Date: Sat, 3 Dec 2022 03:05:15 +0100 Subject: [PATCH 186/491] Add logo with text included (#4973) --- README.md | 10 +++-- logo_dark.svg | 115 +++++++++++++++++++++++++++++++++++++++++++++++++ logo_light.svg | 115 +++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 237 insertions(+), 3 deletions(-) create mode 100644 logo_dark.svg create mode 100644 logo_light.svg diff --git a/README.md b/README.md index 3555b53916a4..b06e8222702c 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,12 @@
-Logo - -# Helix +

+ + + + Helix + +

[![Build status](https://github.com/helix-editor/helix/actions/workflows/build.yml/badge.svg)](https://github.com/helix-editor/helix/actions) [![GitHub Release](https://img.shields.io/github/v/release/helix-editor/helix)](https://github.com/helix-editor/helix/releases/latest) diff --git a/logo_dark.svg b/logo_dark.svg new file mode 100644 index 000000000000..f6e94f1b4c39 --- /dev/null +++ b/logo_dark.svg @@ -0,0 +1,115 @@ + + diff --git a/logo_light.svg b/logo_light.svg new file mode 100644 index 000000000000..cdd5ddb8b0a6 --- /dev/null +++ b/logo_light.svg @@ -0,0 +1,115 @@ + + From 224a024d3997035d04bf7b2f7424a472ff9936b8 Mon Sep 17 00:00:00 2001 From: Anton Romanov Date: Fri, 2 Dec 2022 18:26:01 -0800 Subject: [PATCH 187/491] Update zenburn theme for git gutters (#4977) --- runtime/themes/zenburn.toml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/runtime/themes/zenburn.toml b/runtime/themes/zenburn.toml index affb9f56deda..63f4ac72251e 100644 --- a/runtime/themes/zenburn.toml +++ b/runtime/themes/zenburn.toml @@ -37,9 +37,9 @@ "ui.virtual.indent-guide" = "#4f4f4f" -"diff.plus" = {fg = "#709080", bg = "#313c36", modifiers = ["bold"] } -"diff.delta" = "#333333" -"diff.minus" = {fg = "#333333", bg = "#464646"} +"diff.plus" = {fg = "#709080"} +"diff.delta" = {fg = "#464646"} +"diff.minus" = {fg = "#cc9393"} "diagnostic" = {bg = "statusbg"} "diagnostic.error" = { fg = "errorfg", bg = "errorbg"} From dc00291b4888f7ffad43fd544259227d0dbbf6fb Mon Sep 17 00:00:00 2001 From: Luna Date: Sat, 3 Dec 2022 03:26:10 +0100 Subject: [PATCH 188/491] Update Doom Acario for git gutters (#4979) Edited the diff.delta from green to blue. --- runtime/themes/doom_acario_dark.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/themes/doom_acario_dark.toml b/runtime/themes/doom_acario_dark.toml index c38c93eed5b2..95dc78e0dbb6 100644 --- a/runtime/themes/doom_acario_dark.toml +++ b/runtime/themes/doom_acario_dark.toml @@ -41,7 +41,7 @@ 'diff.plus' = { fg = 'green' } 'diff.minus' = { fg = 'red' } -'diff.delta' = { fg = 'green' } +'diff.delta' = { fg = 'blue' } 'ui.background'= { bg = 'bg' } 'ui.cursor' = { bg = 'orange', fg = 'bg-alt' } From bcdb475b71b0fbabce57344ac8d2575c23b1bbe0 Mon Sep 17 00:00:00 2001 From: Michael Davis Date: Fri, 2 Dec 2022 21:09:08 -0600 Subject: [PATCH 189/491] Fix transaction composition order in History::changes_since (#4981) * Add a undo/redo split test case for crossing branches * history: Switch up/down transaction chaining order The old code tends to work in practice because, usually, either up_txns or down_txns are empty. When both have contents though, we can run into a panic trying to compose them all since they will disagree on the length of the text. This fixes the panic test case in the parent commit. --- helix-core/src/history.rs | 2 +- helix-term/tests/test/splits.rs | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/helix-core/src/history.rs b/helix-core/src/history.rs index b99e969f93ba..1aac38d934c7 100644 --- a/helix-core/src/history.rs +++ b/helix-core/src/history.rs @@ -131,7 +131,7 @@ impl History { .map(|&n| self.revisions[n].inversion.clone()); let down_txns = down.iter().map(|&n| self.revisions[n].transaction.clone()); - up_txns.chain(down_txns).reduce(|acc, tx| tx.compose(acc)) + down_txns.chain(up_txns).reduce(|acc, tx| tx.compose(acc)) } /// Undo the last edit. diff --git a/helix-term/tests/test/splits.rs b/helix-term/tests/test/splits.rs index a34a24b7cbdf..96ced21a57cd 100644 --- a/helix-term/tests/test/splits.rs +++ b/helix-term/tests/test/splits.rs @@ -161,5 +161,30 @@ async fn test_changes_in_splits_apply_to_all_views() -> anyhow::Result<()> { )) .await?; + // See . + // This sequence undoes part of the history and then adds new changes, creating a + // new branch in the history tree. `View::sync_changes` applies transactions down + // and up to the lowest common ancestor in the path between old and new revision + // numbers. If we apply these up/down transactions in the wrong order, this case + // panics. + // The key sequence: + // * 3[ Create three empty lines so we are at the end of the document. + // * v Create a split and save that point at the end of the document + // in the jumplist. + // * w Switch back to the first window. + // * uu Undo twice (not three times which would bring us back to the + // root of the tree). + // * 3[ Create three empty lines. Now the end of the document is past + // where it was on step 1. + // * q Close window 1, focusing window 2 and causing a sync. This step + // panics if we don't apply in the right order. + // * %d Clean up the buffer. + test(( + "#[|]#", + "3[vwuu3[q%d", + "#[|]#", + )) + .await?; + Ok(()) } From 2123e91e56caccf60b9285f30bc2f2f12952520a Mon Sep 17 00:00:00 2001 From: Aleksey Kuznetsov Date: Sat, 3 Dec 2022 19:24:43 +0500 Subject: [PATCH 190/491] Enable auto format for css and scss files (#4987) provideFormatter enables capability in LS and auto-format performs format on save --- languages.toml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/languages.toml b/languages.toml index 9664d93a654b..d214a082fcc3 100644 --- a/languages.toml +++ b/languages.toml @@ -422,6 +422,8 @@ injection-regex = "css" file-types = ["css", "scss"] roots = [] language-server = { command = "vscode-css-language-server", args = ["--stdio"] } +auto-format = true +config = { "provideFormatter" = true } indent = { tab-width = 2, unit = " " } [[grammar]] @@ -435,6 +437,8 @@ injection-regex = "scss" file-types = ["scss"] roots = [] language-server = { command = "vscode-css-language-server", args = ["--stdio"] } +auto-format = true +config = { "provideFormatter" = true } indent = { tab-width = 2, unit = " " } [[grammar]] From 326a0dab069b65463db90e2647287c1e5b6b66aa Mon Sep 17 00:00:00 2001 From: Jens Getreu Date: Sun, 4 Dec 2022 03:03:42 +0100 Subject: [PATCH 191/491] Autumn theme: adjust some gray colors (#4996) --- runtime/themes/autumn.toml | 12 ++++++------ runtime/themes/autumn_night.toml | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/runtime/themes/autumn.toml b/runtime/themes/autumn.toml index b13aeef2bd8d..fe80261af294 100644 --- a/runtime/themes/autumn.toml +++ b/runtime/themes/autumn.toml @@ -10,13 +10,13 @@ "ui.background" = { bg = "my_gray0" } "ui.menu" = { fg = "my_white", bg = "my_gray2" } "ui.menu.selected" = { fg = "my_gray2", bg = "my_gray5" } -"ui.linenr" = { fg = "my_gray4", bg = "my_gray2" } +"ui.linenr" = { fg = "my_gray3", bg = "my_gray0" } "ui.popup" = { bg = "my_gray2" } -"ui.window" = { fg = "my_gray4", bg = "my_gray2" } -"ui.linenr.selected" = { fg = "my_gray6", bg = "my_gray1"} +"ui.window" = { fg = "my_gray3", bg = "my_gray2" } +"ui.linenr.selected" = { fg = "my_gray6", bg = "my_gray0"} "ui.selection" = { bg = "my_gray3" } "comment" = { fg = "my_gray4", modifiers = ["italic"] } -"ui.cursorline" = { bg = "my_gray2" } +"ui.cursorline" = { bg = "my_gray3" } "ui.statusline" = { fg = "my_gray6", bg = "my_gray2" } "ui.statusline.inactive" = { fg = 'my_gray4', bg = 'my_gray2' } "ui.statusline.insert" = {fg = "my_black", bg = "my_gray5", modifiers = ["bold"]} @@ -62,7 +62,7 @@ "diff.minus" = "my_red" "diagnostic" = { modifiers = ["underlined"] } -"ui.gutter" = { bg = "my_gray2" } +"ui.gutter" = { bg = "my_gray0" } "hint" = "my_gray5" "debug" = "my_yellow2" "info" = "my_yellow2" @@ -77,7 +77,7 @@ my_gray2 = "#323232" # Lighter Background (Used for status bars, line numbe my_gray3 = "#505050" # Selection Background my_gray4 = "#7c7c7c" # Comments, Invisibles, Line Highlighting my_gray5 = "#a8a8a8" # Dark Foreground (Used for status bars) -my_gray6 = "#c0c0c0" # Light Foreground (Not often used) +my_gray6 = "#c8c8c8" # Light Foreground (Not often used) my_gray7 = "#e8e8e8" # Light Background (Not often used) my_white = "#F3F2CC" # Default Foreground, Caret, Delimiters, Operators my_white2 = "#F3F2CC" # Variables, XML Tags, Markup Link Text, Markup Lists, Diff Deleted diff --git a/runtime/themes/autumn_night.toml b/runtime/themes/autumn_night.toml index 2f398dc96468..d01f5356931e 100644 --- a/runtime/themes/autumn_night.toml +++ b/runtime/themes/autumn_night.toml @@ -10,13 +10,13 @@ "ui.background" = { bg = "my_gray0" } "ui.menu" = { fg = "my_white", bg = "my_gray2" } "ui.menu.selected" = { fg = "my_gray2", bg = "my_gray5" } -"ui.linenr" = { fg = "my_gray4", bg = "my_gray2" } +"ui.linenr" = { fg = "my_gray3", bg = "my_gray0" } "ui.popup" = { bg = "my_gray2" } -"ui.window" = { fg = "my_gray4", bg = "my_gray2" } -"ui.linenr.selected" = { fg = "my_gray6", bg = "my_gray1"} +"ui.window" = { fg = "my_gray3", bg = "my_gray2" } +"ui.linenr.selected" = { fg = "my_gray6", bg = "my_gray0"} "ui.selection" = { bg = "my_gray3" } "comment" = { fg = "my_gray4", modifiers = ["italic"] } -"ui.cursorline" = { bg = "my_gray2" } +"ui.cursorline" = { bg = "my_gray3" } "ui.statusline" = { fg = "my_gray6", bg = "my_gray2" } "ui.statusline.inactive" = { fg = 'my_gray4', bg = 'my_gray2' } "ui.statusline.insert" = {fg = "my_black", bg = "my_gray5", modifiers = ["bold"]} @@ -62,7 +62,7 @@ "diff.minus" = "my_red" "diagnostic" = { modifiers = ["underlined"] } -"ui.gutter" = { bg = "my_gray2" } +"ui.gutter" = { bg = "my_gray0" } "hint" = "my_gray5" "debug" = "my_yellow2" "info" = "my_yellow2" @@ -77,7 +77,7 @@ my_gray2 = "#1a1a1a" # Lighter Background (Used for status bars, line numbe my_gray3 = "#323232" # Selection Background my_gray4 = "#7c7c7c" # Comments, Invisibles, Line Highlighting my_gray5 = "#aaaaaa" # Dark Foreground (Used for status bars) -my_gray6 = "#c0c0c0" # Light Foreground (Not often used) +my_gray6 = "#c4c4c4" # Light Foreground (Not often used) my_gray7 = "#e8e8e8" # Light Background (Not often used) my_white = "#F3F2CC" # Default Foreground, Caret, Delimiters, Operators my_white2 = "#F3F2CC" # Variables, XML Tags, Markup Link Text, Markup Lists, Diff Deleted From e9d0645f66c6254e82c2b50000eb5660c128f26b Mon Sep 17 00:00:00 2001 From: PORTALSURFER <41680373+PORTALSURFER@users.noreply.github.com> Date: Sun, 4 Dec 2022 03:06:40 +0100 Subject: [PATCH 192/491] Adjusted hex themes for new gutter diff colors (#4990) * added 2 themes * diff feature fixes adjusted the skin to better work with the new diff coloring features propagates to child skins like - hex_toxic * fine tuning so it all is a bit softer * fine tuning to be softer * added new version, lavender --- runtime/themes/hex_lavender.toml | 31 ++++++++++++++++++++++++++++++ runtime/themes/hex_steel.toml | 33 ++++++++++++++++++-------------- runtime/themes/hex_toxic.toml | 10 +++++----- 3 files changed, 55 insertions(+), 19 deletions(-) create mode 100644 runtime/themes/hex_lavender.toml diff --git a/runtime/themes/hex_lavender.toml b/runtime/themes/hex_lavender.toml new file mode 100644 index 000000000000..974c486ce06e --- /dev/null +++ b/runtime/themes/hex_lavender.toml @@ -0,0 +1,31 @@ +inherits = "hex_steel" + +[palette] +t1 = "#0e0e0d" +t2 = "#121311" +t3 = "#2b3444" # +t4 = "#61586f" +t5 = "#686e73" +t6 = "#878480" +t7 = "#897dca" +t8 = "#7b89a3" +t9 = "#bcb6ba" +t10 = "#9db2b8" +t11 = "#a0c7cf" + +highlight = "#ff2e5f" +highlight_two = "#0affa9" +highlight_three = "#29bbff" + +black = "#000000" + +selection = "#290019" + +comment = "#9aacfe" +comment_doc = "#0affa9" + +error = "#ff0900" +warning = "#ffbf00" +display = "#57ff89" +info = "#dad7d5" +# diff --git a/runtime/themes/hex_steel.toml b/runtime/themes/hex_steel.toml index 06e91d01374e..7a2183f8f8aa 100644 --- a/runtime/themes/hex_steel.toml +++ b/runtime/themes/hex_steel.toml @@ -1,5 +1,5 @@ -"comment" = { fg = "highlight_three" } -"comment.block.documentation" = { bg = "t4", modifiers = ["italic"] } +"comment" = { fg = "comment" } +"comment.block.documentation" = { bg = "comment_doc", modifiers = ["italic"] } "constant" = { fg = "t11" } "function" = { fg = "t10" } @@ -20,18 +20,19 @@ "variable" = { fg = "t4" } "label" = { fg = "t4" } -"diff.plus" = { fg = "t4" } -"diff.delta" = { fg = "t4" } -"diff.minus" = { fg = "t4" } +"diff.plus" = { fg = "diff_plus" } +"diff.delta" = { fg = "diff_delta" } +"diff.delta.moved" = { fg = "diff_delta_moved" } +"diff.minus" = { fg = "diff_minus" } "ui.cursor.insert" = { fg = "t2", bg = "highlight" } "ui.cursor.select" = { fg = "t2", bg = "highlight_two" } "ui.cursor" = { fg = "t1", bg = "highlight_three" } -"ui.cursor.match" = { fg = "highlight", bg = "t1", modifiers = ["bold"] } +"ui.cursor.match" = { fg = "highlight", bg = "selection", modifiers = ["bold"] } -"ui.linenr" = { fg = "t3", bg = "t1" } -"ui.linenr.selected" = { fg = "highlight_three", bg = "t1" } -"ui.gutter" = { bg = "t1" } +"ui.linenr" = { fg = "t3", bg = "t2" } +"ui.linenr.selected" = { fg = "highlight_three", bg = "t2" } +"ui.gutter" = { bg = "t2" } "ui.background" = { fg = "t4", bg = "t2" } "ui.background.separator" = { fg = "t3" } @@ -76,8 +77,8 @@ "markup.raw" = { fg = "t4" } [palette] -t1 = "#0f0b0b" -t2 = "#161010" +t1 = "#0e0e0d" +t2 = "#1d1e1b" t3 = "#5b5555" t4 = "#656869" t5 = "#727b7c" @@ -95,11 +96,15 @@ highlight_three = "#d4d987" selection = "#032d4a" black = "#000000" - -comment = "#396884" +comment = "#d4d987" comment_doc = "#234048" error = "#ff0900" warning = "#ffbf00" -display = "#57ff89" +display = "#42baff" info = "#dad7d5" + +diff_minus = "#ff0900" +diff_delta = "#0078bd" +diff_plus = "#87a800" +diff_delta_moved = "#0048bd" diff --git a/runtime/themes/hex_toxic.toml b/runtime/themes/hex_toxic.toml index 3cd878bef7ea..33bfa6e5fa2f 100644 --- a/runtime/themes/hex_toxic.toml +++ b/runtime/themes/hex_toxic.toml @@ -2,7 +2,7 @@ inherits = "hex_steel" [palette] t1 = "#101719" -t2 = "#152432" +t2 = "#1b2a32" t3 = "#4b5968" t4 = "#8792ab" t5 = "#6f91bc" @@ -13,15 +13,15 @@ t9 = "#b3ccd0" t10 = "#b0d4d8" t11 = "#ffbf52" -highlight = "#ff2e5f" +highlight = "#ff0a50" highlight_two = "#0affa9" -highlight_three = "#d7ff52" +highlight_three = "#f8ed8b" black = "#000000" -selection = "#290019" +selection = "#382e1e" -comment = "#396884" +comment = "#61bdd1" comment_doc = "#234048" error = "#ff0900" From c13c6d56b6eb0e117cb92ba4011155b519befde6 Mon Sep 17 00:00:00 2001 From: Michael Davis Date: Sat, 3 Dec 2022 20:07:17 -0600 Subject: [PATCH 193/491] Use logo for contrib icon (#4982) --- contrib/helix.png | Bin 1838 -> 15785 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/contrib/helix.png b/contrib/helix.png index bef00b98418a3fefcf56a5d45fafb1403e26e996..a9b699a4606926465926e8020eb5ce94cffb2ddb 100644 GIT binary patch literal 15785 zcmZ{L1yEd1@aEfH+}&M*6C^+g?hrhUa5P*h)xEOyd{eZY2 z*+{8M0YGgW=7R+?;y0a@;yYCU@O=RQ&=3H)Lp*}+0Kg|60N67JfH!FXKkkPj zcrgmDdHD!EhqV?pdf;@Q)GXxXxSswPNaMRrC_PkGWPR%!3H;#0NW**}*`x{;FMB(u z>~=aa@cMayrJ(U8eSYbV9T=d4pTghaJ8Nyem-35xXZY2oKZ%J`QPH-D1w)d98U7t@ zMCU*q#;BD}fV7%r$I)!NSExCk8jmL|W&jwHqp3iSu!FmWh*4<2>5z$jP&N6zp`ONi!tTKt&Pg&@eb2-7S!8}E8i5kg}f5aqt51<4pR{j!k`O&SPr~T-N z_Q#O5%h%fVql&TfzKxUo?m1u#lXo&~8k-k``k%tIkOH_0lws>0l4u5DhxbwH7EA#N+xHd)bKp*KOkJU%ji7RFg z!DO0m(!GiF;A6Q{{FBVgw5CQu`~8+ASzsw0AHIoptv`7V?GQu~P2(*Jiz;TOk&2_& zMykMQfLoAtRCeQ!vJq7obbk3+-G<+gY$DA7+;0cN8StI;HWTyM@HO_`{wDQOhKo!x z7(aE;)6u=n+o6R;!%fUf^09sh#)S{GHOx2PHBf72E_`PKj|q;$OXQkmWUEkPDdO?5 zTvvV6c^L77X54Qrf+dlpz~;PTXvR@B#yS#liYP>9K3mnh!b_42z+s^T4|=nWy6H>g zun%vgk(wYF|Efc>;$|!1}b*r+@}mi5DO_khBXp{WU!-0`3^EkFo#=)Ce3c2D5Amu zWdHdLrKPWv=CYwnDr>+JD~%-AqA6)1#FmCu@G$HR5 zE(^4vKvX1eLRp&t7K1*t6q9-J(O=)oT~%WUBV%r>k79N?U@C< z2nDC#;rNl?RN6FC{O!TAgY#T|9r*d$&dAh*6$RAm^Re*y{0s!QE670?$Wdm?(H)4R zhkHpL>0C&gLznaP)zf$n-MHU8cOiTNQ03zse2@EwaOJ$&Kl_naika#g@8u2wXvb6> z;6yqi+N_T(mLpb5<#C@|&-&~<9>dDM)qeLzDi=eN9!ny`f$Sd%PS<8=?^nc7a*0k{ z;4ZT7YYS-E$8aacn+m>?|D!4KUBlFzpDAzN+k6A3vjB8a!S1g7FXp6?@0U4P4GBQu zv2Rx#z}MeqFHPjiWzX~Iv4i*1Qho^?kZg6<5wCB%`j}9K3{JwoA9_a-IrHgoD!l>A zsS|5(4St7zDy_nbf5SK|r{!>Rh8*ClH6Bx1pWfstqB~ytfqn)OuvrTyhIjt!KrIB= zN@!0RPl3oUxFDg(K^JIXPuWYT>g_L;GHj8U+x;fq>*PvSlEUAtSOe8rkcH6sn|&Pz z282Kq)`@|6#pwo)dBS$)c8^B-t8?VxZWIz@FUtwR{;zwfP4RDw;OuJ@?Ux{7)fI*n z{qTMM2l$STJt^ZIgcN)ok{^Id_D;7{LB@J3R6uFgO(gw#SkNy~S_gCrOGFMp=0uJy zOyv$x6op!D^Q=&;yjn2~{oFTZTQN_o_=R4=P?X!AGAd=SVP0Qrn)W@*H%_E2MV;&* zmI16dPGQE`|EZ&=k&{@l^A#PFdEb>iYepTTlgI&| z&S@p0%Ezf>&fxc?UvZfNsIY#4kED8{puvqU++E5BAJmL~UktVL2bv#c9HxyWZWFqYX_i^=C3VFEwFR(6&Cm|D<NP7T4o_Y7n0Wp0JG1%ZaP*2wM_OjH8+Vp{SYvQ7gPjff5}d zJKgYm3LGcvq?GWH$hAFu0pv%)93$OP&2!#8sgl*qX@5W0Cs6IQUY2T)kCo#KeDQ|; zBxt52-M@~Q>u)Ad1`VQs7+&-)0<8s&C5lR*TqNg#8nn$|Owu@HMl5P?EdCNvsoEyy z@&G&1bF;;_c&sn1fjjW_YRB~mY*llf%*&Du*ko%uE-8xxcgD@-FqFJ>%|Y|}lV#{G z%(HOr85E+DT^s458X#(azm(#$-)O~Wq1?>E7NQ=sgu~hW+d*Xq$?|iEpw*pyFGe%< ziO6i=b0gCAU?4^_Ni$_W%_kwLs(72fQ&B5#j`VKJLEYU5vro5QiqN#iA1ec zw&upVK3adlj+~42Bvi%)BtJUykENZk6Yh?$}ca zJn0mUHf1Q?=iQCoeE0BYRlejBi2%eZ&z;jq0g@&T!aEgH>lJ`Kh>C4*?c;z~EX?!S zucP91h>@7%EdCY*I?3`~_c?vT86s>u@;!}6$l>fpsKD{BSS-fo{KyhnyGUDB;&kl%KWdQm{ ze_`q}c61pUUZGx?uQ;xN*V;kE$eC`7p3Z{Z4*AmZ7)k1HsI*q;F&MsTmgh>QMeG}l zB??(uaR6@1es=trByp=H)4Ab)!LV(Rqs%XLw^g{b`DcW`4_|HWE&p8cQGD!WwfGzv z-UiZ2Pgx7u>NI>{cQ#65>Vg7yrSeynp^O7bLcISvBymc;S|JAeo|c3eU!YwVFihv&{!*n`26i%cpWMJ@o_4pyWt%!NTlFHn{wo=YuzI|R8` zitu7>cR3x%*ch4n5>+DlcJ9NF@20nP43g@mLPYt?*O;l=Nn_(*W<^+4cX^ZFFB!p- zGAxg|#wT+JwO9H_Ml%TV!anp`xWjeJlRWA3G!0o(!L(TMYMZS z5=`qf)a{>Fo9a+s6MOT-(jcPBdyD=b6wx}`y*gA3jBc$9W+f%Z9vtR$0&O8*aW9$u zZOOlWeZTt5A2^Ur)t-VTiThz{VgL^*sz}&{RdwFVZ3(`6@uTVo7v=(Ge8EQATRsI{ z^WnDltDRz<8k6U+?#(X)E_j-CsAKX0zC95Kjx(|B@86LayR;8A!>FFWL?N%o1+ks8 ziZ#AWF2T;fnCTc=3$&qteU|-Z{_&JbBiS3EHXlZgOFXTZ$0My72Hg0!OYo+LUhNg5 z70D-S-mP|g3rl5kdwRNc33-;Bb&_db6H`JPD^GjlL%hixW(=&w4#>;=LeXmMy?u(u zLQI3QuLt?pqf3!{Cku`f+R`UBR*v;n84kRN<&TlMeR6}*cI6-`B2i7kvaFDi7Y|e# zBn|#9$_`n}e^}hLnVD&Kg1;*oKMHW6@)v9^g$Mdw+ILBQdAQ69mx#O1fjMI@Op#Mc z&y;!F{@(pWE>75!S(m71!iPGW_lL$Y^pD-SmA|9!wrh^*Uf+p4&M#6C@|Q)dxQbrd zETy%Ft6IWl!V8qbCrn-GJL;|a^G&c`+e;c$Q73vt6YuXf1{AG1Eym^=jlTr@Vc(#* zDwaIpBa6}t6!iApeo0~oK22DPeia|e4E%7QNW6xYve}s z9)7d+4HZqR$fc24D^bu=z3UJ+3;b>F;RBa-OZs)|>*f92x%=}F!CFu=ax<|7BZe-L zI%F%FhN8jAv406Z?R{X?bem~JH67Kv&bx@ z0;rlk3(igGcM3-qz#ACuh>b^+OyIHFv)7C-tCn|67L@Ym%0B@@lhcqiS_A*M(A3wB+0r5qwxDBoCx zTZ&YgL?h1Uhuq<9L5M~}w;ZWE7Ho$fdx zSLYWuK_{f~`NXPjF#gPCr?E4JBR;HJ167W-bgWX!P-=(Aa|t^=jj2nqs!y3KGT z_Qj4KyLS#j*heO3XLu?s$G~WA_Qxw8^u{gQCkN_Vff(CS&s&pn$>mpA9G}nC4K}Ou z&w~4*t#8H7awM(HZ?A9%)|DIMdk!MVEB3?mJtfbh&0~6 zBj@1!a;7EE=y)m#mOvc8RFYaRU8qy_2gP`u^2(dxU^vY9>fcSIm8e+tCBe>PO85twF1Y)@#!XY>d2B06~sgiqzYC47{w z-zgTg5@N5XGrWOp_=8?!OQ8*jSfGFpCAH)Jm}uWT-ckmt!RGjJxAk^9gMO#wbtl&r z7FTeskQaEDN+fN-go@&S8vhy=w>Cy>bso`sGfpR5EOPe| zHsRkm>r695tCEW+U)^5zn`jy>@P4Iij6tj%?ACI8^@{Dk`X^%<47g7x4)|Gq`$Hl|{0C7!+$9tW@vn zIOYwDMII!VJN0T@(vRvtZ9H|Tr#s_wJ?LU-qgvb6+)t zn6*^SBtgxgX~_z~*9xM|6vrWL)@L%(tk>cAl?p>UZFx%v17I z#iK%@G~!e-%#;hzYkxp_VSRNttOXmiTO0O>E7@^bEU?sjO735bDff)QXxe6uyjYCY z*pqsWCWJOR-d(=(tpt9V7)4=fOA+H*1flUmpK)0u<~qm{P@j-EZT(!g%ezJ&X4i&% z(B#BSS*(pSTsmLfoT_b0(D`Nqzx;ouTy)WdW|P!L`ksm7b0c+tsfZfn30`ywyiT-*cy$+BS!l;Qz#%Om6;{7>9q_{zB4cr2FN$6@In{ zrkE*EHtp1>1p_KT_-s0pe;9rt^~WdeHh%G4X@WOg!hBldTqc`*v_-i;=Ta7$m{cAt zHBwBBz#dHhPJ+#liovwu-8)}XUU%|sib9*6XFef|83J1!EyOx1ohXzJRN>b=xIf1 z_}_@=iJE<0e+_VF7|N8cpjU5U@`+@Rx5CKb+dB;Sg7>|*?S2=_0lS)D*U60OQ&CzS zD*(12*q3S=9b_0H}nAix7AuXVCYS+d^ zQ0#veFB{J45!n*u(m%M{{nK({QSlAG$iN~LhB_&ro{rVFEg3!PU6t)+P4U1q>cTH( zX@TIciK7Z~;?NKOV$?(bvDGn_G7Nyrp$@eVG%|_il5qVV1hGtYLVL3tLkOe^G=vrZ z&`6nf>aUkTmpNaS9*DK{ccb>Zw_f60RwW6Xk7xo)`2r6GwdsjOC4Sg|^uAK3){ zEm!p5x=0i30dIPWzFh2INL>A+G~UiaWJ=H=xcL4`GTbC_t*#bbC9~>$Dfp$fZrAgP zt+^+EdhgI2pIQz}p$s{3Dk#o$1`mf8sIJr}K3Ec<#xOhFu8+6)!L9F4k4L)YSnvs& z6&mT0XpkP+t5DY6mR2oH_gcfUWk$aC1?Kf$t+%fI6w*Lu3$Y!(C*Z-|p=~hXrH>Lx zF{0b)i437=@!VRj+*?X#o__hU1o>adR6L5bt>lfsFr=BWN9hOA`=S{4%XcnnCSwLE_k9I__ zv{VhJEl&6Mc2i+5uhI?MaL5ZZGo)}#q7sYmso+zwe5hgnV0oKQBdo!C8X7&I&}V(g z+{WMPhWR|@ezz&K_J*6~&m%Wo z3Jsh?Bza5n5mxlEMR7dgnwk{|L?K}~v#B6?D>%VuxwCwOTc-Y6*!~{S_qD^miOVMu zio=vI3YjV{?oIY4Nn*(kNZWq;p*Ws$&*g{`fV1#EVHztESyYExM6?CF!~b@u zLPuNMI|QQuL-Flc-1=~sI=x-XTxIV&01L0%f{EC_asuK7na<$3PP*hXw3G&O91hPP zzjdw*fcm9%6=T?r(qUH@63fI%d9W+}n;Z-;0)QL&x5&PqEA;?TFsH^vfK=VoHw~Q% zjQXher!QOl1a7mSnks@29%GKM9Ly|SDuM?8_H=y=X!G;#VQcqGkWk(NcNle9kd#lE zIyna_sRDX$OsYgoEwY}qIg!p?xGROT$6YOx$bAB0R(3Y~XpG#1@1rUk9HM!XaGZ*dKALWdC-(tEp7g!;PEk2x(%$hpv6#szKUJ4W9}!ul=UzK4gJv zn!8NSnf{0u@5!CcYR^X4V}qP7HSW={gTS$`XVDjMS_V;;qWbF(9QS0N>rgsGTD%P@ zmR^^jl<##vNMd(ny~iS5y?abX@bukJ2$|+VP#{1Oeik2zWI9|l^te&FW}q%K>XQ~7 zh<9s_+fSzb=~ahHzkmr>Z2drpAOhl_o)A?D512@bfrAK0RwA!S1~LpEvIlrNJ&Ye5tLKt$H@2Lf#s*g#w{hyQ5LY=rHy=aW^vu6RA}m1=rNrpsxrDWuLDyi?L! zbgY(_x~!n98DS?cQ~k8Y@Bz1m;G%`)V9F*|DEM@et5*C?cvLKFtcd+k7KJoX@L1M} zvfT@R&ahoLDc$#8Z8Vu8wkk}vD$jv*a24Snu+C#*_(mLmFdmE=JB5~7iz?Gk`9t-K z3%?qReZeRCqVx+N_%uCR_uLox6&=b3Vrm4CKiU*tK^e0SKOjKX>FeS7e1S*-puoSf zspmnYHBKDS#z^%l_=#`K5quYAnInddX#?+X6=kHn&)(T7d?xq?C1tkXzf7PSKjo~= ztQZNpk+&|pqZQC|3AtmuCKs|=CCYnEflfq@QND-SQp8lu!B+fXAPi;2)I9(ATox}c z9~-oKMh}V4|2uFyIXN7^VAa;LSRz4>ZCBJrr?8%LL#UKd*};hMN%yCNd03vA&neZv z#xMV6@^tjALukR*hoCX zA%}0$GI51CQDlvUp3KCQ2O=H#Cfzviz_zZ1#b()-dqz*4DrHFgR6gfUI+9OfrS9)v ziObZ0dpAdRrXS|fLGSWiDR`)-qxpRqqjCeoPkP>|Q=F4@oELg~mLTSX5HHU>+2nT$ z_3xA{N>#rwn~fWm<-ujFg*hRUnfJtMfgTXM#I;yn8OGXAr&$>(|NQ8+Mb*jT233sH zorgdj{w@|Q8i(@>{61Qdyl!F;MWhudo-yP6U6!?xmZFyFvSG0(LG!y6ZJjDe`-sdQ zgwl1ZkTQPE>Qaw4LNkP>tonW_ z@)toDvTl0)F?ziRLC-gLV2L1gk&QH(6#eRWlF^)>vO`4iv>6z~SHTlh@bAulleh#uyNQf_?e`+ZZ~bG{dS z=N=f2i+)HoYjGQ8kG=#_O>F;0m->N8w*!+l?wxQ|;m6QW-JHHp`XD)JjIxQkX@# z;Yl=ewYb*y^+D+J+cgj{3-7yatxtiEPg%8B^+Uu_sGm_->-U3U`VJli80|KI$1*xv>u2iZ5_RgkN~frRbi4KG6JBneL#d$(H}W#$Td?LEiBFi#E$i=+k3TuUgnmDCPD}Q z(Yl}FOq4%_{e}3n;kZe`4w>H#mnD}MePkE^5YF{Fn+p$Lw$9!*1@Pg$%AO@>F3sqj4adG}^o;=sTX7&JVVuKh>9n1$)UhoNLaz0$0 za=Ny&bI8sdcKa2*G8@(l^iY{-BxbH9f~NdxYbcwDbe(xJHA}63wc+@eJAim_gHuLO zh}TjEVja`9l*{rX;y3({X1h|f5BAc+!cX&nKfl-Zu@K<`Oh>w$QY*&?W5WcQPJ1R> zhqI6Lyc|l(it04-uAu`K(E5=K(Z8n#?gGTv;h(78S%FmAKzJ_agCN03#>t!s@?Gkk zfx}OQMakbya!|j#_n3W~cTL4Bx^Di=mNd zs=JrQuAk~|=HGIPL4(;vGcZWX7mmqwBV5l!+68IZVI+SHIx&(2P_UL~2FFxYliv3r zzzXe4P?YwiC*z0Kf>N@#o<~~?a=8eKc?SQ_yjrq*?(#6cwKVs{pQ7jo=?ybNE2Npf zRCRXhGX??=)ItVy*-cmh?GgCZ0`D}paYr`>#%Aiz)Jj>)Y8lXF2&R-S zBqaz6s}GDnIG|;%?ZCF_)Q$=#(68jY{4LOtFx1SD(N3zDT3@kDJ+@dsuPsS*H$hx# zxD3w|%1|P9tUH;HMYe}J5VxzxzcA#Wt2O3%IfQsYYrCKyHLX<~LnRBC#%^x~7>D5e?Yat@u?+O7h0qgz+uJB(XTan8BUe`HecN0wI`H5niNA zmW)?T8x`A)V@QG9&0oNl$z;)~+==TLQ7)s|3r1s4u>xTLpY%CnwPdsp+X;iA;Y zV+ym{eYzz(%e`0Xm;WESD*gJ);Eq9$5Pq|2Tz0QlpMIm2oP~jPss;GGl?iwK5NV3U z66n6hk#y;F3ZoHj?s@f5w!qz@Qe2zPOaD`B42(^?d~xNLI$7}?%uiGMmt6xC=NWs^ zo%!H&$HB4Rs?jrJiUwBk2($Vx->_-JP^YBHgF&yNM&Q#DL-TpW^kIQAsW?O<|JP$+ zr^)YC1Cfk_B)?JxuZuaO5f9ulrw{KDOcVYUzyaHj%?MoM|MNQ_T0Vn~KA5yP{o!#P zfrRw_uDi@X`&w{7Mz}78EtK1lClgeC?sY=Xp_)$qxl^w@kGb`VMO=+YBox;W<^?Z0 z=7taF;{9&&G{bU=Wn0cfxb^n0rtbHn-kz8}9AY`kBpNvcjY6}9Fgv(x-ttpGX9cf$ zZx~9LV?e!%Q2uXG)CFiAmIW!736&%FN;hpx)Lf&fYIRGD#1-_T#s~gVI@Z!}c#p50 zotFk+fpfGPFpp8b_fZ`GxLnW*IzpOH-<-H7WljvfsdYA`XHERPl9c^=yc{VnSxKE; zq&^dmx7maK4rH??8f0bo&kNOggzuvXVirIYwru|g)!!=N%tCOdt&Jf?9h%+6*z`Mmmfs$(CN%SkvT$t;O`GDg(8TW#=rWj^}F#H_Fq!QwYQX4 z$j6Z}r!E&+%+ROhoUFTzc9WZ~u_s@~4^QWF(L)O!k%TeRFsP^-{N1F8K9cuP_KeKD zstYPUYyXod|6gouNJAQIubf)7xvn7VBL!4A6l4{#U!1KE6_dmG(2kPwt+-g&wrIq;nMEk2U5yDHb%3S{H$0+M3_UM zKyCff6VgJ8Qr5f*vQ)=^9?Z3*(4th)NP&J;jK)32Eq=6RlzzN_T`Y?+tVHj^DrMfz zzAnqU8@^a7E?)elwxTvh`L1{)wCy*3G?|)j&zlt0nPa5p5F9)QQ1jFHfa2%KvVymv z;lIG##n_Yn=q|;_M-)42580^JXzgk-=OV-9aDq@XjI*!;GECUZ1%VIV6OEUwmRtY= z>8}{e4NFz^9-goai8_7DSC3R>9QjVID=)rSgiyW)ZiO+;u)vZcA0?%Y{%_btT}2Q> zBzOh`zBVgBrl}!Hd`sfWe6;X#)dVlpF=Ak!ad^g9M@{RenImEez52&T#x!=pp4%n| zf!Fv+e^vF)Ll7iHn|H$MUtb{IAe}g@tdt(Ie~`__Y|k4X98T&E#}9)qLNdg zl*9pyH6|cJii~@kpU0)|3v1dDeLAP#vPy-b4(~R@609}nwJTmF-#bzmj3P{L$U2gH z^q7_Y1g%DLHBfG-F$*XZp)feTy+%}0JBDxa8t5M}va_vdf9-pI87@ulG{aLCWD_SA zj{W6|tzWeR(ghL6Sa{*e-;LgAjx2eX!gHDsgRm+}%UL{G6M ze{5JhuT=^>L0-=)XXZkL63(Uzhe>G{CBp|I-G-jvt@z3y+f|J$vl-(=!`c*_m zTFe{4B=VRGo*b7h0d>DDJ);Z}P>s-z@+=cwNq%)6-v&gcw)WJ@x5yXwn{mX)U-lM} zH$ZHR%fo-+mw6=+OwA`wX>k|77vgp3Z-?~*7NDh0oa~lAQOBg2Pf2PZ(nLW?7XJo6 z=7=59O~q9)O+QgQ<|tz5UHXW~J8Qfye$_C4>9tV*B?8w8k+&^i7{wgK`==ER>7%gN zhGYHr-p=!WWm>lktu3c^z=e>+6Sywg$yasRRGs845SYpqjpGH=Y>3+x;LB*JnEvVc zb=~pkw!|ywVengxh|BZF&e!tEWY+jLL}r_UV{0FN5MzL zgAujH59{k`0e$G zy~)JYe>Lnxqz&*m4Yj^OYes2PSazB9^ zj1!hD)P$NqEFO|(9a(4O{xZ#A3fZ@>-6!`o=ckK$&&Zq*bdjr7TUFd#idq5s4fSxh z#`jaKlsxNd>s5Gr2aw-( zs~u&GozE%10ON6yl!8bsFTKd@-U)RgNkGp7UEj4X9sE)dqPN%NMT=zkg02F7A|xZY z?CXyvg;8p@QzuXZ>@+W0gRM(0s8m&v=-x~L%B}PinCfR6dFQOs<|ne#d3l+dagJlA@0g|!l7w^MRoW+aVjG2DmpQ!7qTN> z2Y-Z1JNV3y1x-yX4(T=hnRLM=q@BS?7qyo%o?W2}sdwWiTq3;uLcnhd>WG>V(If;r zj^J*;WEuEK4vIh>qh>u};!#R=*Y<&j8$INk?Tq)~);w%Tang!_b(ph64Bzd(T5jHhn>@z4 zZZT%oVB~=Ca6LqMAUCfx2rf}c2t6VEcZzqZtpW;UWJkBQqLgvHKPhU`W+9vkKRcFB zK!1*w>Jn8tvVwB0&#qgpB042>qiMVJa{Pj&1%bbK-WscHZZutT&D_ehemowGk5G<1 zf#)EWGi^I1zb0+VTRGBN)c*SHU(sA1(Pn9*X-4Y_nF?_jQ z#jDoeb+?{7d>W`wMQ&K&7Y}g9_$me+U3Y=MN_q);=8&e*oUqm84uBHV3P)R8g_)o1 zrjmnp_Gx^vM=A9&4kG9J8MgVsR@kmJy0T8nUlgUG5F5<@;ydUi8W(S)#dsTGVWZP? zxGM{k-9`*i?*SmH-(KMxp#MS=SL6G%d$@z^m!EeB=eENt6f9;$oThN2fVRRMir|SE z(lIs~p_p4ValKqE1Qz73TeP`hbzM*rs06F%3)dGs*a-Ua0}1`QUqV+is?-6Z?<+!Z zAZS!xnATg`p9stUxg$r(T|InxZTSmv?hOw|KlT8_w}r)8)Df=c8guR{UZw8LXe4<# zCs_pqb?o1U^h-LO)fHEIsb`D%&yg0gN4HY4YW^TWYa=`qopjD2o8*%Ei5*kh+F825zmm`=G=s^US z`FRu4(-jD>h|B8bj~jYEJe3|sqk-C*J>RQILz@uUGgx)`-cL9qLqB^YQW)me6=iN8m~nxadBs!xHD;GS|S{(OC4b|ME||$F*0RXk_(O<&4%04 z_2+HEz`zPBk*tVv!2)*gAYy%FQHURjo*7SA?+B+o0SJmH^fJCX3T7affj9gUxu0^= zoY%eh;S0(AY>v4}u3S1Evhz`ghG>Jzc>gSCTDkno*!<)zn>io58R&^qF^?6+;%xH% zxG(kO#dWr5v`D|MMWw}T8avW##?=FD`8;hi%`_Tw{@_j}4P1WZLsD);jgqD|5+Q41 zCxSeHSZsz^pt<(NyZJpxnOUli8Lxea%@ONw;2@bx7jY`}oK1VnO;tmmW z=DbwdEfTpm=^IAZ@jJ@L{zim{4Mla0(Nu#Jugibx^So{=!LtFO=t$rRea!Wa{mHjSd2Vc@PhJlj^)^_hE43#916>L@56VvIM(pEc zLCr&(K&_iB$yvYkXf%=f7s2688B~x7eU*B`hiaIiNvI?iOvd+}fIBUh=|Z+|d_81yU7n7jvEKz*=LoeUnlQK%aelxB!4luD$K5~HQa9srm4eMW&w4a7bAbinj!0sJOpY7`G{e=c+HBQx3*RbrI>1H*VilUv z)g(7u_Y!6S$QRbYpZ+EvD|PExB}RkW+Esmy4G83f;>9Q7s)HN7A7a0hcK`&VltjFZ zqF)I*n*TE*l=m*K`_^P3SR#MDB8w-hRe}#o6GX{+5>l3fn-${#Cm2aF>Qm!HUU_g( z>sBu6O5>~nZU$Q0+DwyqiYGJLW3AV}xKHPPStFN|t;4u3-IFyZIk_%9+_yt02b{%R zmKsXtAeXuIiMlADsH^%_|G36CwP?0dA?_#J+oO=0ab9^Nr;Z#D?J)Lr487OWK;`!D zfH6uud#M4+uhm02^XAf|$nLMlqT~&;=!Yw#ygfHPCCgFBXZlD}Av;a5f3QtSEktE= z_6!Cv_O6Bzip`9c3f6+AE}zx?&C>y3xiNDaAvmtn&Fp^o#``*)C#9k8uHpj+$bM{Hl2>5HQp zxrFZf#udFPL0MWPq8)&qBWcrZQ`C#$8l(9k-w=+<-IPtb+G6Bdgw6=Mssg%duR}Ji z6wLANY$@XBe&pWK?`*^5+RjZiy649jk${!%TPwwgE@q5G$gP+wiF2MD`e108U=jT5 zh<$;e&?;ac=={1VmNvSK*=R8Tq(IIFAaqmc`B~}|4H2uOaz8zo{1&Z{N6!#c7L6iC z=#7&gQ938dwDKuXbaGPcjB!WD&qs&L=Qks?xjjf6QCPYQuU$0n_DI@KjibfCRQT)c z8;x4?lGGT%k#A)~%gnj*T68C#(7fezP(#a5E(-+t^Anr>56pFA%cU`c+{_%rPB4ud zR=r@@n)CV<7mA2ukwN9^47n(7)-3eh5=k|JJdp`Z+6Q(O4>M>-qHaiJGCM_p;HFTA zC$V$IEEhZn5h@G%{y-d{)%GVytfC3ta#!>xk&;%QWZ%@xOc|5oq~(vMn+aw8rVx$f zEg#R;9N8lgpG1Akj1DFAeP!l%fz65htq)gw=cTi|H@mAg%VYX`Tsr!EvY+k?cqwt^ z;3Rkv<{{W12otjkWEwZu&#Ht(m#&Eby_UCIe}$n=beKA~qE&x-8xb~&@WhHcmlafceG&fhh5GS$ zV}T(QPo$%a&6u``ldn|__|T9L65VLZh=#e0cT`~9?|XW%b0~!&hN>??1i-{}&@+7c zr3SJ5ZapvxBhg}5o7UAZxsgp{=K4nw3CEC-rqz!1FCVvW*rRP&k0Ef%{Ov&6REZig zp>*~ugm&>K+zUSAt^onR&}4}v1|gy@=q2lQ=z*y3Bi!Vj5TiqPGM~L+{|L3jX9AwS zx#A2n!;2C2%la(wW+978v9vx1aRiy!Lr&l0y@iMM8>^4jhzr2S!^g+P%g4pTug&}F z&8t^$`1lcV*&807m>jD=|CfLhqU!R4&;MWGp=Ta(;u&E5KRtNZIa#}VSU9=0ff85vgq}f`VA4A9@001~furR&K zN7A9gVf;upy3r2+U{U}cZ%e@AQFp>aeFK7g0N`wHTrS3fZhWf8bM%Uts{A+9*PQZ; zE~1hVW2zG6xZfqOM`*SD5H8kLRME&H2X=L3_f#dOH`E@lC8PGhuS-nolDraEQ@t_u z`;vOl)j>`uB4i zcN4NaF8H1AR2Cc3rZ=YPr&j6(CvF*qB}w`e>^+ShqY8^*!`%ZmzY%t7HyB$e`S zC|s_#ewZxrtq;RVto4+CgsT;kHaKZ}A2zX_$m`k&so``->!?TwwtAdeyd@1^hh!Gd z#Ud|R&p}yO0q2-0&ldtZWz_M>>p$R2Q!tI%sp5J;w{<|kCMD=YEwfUExz)**iL*Zm zpM_uo2N~Dd=r~|x%yAQjMnf+n^4r(Hudjb(a51AR8-g)e;Z+OtTxZ z_;8;aL?3TdQ~=Q*WlpfNb-sUG3ILA42&N_u(UadwUfq=^NT+xfiNC->O@hP7A1vI4 z1IdO_xvLuMOs;xvZkVz`l-SXTJoML;cXbjsMIGj+)0SHX)?dp(X7IZMTMkyiPT+yj zLEH>IyO2Nr-}3CX?#d>PjWlXfl6)0M{dvLD#vTgSU;6CU)2TVDK%#!r=h-MKIf_5G zD<2kIXx+~O`dC;{QC)FRaj*)7e~v3(On7q|ODq<)Jt89u!jP7-S6VgB|G;}k=joQd zsuY4WALI6Ns&HI+Dp(k9eB-LPH_R4F}&$b0%{=JeCHW7G^e2-_t#z8+IlOBEhPICUYs zuJB4!cv8&$5TV0o3-yxCA)tT{lIiv5Zv3S08qCBAXjmDV9rD{jYIddfyWj6eXnA*p znvq-|tyWghClcsYvy-)7dNTsFB)$Hq!e)FA(q^x^A1NN-#yH=vn4g$++Q~fa+wny8 zPH^w%DTLOY_Rt!Gzxt#=(azgHJ8sTyaA=(cgL=c>JL7E#6aca1u1>>(97#nrp3AQ9 zr1@oXp!LsR&YnY3lXOR5#f-rLc zY79Wp;1<2lb@OaVO(wD=WZzpMAIpG~0KQdHiiAIOO&&IWn&pzI;V60R zEHthOId<-^l{KT&-pb_F48*h1CrGNIy=ze}V0fVUv=sW+S!}qARY{3d-Gut6b@gs` z{oU|e^@a~SlrRJ1_I|E`<4EDM$4T8&ftGSEp^TRe!xM9?VvFS>*O^Kxx<;H4nLV;fue-%O2prY(QXmq|3V>56$A zPlS-YwM}%C0TFFv&16*)l>H`FgwJ^Vl~@=P)9fO0F6T?z-?MGgnf2NY!{yi6zfz5N2gUuSP!qeFbaqsHlcPZ=vtvNMz{H2bwR#F=9jdqavm# zjywH8S>mU*_JUED+k|<)W(L$TK9HOV6YWQfjrfmJ7U|NS%Z&tne~ Xz Date: Sun, 4 Dec 2022 16:45:31 +0100 Subject: [PATCH 194/491] Add support for single-line comments to scss (#5003) --- runtime/queries/scss/highlights.scm | 2 +- runtime/queries/scss/injections.scm | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/runtime/queries/scss/highlights.scm b/runtime/queries/scss/highlights.scm index 89cce49442c2..8ba00a881c33 100644 --- a/runtime/queries/scss/highlights.scm +++ b/runtime/queries/scss/highlights.scm @@ -1,4 +1,4 @@ -(comment) @comment +[(comment) (single_line_comment)] @comment "~" @operator ">" @operator diff --git a/runtime/queries/scss/injections.scm b/runtime/queries/scss/injections.scm index 321c90add371..350ea9e78a76 100644 --- a/runtime/queries/scss/injections.scm +++ b/runtime/queries/scss/injections.scm @@ -1,2 +1,2 @@ -((comment) @injection.content +([(comment) (single_line_comment)] @injection.content (#set! injection.language "comment")) From 417676953bce6a4be91f4b8da35ed0e361b585ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bla=C5=BE=20Hrastnik?= Date: Mon, 5 Dec 2022 14:40:41 +0900 Subject: [PATCH 195/491] Add basic support for common lisp --- languages.toml | 15 +++++++++++++-- runtime/queries/common-lisp/highlights.scm | 1 + runtime/queries/common-lisp/injections.scm | 1 + 3 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 runtime/queries/common-lisp/highlights.scm create mode 100644 runtime/queries/common-lisp/injections.scm diff --git a/languages.toml b/languages.toml index d214a082fcc3..325a39dfc4c6 100644 --- a/languages.toml +++ b/languages.toml @@ -878,14 +878,25 @@ source = { git = "https://github.com/ganezdragon/tree-sitter-perl", rev = "0ac2c [[language]] name = "racket" -scope = "source.rkt" +scope = "source.racket" roots = [] -file-types = ["rkt"] +file-types = ["rkt", "rktd", "rktl", "scrbl"] shebangs = ["racket"] comment-token = ";" language-server = { command = "racket", args = ["-l", "racket-langserver"] } grammar = "scheme" +[[language]] +name = "common-lisp" +scope = "source.lisp" +roots = [] +file-types = ["lisp", "asd", "cl", "l", "lsp", "ny"," podsl", "sexp"] +shebangs = ["lisp", "sbcl", "ccl", "clisp", "ecl"] +comment-token = ";" +indent = { tab-width = 2, unit = " " } +language-server = { command = "cl-lsp", args = [ "stdio" ] } +grammar = "scheme" + [[language]] name = "comment" scope = "scope.comment" diff --git a/runtime/queries/common-lisp/highlights.scm b/runtime/queries/common-lisp/highlights.scm new file mode 100644 index 000000000000..e11eb7881081 --- /dev/null +++ b/runtime/queries/common-lisp/highlights.scm @@ -0,0 +1 @@ +; inherits: scheme diff --git a/runtime/queries/common-lisp/injections.scm b/runtime/queries/common-lisp/injections.scm new file mode 100644 index 000000000000..e11eb7881081 --- /dev/null +++ b/runtime/queries/common-lisp/injections.scm @@ -0,0 +1 @@ +; inherits: scheme From 03ca18b377c1dfd78e8ff6bfac6d418de237923b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bla=C5=BE=20Hrastnik?= Date: Mon, 5 Dec 2022 15:02:13 +0900 Subject: [PATCH 196/491] Update language support docs --- book/src/generated/lang-support.md | 1 + 1 file changed, 1 insertion(+) diff --git a/book/src/generated/lang-support.md b/book/src/generated/lang-support.md index b1fde0016abb..ccfd18c00fca 100644 --- a/book/src/generated/lang-support.md +++ b/book/src/generated/lang-support.md @@ -12,6 +12,7 @@ | clojure | ✓ | | | `clojure-lsp` | | cmake | ✓ | ✓ | ✓ | `cmake-language-server` | | comment | ✓ | | | | +| common-lisp | ✓ | | | `cl-lsp` | | cpon | ✓ | | ✓ | | | cpp | ✓ | ✓ | ✓ | `clangd` | | css | ✓ | | | `vscode-css-language-server` | From 1e31bc3f77040d4a3663b8b6bf72d8d3a632b88a Mon Sep 17 00:00:00 2001 From: Pascal Kuthe Date: Mon, 5 Dec 2022 14:18:42 +0100 Subject: [PATCH 197/491] Reduce log message about diff timeout from warn to info (#5012) --- helix-vcs/src/diff/worker.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helix-vcs/src/diff/worker.rs b/helix-vcs/src/diff/worker.rs index b8659c9b3bc2..f4bb4dbfb07c 100644 --- a/helix-vcs/src/diff/worker.rs +++ b/helix-vcs/src/diff/worker.rs @@ -185,7 +185,7 @@ impl<'a> EventAccumulator { } // Diff failed to complete in time log the event // and wait until the diff occurs to trigger an async redraw - log::warn!("Diff computation timed out, update of diffs might appear delayed"); + log::info!("Diff computation timed out, update of diffs might appear delayed"); diff_finished_notify.notified().await; redraw_notify.notify_one(); }); From b0f20f13e3a606cba35cc70144f045a22b5b38bc Mon Sep 17 00:00:00 2001 From: Pascal Kuthe Date: Mon, 5 Dec 2022 14:46:59 +0100 Subject: [PATCH 198/491] fix git diff when core.autocrlf is enabled (#4995) --- helix-vcs/src/git.rs | 37 +++++++++++++++++++++++++++++++------ 1 file changed, 31 insertions(+), 6 deletions(-) diff --git a/helix-vcs/src/git.rs b/helix-vcs/src/git.rs index 82b2b5587fc4..432159b6cdb8 100644 --- a/helix-vcs/src/git.rs +++ b/helix-vcs/src/git.rs @@ -17,14 +17,17 @@ impl Git { // custom open options let mut git_open_opts_map = git::sec::trust::Mapping::::default(); - // don't use the global git configs (not needed) + // On windows various configuration options are bundled as part of the installations + // This path depends on the install location of git and therefore requires some overhead to lookup + // This is basically only used on windows and has some overhead hence it's disabled on other platforms. + // `gitoxide` doesn't use this as default let config = git::permissions::Config { - system: false, - git: false, - user: false, + system: true, + git: true, + user: true, env: true, includes: true, - git_binary: false, + git_binary: cfg!(windows), }; // change options for config permissions without touching anything else git_open_opts_map.reduced = git_open_opts_map.reduced.permissions(git::Permissions { @@ -61,7 +64,29 @@ impl DiffProvider for Git { let file_oid = find_file_in_commit(&repo, &head, file)?; let file_object = repo.find_object(file_oid).ok()?; - Some(file_object.detach().data) + let mut data = file_object.detach().data; + // convert LF to CRLF if configured to avoid showing every line as changed + if repo + .config_snapshot() + .boolean("core.autocrlf") + .unwrap_or(false) + { + let mut normalized_file = Vec::with_capacity(data.len()); + let mut at_cr = false; + for &byte in &data { + if byte == b'\n' { + // if this is a LF instead of a CRLF (last byte was not a CR) + // insert a new CR to generate a CRLF + if !at_cr { + normalized_file.push(b'\r'); + } + } + at_cr = byte == b'\r'; + normalized_file.push(byte) + } + data = normalized_file + } + Some(data) } } From f712d316e5d210e95f9d297651f1d753646c26d2 Mon Sep 17 00:00:00 2001 From: two-six Date: Mon, 5 Dec 2022 14:48:20 +0100 Subject: [PATCH 199/491] Update Acme and Nord Light for git gutters (#4999) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Update acme.toml * Update nord_light.toml * Update runtime/themes/nord_light.toml Co-authored-by: Blaž Hrastnik * Update acme.toml Co-authored-by: Blaž Hrastnik --- runtime/themes/acme.toml | 3 +++ runtime/themes/nord_light.toml | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/runtime/themes/acme.toml b/runtime/themes/acme.toml index d3be695cb944..696a4a9b2633 100644 --- a/runtime/themes/acme.toml +++ b/runtime/themes/acme.toml @@ -22,6 +22,9 @@ "diagnostic.hint" = {bg="white", modifiers=["bold"]} "ui.bufferline" = { fg = "indent", bg = "acme_bar_bg" } "ui.bufferline.active" = { fg = "black", bg = "acme_bg" } +"diff.plus" = {fg = "green"} +"diff.delta" = {fg = "acme_bar_bg"} +"diff.minus" = {fg = "red"} [palette] white = "#ffffff" diff --git a/runtime/themes/nord_light.toml b/runtime/themes/nord_light.toml index 5270fe34ea39..eb947d034fc3 100644 --- a/runtime/themes/nord_light.toml +++ b/runtime/themes/nord_light.toml @@ -58,6 +58,10 @@ "markup.link.text" = {fg="nord12"} "markup.quote" = {fg="nord3", modifiers=["italic"]} +"diff.plus" = {fg = "nord14"} +"diff.delta" = {fg = "nord13"} +"diff.minus" = {fg = "nord11"} + [palette] nord0 = "#2E3440" From 5781aa026417bc6539b80b451da4a99a7057bbe7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matou=C5=A1=20Dzivjak?= Date: Mon, 5 Dec 2022 16:16:25 +0100 Subject: [PATCH 200/491] feat(highlights): go builtin funcs and types (#5010) Add highlight scopes for golang built-in functions and types. Based on https://pkg.go.dev/builtin. --- runtime/queries/go/highlights.scm | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/runtime/queries/go/highlights.scm b/runtime/queries/go/highlights.scm index 4ff8675b1d5f..927bd95b06a7 100644 --- a/runtime/queries/go/highlights.scm +++ b/runtime/queries/go/highlights.scm @@ -1,5 +1,9 @@ ; Function calls +(call_expression + function: (identifier) @function.builtin + (match? @function.builtin "^(append|cap|close|complex|copy|delete|imag|len|make|new|panic|print|println|real|recover)$")) + (call_expression function: (identifier) @function) @@ -24,6 +28,9 @@ (parameter_declaration (identifier) @variable.parameter) (variadic_parameter_declaration (identifier) @variable.parameter) +((type_identifier) @type.builtin + (match? @type.builtin "^(any|bool|byte|comparable|complex128|complex64|error|float32|float64|int|int16|int32|int64|int8|rune|string|uint|uint16|uint32|uint64|uint8|uintptr)$")) + (type_identifier) @type (field_identifier) @variable.other.member (identifier) @variable From 5691ada822a7c6e27f8890ee25f52a9262caddd2 Mon Sep 17 00:00:00 2001 From: VuiMuich Date: Mon, 5 Dec 2022 23:28:20 +0100 Subject: [PATCH 201/491] Change diff colors for serika themes (#5015) --- runtime/themes/serika-dark.toml | 2 +- runtime/themes/serika-light.toml | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/runtime/themes/serika-dark.toml b/runtime/themes/serika-dark.toml index 88e4cf6d5e82..2b4000ac215f 100644 --- a/runtime/themes/serika-dark.toml +++ b/runtime/themes/serika-dark.toml @@ -61,7 +61,7 @@ "diff.plus" = { fg = "green" } "diff.delta" = { fg = "orange" } -"diff.minus" = { fg = "red" } +"diff.minus" = { fg = "nasty-red" } "markup.heading" = { fg = "purple", modifiers = ["bold"] } "markup.list" = "cyan" diff --git a/runtime/themes/serika-light.toml b/runtime/themes/serika-light.toml index a00274bb9f60..ad830d92c148 100644 --- a/runtime/themes/serika-light.toml +++ b/runtime/themes/serika-light.toml @@ -59,9 +59,9 @@ "error" = "nasty-red" "diagnostic" = { fg = "nasty-red", modifiers = ["underlined"] } -"diff.plus" = { fg = "green" } -"diff.delta" = { fg = "orange" } -"diff.minus" = { fg = "red" } +"diff.plus" = { fg = "bg_green" +"diff.delta" = { fg = "bg_blue" } +"diff.minus" = { fg = "nasty-red" } "markup.heading" = { fg = "purple", modifiers = ["bold"] } "markup.list" = "cyan" @@ -72,7 +72,6 @@ "markup.quote" = { fg = "yellow", modifiers = ["italic"] } "markup.raw" = { fg = "fg" } - [palette] bg0 = "#e1e1e3" From 7210c58a51a16c0ae3c9d77211ed1a25e039bd9e Mon Sep 17 00:00:00 2001 From: nosa <96927121+n0s4@users.noreply.github.com> Date: Tue, 6 Dec 2022 01:13:41 +0000 Subject: [PATCH 202/491] Change default TS object bindings (#3782) * Change default TS object bindings Changes 'match inside/around' bindings for: - type definition from `c` to `t` - comments from `o` to `c` - tests from `t` to `T` Also changes those for the `]` / `[` bindings. * Update docs for changed keybinds Co-authored-by: Michael Davis --- book/src/keymap.md | 14 +++++++------- helix-term/src/commands.rs | 16 ++++++++-------- helix-term/src/keymap/default.rs | 12 ++++++------ 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/book/src/keymap.md b/book/src/keymap.md index 6523b09fb88c..c3c09f4ca3b9 100644 --- a/book/src/keymap.md +++ b/book/src/keymap.md @@ -297,7 +297,7 @@ Displays documentation for item under cursor. | ---- | ----------- | | `Ctrl-u` | Scroll up | | `Ctrl-d` | Scroll down | - + #### Unimpaired Mappings in the style of [vim-unimpaired](https://github.com/tpope/vim-unimpaired). @@ -310,14 +310,14 @@ Mappings in the style of [vim-unimpaired](https://github.com/tpope/vim-unimpaire | `]D` | Go to last diagnostic in document (**LSP**) | `goto_last_diag` | | `]f` | Go to next function (**TS**) | `goto_next_function` | | `[f` | Go to previous function (**TS**) | `goto_prev_function` | -| `]c` | Go to next class (**TS**) | `goto_next_class` | -| `[c` | Go to previous class (**TS**) | `goto_prev_class` | +| `]t` | Go to next type definition (**TS**) | `goto_next_class` | +| `[t` | Go to previous type definition (**TS**) | `goto_prev_class` | | `]a` | Go to next argument/parameter (**TS**) | `goto_next_parameter` | | `[a` | Go to previous argument/parameter (**TS**) | `goto_prev_parameter` | -| `]o` | Go to next comment (**TS**) | `goto_next_comment` | -| `[o` | Go to previous comment (**TS**) | `goto_prev_comment` | -| `]t` | Go to next test (**TS**) | `goto_next_test` | -| `]t` | Go to previous test (**TS**) | `goto_prev_test` | +| `]c` | Go to next comment (**TS**) | `goto_next_comment` | +| `[c` | Go to previous comment (**TS**) | `goto_prev_comment` | +| `]T` | Go to next test (**TS**) | `goto_next_test` | +| `]T` | Go to previous test (**TS**) | `goto_prev_test` | | `]p` | Go to next paragraph | `goto_next_paragraph` | | `[p` | Go to previous paragraph | `goto_prev_paragraph` | | `[Space` | Add newline above | `add_newline_above` | diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index 4cd271194959..31a2f58274d1 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -402,8 +402,8 @@ impl MappableCommand { select_textobject_inner, "Select inside object", goto_next_function, "Goto next function", goto_prev_function, "Goto previous function", - goto_next_class, "Goto next class", - goto_prev_class, "Goto previous class", + goto_next_class, "Goto next type definition", + goto_prev_class, "Goto previous type definition", goto_next_parameter, "Goto next parameter", goto_prev_parameter, "Goto previous parameter", goto_next_comment, "Goto next comment", @@ -4520,11 +4520,11 @@ fn select_textobject(cx: &mut Context, objtype: textobject::TextObject) { match ch { 'w' => textobject::textobject_word(text, range, objtype, count, false), 'W' => textobject::textobject_word(text, range, objtype, count, true), - 'c' => textobject_treesitter("class", range), + 't' => textobject_treesitter("class", range), 'f' => textobject_treesitter("function", range), 'a' => textobject_treesitter("parameter", range), - 'o' => textobject_treesitter("comment", range), - 't' => textobject_treesitter("test", range), + 'c' => textobject_treesitter("comment", range), + 'T' => textobject_treesitter("test", range), 'p' => textobject::textobject_paragraph(text, range, objtype, count), 'm' => textobject::textobject_pair_surround_closest( text, range, objtype, count, @@ -4552,11 +4552,11 @@ fn select_textobject(cx: &mut Context, objtype: textobject::TextObject) { ("w", "Word"), ("W", "WORD"), ("p", "Paragraph"), - ("c", "Class (tree-sitter)"), + ("t", "Type definition (tree-sitter)"), ("f", "Function (tree-sitter)"), ("a", "Argument/parameter (tree-sitter)"), - ("o", "Comment (tree-sitter)"), - ("t", "Test (tree-sitter)"), + ("c", "Comment (tree-sitter)"), + ("T", "Test (tree-sitter)"), ("m", "Closest surrounding pair to cursor"), (" ", "... or any character acting as a pair"), ]; diff --git a/helix-term/src/keymap/default.rs b/helix-term/src/keymap/default.rs index c0d17a87e065..b6d9ea1088c2 100644 --- a/helix-term/src/keymap/default.rs +++ b/helix-term/src/keymap/default.rs @@ -101,10 +101,10 @@ pub fn default() -> HashMap { "d" => goto_prev_diag, "D" => goto_first_diag, "f" => goto_prev_function, - "c" => goto_prev_class, + "t" => goto_prev_class, "a" => goto_prev_parameter, - "o" => goto_prev_comment, - "t" => goto_prev_test, + "c" => goto_prev_comment, + "T" => goto_prev_test, "p" => goto_prev_paragraph, "space" => add_newline_above, }, @@ -112,10 +112,10 @@ pub fn default() -> HashMap { "d" => goto_next_diag, "D" => goto_last_diag, "f" => goto_next_function, - "c" => goto_next_class, + "t" => goto_next_class, "a" => goto_next_parameter, - "o" => goto_next_comment, - "t" => goto_next_test, + "c" => goto_next_comment, + "T" => goto_next_test, "p" => goto_next_paragraph, "space" => add_newline_below, }, From 2077f5e26a4cdaadde4b505fc64eadb9e6849c0d Mon Sep 17 00:00:00 2001 From: Michael Davis Date: Mon, 5 Dec 2022 19:29:40 -0600 Subject: [PATCH 203/491] Apply completion edits to all cursors (#4496) Completion edits - either basic `insert_text` strings or structured `text_edit`s - are assumed by the LSP spec to apply to the current cursor (or at least the trigger point). We can use the range (if any) and text given by the Language Server to create a transaction that changes all ranges in the current selection though, allowing auto- complete to affect multiple cursors. --- helix-lsp/src/lib.rs | 38 ++++++++++++++++++++++++++++++++- helix-term/src/ui/completion.rs | 31 +++++++++++++++++++++------ 2 files changed, 61 insertions(+), 8 deletions(-) diff --git a/helix-lsp/src/lib.rs b/helix-lsp/src/lib.rs index abc930f85bd6..f714395f28f5 100644 --- a/helix-lsp/src/lib.rs +++ b/helix-lsp/src/lib.rs @@ -57,7 +57,7 @@ pub enum OffsetEncoding { pub mod util { use super::*; - use helix_core::{diagnostic::NumberOrString, Range, Rope, Transaction}; + use helix_core::{diagnostic::NumberOrString, Range, Rope, Selection, Tendril, Transaction}; /// Converts a diagnostic in the document to [`lsp::Diagnostic`]. /// @@ -196,6 +196,42 @@ pub mod util { Some(Range::new(start, end)) } + /// Creates a [Transaction] from the [lsp::TextEdit] in a completion response. + /// The transaction applies the edit to all cursors. + pub fn generate_transaction_from_completion_edit( + doc: &Rope, + selection: &Selection, + edit: lsp::TextEdit, + offset_encoding: OffsetEncoding, + ) -> Transaction { + let replacement: Option = if edit.new_text.is_empty() { + None + } else { + Some(edit.new_text.into()) + }; + + let text = doc.slice(..); + let primary_cursor = selection.primary().cursor(text); + + let start_offset = match lsp_pos_to_pos(doc, edit.range.start, offset_encoding) { + Some(start) => start as i128 - primary_cursor as i128, + None => return Transaction::new(doc), + }; + let end_offset = match lsp_pos_to_pos(doc, edit.range.end, offset_encoding) { + Some(end) => end as i128 - primary_cursor as i128, + None => return Transaction::new(doc), + }; + + Transaction::change_by_selection(doc, selection, |range| { + let cursor = range.cursor(text); + ( + (cursor as i128 + start_offset) as usize, + (cursor as i128 + end_offset) as usize, + replacement.clone(), + ) + }) + } + pub fn generate_transaction_from_edits( doc: &Rope, mut edits: Vec, diff --git a/helix-term/src/ui/completion.rs b/helix-term/src/ui/completion.rs index ebb4fb46ae66..c54990e8ec75 100644 --- a/helix-term/src/ui/completion.rs +++ b/helix-term/src/ui/completion.rs @@ -1,5 +1,5 @@ use crate::compositor::{Component, Context, Event, EventResult}; -use helix_view::{apply_transaction, editor::CompleteAction}; +use helix_view::{apply_transaction, editor::CompleteAction, ViewId}; use tui::buffer::Buffer as Surface; use tui::text::Spans; @@ -107,6 +107,7 @@ impl Completion { let menu = Menu::new(items, (), move |editor: &mut Editor, item, event| { fn item_to_transaction( doc: &Document, + view_id: ViewId, item: &CompletionItem, offset_encoding: helix_lsp::OffsetEncoding, start_offset: usize, @@ -121,9 +122,10 @@ impl Completion { } }; - util::generate_transaction_from_edits( + util::generate_transaction_from_completion_edit( doc.text(), - vec![edit], + doc.selection(view_id), + edit, offset_encoding, // TODO: should probably transcode in Client ) } else { @@ -132,10 +134,23 @@ impl Completion { // in these cases we need to check for a common prefix and remove it let prefix = Cow::from(doc.text().slice(start_offset..trigger_offset)); let text = text.trim_start_matches::<&str>(&prefix); - Transaction::change( - doc.text(), - vec![(trigger_offset, trigger_offset, Some(text.into()))].into_iter(), - ) + + // TODO: this needs to be true for the numbers to work out correctly + // in the closure below. It's passed in to a callback as this same + // formula, but can the value change between the LSP request and + // response? If it does, can we recover? + debug_assert!( + doc.selection(view_id) + .primary() + .cursor(doc.text().slice(..)) + == trigger_offset + ); + + Transaction::change_by_selection(doc.text(), doc.selection(view_id), |range| { + let cursor = range.cursor(doc.text().slice(..)); + + (cursor, cursor, Some(text.into())) + }) }; transaction @@ -164,6 +179,7 @@ impl Completion { let transaction = item_to_transaction( doc, + view.id, item, offset_encoding, start_offset, @@ -185,6 +201,7 @@ impl Completion { let transaction = item_to_transaction( doc, + view.id, item, offset_encoding, start_offset, From dbed90c5a65f435c7886f27b17cbad9cd8492355 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 6 Dec 2022 10:30:04 +0900 Subject: [PATCH 204/491] build(deps): bump git-repository from 0.26.0 to 0.29.0 (#5016) Bumps [git-repository](https://github.com/Byron/gitoxide) from 0.26.0 to 0.29.0. - [Release notes](https://github.com/Byron/gitoxide/releases) - [Changelog](https://github.com/Byron/gitoxide/blob/main/CHANGELOG.md) - [Commits](https://github.com/Byron/gitoxide/compare/git-repository-v0.26.0...git-repository-v0.29.0) --- updated-dependencies: - dependency-name: git-repository dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Cargo.lock | 132 +++++++++++++++++++++---------------------- helix-vcs/Cargo.toml | 2 +- 2 files changed, 67 insertions(+), 67 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2e0211972bb6..a3746f569abd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -551,9 +551,9 @@ dependencies = [ [[package]] name = "git-actor" -version = "0.13.0" +version = "0.14.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18d4ce09c0a6c71c044700e5932877667f427f007b77e6c39ab49aebc4719e25" +checksum = "ac9fb99c934ed45a62d9ae1e7b21949f2d869d1b82a07dcbf16ed61daa665870" dependencies = [ "bstr 1.0.1", "btoi", @@ -565,9 +565,9 @@ dependencies = [ [[package]] name = "git-attributes" -version = "0.5.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c62e66a042c6b39c6dbfa3be37d134900d99ff9c54bbe489ed560a573895d5d" +checksum = "82e98446a2bf0eb5c8f29fa828d6529510a6fadeb59ce14ca98e58fa7e1e0199" dependencies = [ "bstr 1.0.1", "compact_str", @@ -581,36 +581,36 @@ dependencies = [ [[package]] name = "git-bitmap" -version = "0.1.2" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "327098a7ad27ae298d7e71602dbd4375cc828d755d10a720e4be0be1b4ec38f0" +checksum = "44304093ac66a0ada1b243c15c3a503a165a1d0f50bec748f4e5a9b84a0d0722" dependencies = [ "quick-error", ] [[package]] name = "git-chunk" -version = "0.3.2" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07b2bc1635b660ad6e30379a84a4946590a3c124b747107c2cca1d9dbb98f588" +checksum = "3090baa2f4a3fe488a9b3e31090b83259aaf930bf0634af34c18117274f8f1a8" dependencies = [ "thiserror", ] [[package]] name = "git-command" -version = "0.1.0" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e4b01997b6551554fdac6f02277d0d04c3e869daa649bedd06d38c86f11dc42" +checksum = "a6b98a6312fef79b326c0a6e15d576c2bd30f7f9d0b7964998d166049e0d7b9e" dependencies = [ "bstr 1.0.1", ] [[package]] name = "git-config" -version = "0.10.0" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd8603e953bd4c9bf310e74e43697400f5542f1cc75fad46fbd7427135a9534f" +checksum = "bd1d13179bcf3dd68e83404f91a8d01c618f54eb97ef36c68ee5e6f30183a681" dependencies = [ "bstr 1.0.1", "git-config-value", @@ -629,9 +629,9 @@ dependencies = [ [[package]] name = "git-config-value" -version = "0.8.2" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05f276bfe5806b414915112f1eec0f006206cdf5b8cc9bbb44ef7e52286dc3eb" +checksum = "64561e9700f1fc737fa3c1c4ea55293be70dba98e45c54cf3715cb180f37a566" dependencies = [ "bitflags", "bstr 1.0.1", @@ -642,9 +642,9 @@ dependencies = [ [[package]] name = "git-credentials" -version = "0.6.1" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f540186ea56fd075ba2b923180ebf4318e66ceaeac0a2a518e75dab8517d339" +checksum = "621dd60288ae7b8f80bb0704f46d4d2b76fc1ec980a7804e48b02d94a927e331" dependencies = [ "bstr 1.0.1", "git-command", @@ -658,9 +658,9 @@ dependencies = [ [[package]] name = "git-date" -version = "0.2.0" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37881e9725df41e15d16216d3a0cee251fd8a39d425f75b389112df5c7f20f3d" +checksum = "e33db9f4462b565a33507aee113f3383bf16b988d2c573f07691e34302b7aa0a" dependencies = [ "bstr 1.0.1", "itoa", @@ -670,9 +670,9 @@ dependencies = [ [[package]] name = "git-diff" -version = "0.21.0" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a88666a0ae4365b55a0cbf2efde68d2a4cff0747894ad229403bd60b0b2abc5" +checksum = "82f77407381267be95f1b26acfb32007258af342ee61729bb4271b1869bf5bb2" dependencies = [ "git-hash", "git-object", @@ -682,9 +682,9 @@ dependencies = [ [[package]] name = "git-discover" -version = "0.7.0" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "881e4136d5599cfdb79d8ef60d650823d1a563589fa493d8e4961e64d78a79f2" +checksum = "2c2cfd1272824b126c6997ef479a71288d00fae14dc5144dfc48658f4dd24fbe" dependencies = [ "bstr 1.0.1", "git-hash", @@ -696,9 +696,9 @@ dependencies = [ [[package]] name = "git-features" -version = "0.23.1" +version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4be88ae837674c71b30c6517c6f5f1335f8135bb8a9ffef20000d211933bed08" +checksum = "d7bdbe755d2129bc609437b6b18af1116f146128dda6070c15c0aa50201ac17c" dependencies = [ "crc32fast", "flate2", @@ -713,9 +713,9 @@ dependencies = [ [[package]] name = "git-glob" -version = "0.4.2" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d756430237112f8c89049236f60fdcdb0005127b1f7e531d40984e4fe7daa90" +checksum = "ef858611602fce54b51e45671ca72f07fe6a3c0e24a0539c66b75dfd4d84bd77" dependencies = [ "bitflags", "bstr 1.0.1", @@ -723,9 +723,9 @@ dependencies = [ [[package]] name = "git-hash" -version = "0.9.11" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16d46e6c2d1e8da4438a87bf516a6761b300964a353541fea61e96b3c7b34554" +checksum = "1532d82bf830532f8d545c5b7b568e311e3593f16cf7ee9dd0ce03c74b12b99d" dependencies = [ "hex", "thiserror", @@ -733,9 +733,9 @@ dependencies = [ [[package]] name = "git-index" -version = "0.7.1" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "821583c2d12b1e864694eb0bf1cca10ff6a3f45966f5f834e0f921b496dbe7cb" +checksum = "a87c32d2e012ee316d4037b2151e5893599379ff1fc2c6adb36d2d4d1c461e2c" dependencies = [ "atoi", "bitflags", @@ -755,9 +755,9 @@ dependencies = [ [[package]] name = "git-lock" -version = "2.2.0" +version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f0fe10bf961f62b1335b4c07785e64fb4d86c5ed367dc7cd9360f13c3eb7c78" +checksum = "89e4f05b8a68c3a5dd83a6651c76be384e910fe283072184fdab9d77f87ccec2" dependencies = [ "fastrand", "git-tempfile", @@ -766,9 +766,9 @@ dependencies = [ [[package]] name = "git-mailmap" -version = "0.5.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb3f85ce84b2328aeb3124a809f7b3a63e59c4d63c227dba7a9cdf6fca6c0987" +checksum = "480eecdfaf1bfd05973678520d182dc07afa25b133db18c52575fb65b782b7ba" dependencies = [ "bstr 1.0.1", "git-actor", @@ -777,9 +777,9 @@ dependencies = [ [[package]] name = "git-object" -version = "0.22.1" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9469a8c00d8bb500ee76a12e455bb174b4ddf71674713335dd1a84313723f7b3" +checksum = "ce0f14f9cd8f0782e843898a2fb7b0c2f5a6e37bd4cdff4409bb8ec698597dad" dependencies = [ "bstr 1.0.1", "btoi", @@ -796,9 +796,9 @@ dependencies = [ [[package]] name = "git-odb" -version = "0.35.0" +version = "0.37.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aaaea7031ac7d8dfee232a16d7114395d118226214fb03fe4e15d1f4d62a88a6" +checksum = "13493da6cf0326454215414d29f933a1e26bdba3b9b60ad8cdcbe06f0639584b" dependencies = [ "arc-swap", "git-features", @@ -814,9 +814,9 @@ dependencies = [ [[package]] name = "git-pack" -version = "0.25.0" +version = "0.27.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc4386dff835ffdc3697c3558111f708fd7b7695c42a4347f2d211cf3246c8e1" +checksum = "fa8391cbf293f0f8ffbb5e324f25741f5e1e2d35fb87b89ab222a025661e0454" dependencies = [ "bytesize", "clru", @@ -838,9 +838,9 @@ dependencies = [ [[package]] name = "git-path" -version = "0.5.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "425dc1022690be13e6c5bde4b7e04d9504d323605ec314cd367cebf38a812572" +checksum = "5f60cbc13bc0fdd95df5f4b80437197e2853116792894b1bf38d1a6b4a64f8c9" dependencies = [ "bstr 1.0.1", "thiserror", @@ -848,9 +848,9 @@ dependencies = [ [[package]] name = "git-prompt" -version = "0.1.1" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa6947935c0671342277bc883ff0687978477b570c1ffe2200b9ba5ac8afdd9f" +checksum = "21c6aaeb3f0f8de91f5e0eb950282c6508e05babcedef768db5a6f085d6e5242" dependencies = [ "git-command", "git-config-value", @@ -861,9 +861,9 @@ dependencies = [ [[package]] name = "git-quote" -version = "0.3.0" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ea17931d07cbe447f371bbdf45ff03c30ea86db43788166655a5302df87ecfc" +checksum = "1dd11f4e7f251ab297545faa4c5a4517f4985a43b9c16bf96fa49107f58e837f" dependencies = [ "bstr 1.0.1", "btoi", @@ -872,9 +872,9 @@ dependencies = [ [[package]] name = "git-ref" -version = "0.18.0" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "638c9e454bacb2965a43f05b4a383c8f66dc64f3a770bd0324b221c2a20e121d" +checksum = "22484043921e699edc170415789f1b882c8f3546e1fbbc447a0043ef07e088c4" dependencies = [ "git-actor", "git-features", @@ -891,9 +891,9 @@ dependencies = [ [[package]] name = "git-refspec" -version = "0.3.1" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9497af773538ae8cfda053ff7dd0a9e6c28d333ba653040f54b8b4ee32f14187" +checksum = "ac2e8f36e7d5d48903b60051dfb75aedfc4ea9ba66bdffa7a9081e8d276b0107" dependencies = [ "bstr 1.0.1", "git-hash", @@ -905,9 +905,9 @@ dependencies = [ [[package]] name = "git-repository" -version = "0.26.0" +version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eeb43e59612e493af6a433bf0a960de0042c8aa6f4e4c4cb414f03b97e296b82" +checksum = "a89cec253dd3fba44694f7468d907506a52d0055850ecd7d84f4bac07f00e73f" dependencies = [ "byte-unit", "clru", @@ -948,9 +948,9 @@ dependencies = [ [[package]] name = "git-revision" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1efd31c63c3745b5dba5ec7109eec41a9c717f4e1e797fe0ef93098f33f31b25" +checksum = "e629289b0d7f7f2f2e46248527f5cac838e6a7cb9507eab06fc8473082db6cb6" dependencies = [ "bstr 1.0.1", "git-date", @@ -962,9 +962,9 @@ dependencies = [ [[package]] name = "git-sec" -version = "0.4.2" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c79769f6546814d0774db7295c768441016b7e40bdd414fa8dfae2c616a1892" +checksum = "1ecb370efde58da72827909292284b5c5b885e0621a342515a36976b0b3bf660" dependencies = [ "bitflags", "dirs", @@ -975,9 +975,9 @@ dependencies = [ [[package]] name = "git-tempfile" -version = "2.0.6" +version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d23bc6129de3cbd81e6c9d0d685b5540c6b41bd9fa0cc38f381bc300743d708" +checksum = "a6bb4dee86c8cae5a078cfaac3b004ef99c31548ed86218f23a7ff9b4b74f3be" dependencies = [ "dashmap", "libc", @@ -989,9 +989,9 @@ dependencies = [ [[package]] name = "git-traverse" -version = "0.18.0" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d0c4dd773c69f294f43ace8373d48eb770129791f104c6857fa8cac0505af89" +checksum = "2d2746935c92d252e24f9d345e0a981510596faceb7edae821b9e4c8c35c285b" dependencies = [ "git-hash", "git-object", @@ -1001,9 +1001,9 @@ dependencies = [ [[package]] name = "git-url" -version = "0.10.1" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21b7f8323196840e7932f5b60e1d9c1d6c140fd806bc512f8beedc3f990a1f81" +checksum = "7dbd91c55b1b03a833ff8278776fed272918cd61cd48efe9a97ad1fea7ef93ec" dependencies = [ "bstr 1.0.1", "git-features", @@ -1015,9 +1015,9 @@ dependencies = [ [[package]] name = "git-validate" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5439d6aa0de838dfadd74a71e97a9e23ebc719fd11a9ab6788b835b112c8c3d" +checksum = "cdf83bae632fc064ca938ebfb987364d9083b7f98b1476805f0a2d5eebb48686" dependencies = [ "bstr 1.0.1", "thiserror", @@ -1025,9 +1025,9 @@ dependencies = [ [[package]] name = "git-worktree" -version = "0.7.0" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45bcc69c36a29cfa283710b7901877ab251d658935f5a41ed824416af500e0ed" +checksum = "2eae0e0b1050208e611d5fac0d8366b29ef3f83849767ff9c4bcf570f0d5dc2b" dependencies = [ "bstr 1.0.1", "git-attributes", diff --git a/helix-vcs/Cargo.toml b/helix-vcs/Cargo.toml index c114666d26d5..e54cf828f51b 100644 --- a/helix-vcs/Cargo.toml +++ b/helix-vcs/Cargo.toml @@ -16,7 +16,7 @@ helix-core = { version = "0.6", path = "../helix-core" } tokio = { version = "1", features = ["rt", "rt-multi-thread", "time", "sync", "parking_lot", "macros"] } parking_lot = "0.12" -git-repository = { version = "0.26", default-features = false , optional = true } +git-repository = { version = "0.29", default-features = false , optional = true } imara-diff = "0.1.5" log = "0.4" From 952f292d252bdc135f10b1ffa52734d5242d2c60 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 6 Dec 2022 10:30:11 +0900 Subject: [PATCH 205/491] build(deps): bump serde from 1.0.148 to 1.0.149 (#5017) Bumps [serde](https://github.com/serde-rs/serde) from 1.0.148 to 1.0.149. - [Release notes](https://github.com/serde-rs/serde/releases) - [Commits](https://github.com/serde-rs/serde/compare/v1.0.148...v1.0.149) --- updated-dependencies: - dependency-name: serde dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Cargo.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a3746f569abd..014834e43349 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1804,18 +1804,18 @@ checksum = "9c8132065adcfd6e02db789d9285a0deb2f3fcb04002865ab67d5fb103533898" [[package]] name = "serde" -version = "1.0.148" +version = "1.0.149" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e53f64bb4ba0191d6d0676e1b141ca55047d83b74f5607e6d8eb88126c52c2dc" +checksum = "256b9932320c590e707b94576e3cc1f7c9024d0ee6612dfbcf1cb106cbe8e055" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.148" +version = "1.0.149" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a55492425aa53521babf6137309e7d34c20bbfbbfcfe2c7f3a047fd1f6b92c0c" +checksum = "b4eae9b04cbffdfd550eb462ed33bc6a1b68c935127d008b27444d08380f94e4" dependencies = [ "proc-macro2", "quote", From 453a75a3739338348024b6c676231aef9ef6cb7b Mon Sep 17 00:00:00 2001 From: Narazaki Shuji Date: Tue, 6 Dec 2022 11:16:08 +0900 Subject: [PATCH 206/491] fix: align view after jumplist_picker (#3743) * Add `View::ensure_cursor_in_view_center` to adjust view after searching and jumping Also `offset_coodrs_to_in_view` was refactored to reduce duplicated position calculations. * Fix a wrong offset calculation in `offset_coords_to_in_view_center` It ignored `scrolloff` if `centering` is false. --- helix-term/src/commands.rs | 15 +++---- helix-view/src/view.rs | 89 +++++++++++++++++++++++++------------- 2 files changed, 67 insertions(+), 37 deletions(-) diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index 31a2f58274d1..263890269c41 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -1667,12 +1667,7 @@ fn search_impl( }; doc.set_selection(view.id, selection); - // TODO: is_cursor_in_view does the same calculation as ensure_cursor_in_view - if view.is_cursor_in_view(doc, 0) { - view.ensure_cursor_in_view(doc, scrolloff); - } else { - align_view(doc, view, Align::Center) - } + view.ensure_cursor_in_view_center(doc, scrolloff); }; } @@ -2434,8 +2429,10 @@ fn jumplist_picker(cx: &mut Context) { (), |cx, meta, action| { cx.editor.switch(meta.id, action); + let config = cx.editor.config(); let (view, doc) = current!(cx.editor); doc.set_selection(view.id, meta.selection.clone()); + view.ensure_cursor_in_view_center(doc, config.scrolloff); }, |editor, meta| { let doc = &editor.documents.get(&meta.id)?; @@ -4205,6 +4202,7 @@ fn match_brackets(cx: &mut Context) { fn jump_forward(cx: &mut Context) { let count = cx.count(); + let config = cx.editor.config(); let view = view_mut!(cx.editor); let doc_id = view.doc; @@ -4218,12 +4216,13 @@ fn jump_forward(cx: &mut Context) { } doc.set_selection(view.id, selection); - align_view(doc, view, Align::Center); + view.ensure_cursor_in_view_center(doc, config.scrolloff); }; } fn jump_backward(cx: &mut Context) { let count = cx.count(); + let config = cx.editor.config(); let (view, doc) = current!(cx.editor); let doc_id = doc.id(); @@ -4237,7 +4236,7 @@ fn jump_backward(cx: &mut Context) { } doc.set_selection(view.id, selection); - align_view(doc, view, Align::Center); + view.ensure_cursor_in_view_center(doc, config.scrolloff); }; } diff --git a/helix-view/src/view.rs b/helix-view/src/view.rs index ecc8e8beaa7b..c09d502dcaca 100644 --- a/helix-view/src/view.rs +++ b/helix-view/src/view.rs @@ -1,4 +1,4 @@ -use crate::{editor::GutterType, graphics::Rect, Document, DocumentId, ViewId}; +use crate::{align_view, editor::GutterType, graphics::Rect, Align, Document, DocumentId, ViewId}; use helix_core::{ pos_at_visual_coords, visual_coords_at_pos, Position, RopeSlice, Selection, Transaction, }; @@ -169,6 +169,15 @@ impl View { &self, doc: &Document, scrolloff: usize, + ) -> Option<(usize, usize)> { + self.offset_coords_to_in_view_center(doc, scrolloff, false) + } + + pub fn offset_coords_to_in_view_center( + &self, + doc: &Document, + scrolloff: usize, + centering: bool, ) -> Option<(usize, usize)> { let cursor = doc .selection(self.id) @@ -180,47 +189,69 @@ impl View { let inner_area = self.inner_area(doc); let last_line = (self.offset.row + inner_area.height as usize).saturating_sub(1); - - // - 1 so we have at least one gap in the middle. - // a height of 6 with padding of 3 on each side will keep shifting the view back and forth - // as we type - let scrolloff = scrolloff.min(inner_area.height.saturating_sub(1) as usize / 2); - let last_col = self.offset.col + inner_area.width.saturating_sub(1) as usize; - let row = if line > last_line.saturating_sub(scrolloff) { - // scroll down - self.offset.row + line - (last_line.saturating_sub(scrolloff)) - } else if line < self.offset.row + scrolloff { - // scroll up - line.saturating_sub(scrolloff) - } else { - self.offset.row + let new_offset = |scrolloff: usize| { + // - 1 so we have at least one gap in the middle. + // a height of 6 with padding of 3 on each side will keep shifting the view back and forth + // as we type + let scrolloff = scrolloff.min(inner_area.height.saturating_sub(1) as usize / 2); + + let row = if line > last_line.saturating_sub(scrolloff) { + // scroll down + self.offset.row + line - (last_line.saturating_sub(scrolloff)) + } else if line < self.offset.row + scrolloff { + // scroll up + line.saturating_sub(scrolloff) + } else { + self.offset.row + }; + + let col = if col > last_col.saturating_sub(scrolloff) { + // scroll right + self.offset.col + col - (last_col.saturating_sub(scrolloff)) + } else if col < self.offset.col + scrolloff { + // scroll left + col.saturating_sub(scrolloff) + } else { + self.offset.col + }; + (row, col) }; - - let col = if col > last_col.saturating_sub(scrolloff) { - // scroll right - self.offset.col + col - (last_col.saturating_sub(scrolloff)) - } else if col < self.offset.col + scrolloff { - // scroll left - col.saturating_sub(scrolloff) + let current_offset = (self.offset.row, self.offset.col); + if centering { + // return None if cursor is out of view + let offset = new_offset(0); + (offset == current_offset).then(|| { + if scrolloff == 0 { + offset + } else { + new_offset(scrolloff) + } + }) } else { - self.offset.col - }; - if row == self.offset.row && col == self.offset.col { - None - } else { - Some((row, col)) + // return None if cursor is in (view - scrolloff) + let offset = new_offset(scrolloff); + (offset != current_offset).then(|| offset) // TODO: use 'then_some' when 1.62 <= MSRV } } pub fn ensure_cursor_in_view(&mut self, doc: &Document, scrolloff: usize) { - if let Some((row, col)) = self.offset_coords_to_in_view(doc, scrolloff) { + if let Some((row, col)) = self.offset_coords_to_in_view_center(doc, scrolloff, false) { self.offset.row = row; self.offset.col = col; } } + pub fn ensure_cursor_in_view_center(&mut self, doc: &Document, scrolloff: usize) { + if let Some((row, col)) = self.offset_coords_to_in_view_center(doc, scrolloff, true) { + self.offset.row = row; + self.offset.col = col; + } else { + align_view(doc, self, Align::Center); + } + } + pub fn is_cursor_in_view(&mut self, doc: &Document, scrolloff: usize) -> bool { self.offset_coords_to_in_view(doc, scrolloff).is_none() } From af532147c97987d6170dc06a52aa3434ebf1b9d4 Mon Sep 17 00:00:00 2001 From: Pascal Kuthe Date: Tue, 6 Dec 2022 15:18:33 +0100 Subject: [PATCH 207/491] Add command/keybinding to jump between hunks (#4650) * add command and keybding to jump to next/prev hunk * add textobject for change * Update helix-vcs/src/diff.rs Co-authored-by: Michael Davis * select entire hunk instead of first char * fix selection range Co-authored-by: Michael Davis --- book/src/keymap.md | 4 + book/src/usage.md | 1 + helix-term/src/commands.rs | 121 +++++++++++++++++++++++++++++++ helix-term/src/keymap/default.rs | 4 + helix-vcs/src/diff.rs | 81 +++++++++++++++++++++ 5 files changed, 211 insertions(+) diff --git a/book/src/keymap.md b/book/src/keymap.md index c3c09f4ca3b9..139e8fddf613 100644 --- a/book/src/keymap.md +++ b/book/src/keymap.md @@ -320,6 +320,10 @@ Mappings in the style of [vim-unimpaired](https://github.com/tpope/vim-unimpaire | `]T` | Go to previous test (**TS**) | `goto_prev_test` | | `]p` | Go to next paragraph | `goto_next_paragraph` | | `[p` | Go to previous paragraph | `goto_prev_paragraph` | +| `]g` | Go to next change | `goto_next_change` | +| `[g` | Go to previous change | `goto_prev_change` | +| `]G` | Go to first change | `goto_first_change` | +| `[G` | Go to last change | `goto_last_change` | | `[Space` | Add newline above | `add_newline_above` | | `]Space` | Add newline below | `add_newline_below` | diff --git a/book/src/usage.md b/book/src/usage.md index 646bf926d536..a6eb9ec1d4f1 100644 --- a/book/src/usage.md +++ b/book/src/usage.md @@ -143,6 +143,7 @@ though, we climb the syntax tree and then take the previous selection. So | `a` | Argument/parameter | | `o` | Comment | | `t` | Test | +| `g` | Change | > NOTE: `f`, `c`, etc need a tree-sitter grammar active for the current document and a special tree-sitter query file to work properly. [Only diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index 263890269c41..1843e7a2be4e 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -3,6 +3,7 @@ pub(crate) mod lsp; pub(crate) mod typed; pub use dap::*; +use helix_vcs::Hunk; pub use lsp::*; use tui::text::Spans; pub use typed::*; @@ -308,6 +309,10 @@ impl MappableCommand { goto_last_diag, "Goto last diagnostic", goto_next_diag, "Goto next diagnostic", goto_prev_diag, "Goto previous diagnostic", + goto_next_change, "Goto next change", + goto_prev_change, "Goto previous change", + goto_first_change, "Goto first change", + goto_last_change, "Goto last change", goto_line_start, "Goto line start", goto_line_end, "Goto line end", goto_next_buffer, "Goto next buffer", @@ -2912,6 +2917,100 @@ fn goto_prev_diag(cx: &mut Context) { goto_pos(editor, pos); } +fn goto_first_change(cx: &mut Context) { + goto_first_change_impl(cx, false); +} + +fn goto_last_change(cx: &mut Context) { + goto_first_change_impl(cx, true); +} + +fn goto_first_change_impl(cx: &mut Context, reverse: bool) { + let editor = &mut cx.editor; + let (_, doc) = current!(editor); + if let Some(handle) = doc.diff_handle() { + let hunk = { + let hunks = handle.hunks(); + let idx = if reverse { + hunks.len().saturating_sub(1) + } else { + 0 + }; + hunks.nth_hunk(idx) + }; + if hunk != Hunk::NONE { + let pos = doc.text().line_to_char(hunk.after.start as usize); + goto_pos(editor, pos) + } + } +} + +fn goto_next_change(cx: &mut Context) { + goto_next_change_impl(cx, Direction::Forward) +} + +fn goto_prev_change(cx: &mut Context) { + goto_next_change_impl(cx, Direction::Backward) +} + +fn goto_next_change_impl(cx: &mut Context, direction: Direction) { + let count = cx.count() as u32 - 1; + let motion = move |editor: &mut Editor| { + let (view, doc) = current!(editor); + let doc_text = doc.text().slice(..); + let diff_handle = if let Some(diff_handle) = doc.diff_handle() { + diff_handle + } else { + editor.set_status("Diff is not available in current buffer"); + return; + }; + + let selection = doc.selection(view.id).clone().transform(|range| { + let cursor_line = range.cursor_line(doc_text) as u32; + + let hunks = diff_handle.hunks(); + let hunk_idx = match direction { + Direction::Forward => hunks + .next_hunk(cursor_line) + .map(|idx| (idx + count).min(hunks.len() - 1)), + Direction::Backward => hunks + .prev_hunk(cursor_line) + .map(|idx| idx.saturating_sub(count)), + }; + // TODO refactor with let..else once MSRV reaches 1.65 + let hunk_idx = if let Some(hunk_idx) = hunk_idx { + hunk_idx + } else { + return range; + }; + let hunk = hunks.nth_hunk(hunk_idx); + + let hunk_start = doc_text.line_to_char(hunk.after.start as usize); + let hunk_end = if hunk.after.is_empty() { + hunk_start + 1 + } else { + doc_text.line_to_char(hunk.after.end as usize) + }; + let new_range = Range::new(hunk_start, hunk_end); + if editor.mode == Mode::Select { + let head = if new_range.head < range.anchor { + new_range.anchor + } else { + new_range.head + }; + + Range::new(range.anchor, head) + } else { + new_range.with_direction(direction) + } + }); + + doc.set_selection(view.id, selection) + }; + motion(cx.editor); + cx.editor.last_motion = Some(Motion(Box::new(motion))); +} + pub mod insert { use super::*; pub type Hook = fn(&Rope, &Selection, char) -> Option; @@ -4515,6 +4614,27 @@ fn select_textobject(cx: &mut Context, objtype: textobject::TextObject) { ) }; + if ch == 'g' && doc.diff_handle().is_none() { + editor.set_status("Diff is not available in current buffer"); + return; + } + + let textobject_change = |range: Range| -> Range { + let diff_handle = doc.diff_handle().unwrap(); + let hunks = diff_handle.hunks(); + let line = range.cursor_line(text); + let hunk_idx = if let Some(hunk_idx) = hunks.hunk_at(line as u32, false) { + hunk_idx + } else { + return range; + }; + let hunk = hunks.nth_hunk(hunk_idx).after; + + let start = text.line_to_char(hunk.start as usize); + let end = text.line_to_char(hunk.end as usize); + Range::new(start, end).with_direction(range.direction()) + }; + let selection = doc.selection(view.id).clone().transform(|range| { match ch { 'w' => textobject::textobject_word(text, range, objtype, count, false), @@ -4528,6 +4648,7 @@ fn select_textobject(cx: &mut Context, objtype: textobject::TextObject) { 'm' => textobject::textobject_pair_surround_closest( text, range, objtype, count, ), + 'g' => textobject_change(range), // TODO: cancel new ranges if inconsistent surround matches across lines ch if !ch.is_ascii_alphanumeric() => { textobject::textobject_pair_surround(text, range, objtype, ch, count) diff --git a/helix-term/src/keymap/default.rs b/helix-term/src/keymap/default.rs index b6d9ea1088c2..ebcd125aa129 100644 --- a/helix-term/src/keymap/default.rs +++ b/helix-term/src/keymap/default.rs @@ -100,6 +100,8 @@ pub fn default() -> HashMap { "[" => { "Left bracket" "d" => goto_prev_diag, "D" => goto_first_diag, + "g" => goto_prev_change, + "G" => goto_first_change, "f" => goto_prev_function, "t" => goto_prev_class, "a" => goto_prev_parameter, @@ -111,6 +113,8 @@ pub fn default() -> HashMap { "]" => { "Right bracket" "d" => goto_next_diag, "D" => goto_last_diag, + "g" => goto_next_change, + "G" => goto_last_change, "f" => goto_next_function, "t" => goto_next_class, "a" => goto_next_parameter, diff --git a/helix-vcs/src/diff.rs b/helix-vcs/src/diff.rs index b1acd1f29937..9c6a362f7db8 100644 --- a/helix-vcs/src/diff.rs +++ b/helix-vcs/src/diff.rs @@ -195,4 +195,85 @@ impl FileHunks<'_> { pub fn is_empty(&self) -> bool { self.len() == 0 } + + pub fn next_hunk(&self, line: u32) -> Option { + let hunk_range = if self.inverted { + |hunk: &Hunk| hunk.before.clone() + } else { + |hunk: &Hunk| hunk.after.clone() + }; + + let res = self + .hunks + .binary_search_by_key(&line, |hunk| hunk_range(hunk).start); + + match res { + // Search found a hunk that starts exactly at this line, return the next hunk if it exists. + Ok(pos) if pos + 1 == self.hunks.len() => None, + Ok(pos) => Some(pos as u32 + 1), + + // No hunk starts exactly at this line, so the search returns + // the position where a hunk starting at this line should be inserted. + // That position is exactly the position of the next hunk or the end + // of the list if no such hunk exists + Err(pos) if pos == self.hunks.len() => None, + Err(pos) => Some(pos as u32), + } + } + + pub fn prev_hunk(&self, line: u32) -> Option { + let hunk_range = if self.inverted { + |hunk: &Hunk| hunk.before.clone() + } else { + |hunk: &Hunk| hunk.after.clone() + }; + let res = self + .hunks + .binary_search_by_key(&line, |hunk| hunk_range(hunk).end); + + match res { + // Search found a hunk that ends exactly at this line (so it does not include the current line). + // We can usually just return that hunk, however a special case for empty hunk is necessary + // which represents a pure removal. + // Removals are technically empty but are still shown as single line hunks + // and as such we must jump to the previous hunk (if it exists) if we are already inside the removal + Ok(pos) if !hunk_range(&self.hunks[pos]).is_empty() => Some(pos as u32), + + // No hunk ends exactly at this line, so the search returns + // the position where a hunk ending at this line should be inserted. + // That position before this one is exactly the position of the previous hunk + Err(0) | Ok(0) => None, + Err(pos) | Ok(pos) => Some(pos as u32 - 1), + } + } + + pub fn hunk_at(&self, line: u32, include_removal: bool) -> Option { + let hunk_range = if self.inverted { + |hunk: &Hunk| hunk.before.clone() + } else { + |hunk: &Hunk| hunk.after.clone() + }; + + let res = self + .hunks + .binary_search_by_key(&line, |hunk| hunk_range(hunk).start); + + match res { + // Search found a hunk that starts exactly at this line, return it + Ok(pos) => Some(pos as u32), + + // No hunk starts exactly at this line, so the search returns + // the position where a hunk starting at this line should be inserted. + // The previous hunk contains this hunk if it exists and doesn't end before this line + Err(0) => None, + Err(pos) => { + let hunk = hunk_range(&self.hunks[pos - 1]); + if hunk.end > line || include_removal && hunk.start == line && hunk.is_empty() { + Some(pos as u32 - 1) + } else { + None + } + } + } + } } From e9d43c284bb717e3de5aec7312d985a088ede7ea Mon Sep 17 00:00:00 2001 From: Kristoffer Flottorp <2630397+krfl@users.noreply.github.com> Date: Wed, 7 Dec 2022 02:08:34 +0100 Subject: [PATCH 208/491] Fleetish theme renamed to fleet dark and adjusted to match official theme. (#4997) * remove fleetish.toml * add fleet_dark.toml * adjust colors for tags and markup lists * Add type.enum.variant * correct color for focused elements * adjust builtins and keywords Co-authored-by: krfl --- .../themes/{fleetish.toml => fleet_dark.toml} | 93 ++++++++++--------- 1 file changed, 51 insertions(+), 42 deletions(-) rename runtime/themes/{fleetish.toml => fleet_dark.toml} (52%) diff --git a/runtime/themes/fleetish.toml b/runtime/themes/fleet_dark.toml similarity index 52% rename from runtime/themes/fleetish.toml rename to runtime/themes/fleet_dark.toml index 159daf8785d0..f885e4eb6542 100644 --- a/runtime/themes/fleetish.toml +++ b/runtime/themes/fleet_dark.toml @@ -1,8 +1,13 @@ -# Author: Kristoffer Flottorp -# A take on the JetBrains Fleet theme sprinkled with some creative freedom +# Fleet Dark +# A take on the JetBrains Fleet theme. Feel free to contribute +# Original author: @krfl +# Contributors: +# @matoous + +"attribute" = "green" "type" = "light_blue" -"type.builtin" = "orange" +"type.enum.variant" = "purple" "constructor" = "yellow" "constant" = "cyan" # "constant.builtin" = {} # .boolean @@ -16,55 +21,55 @@ "comment" = "light_gray" # .line # "comment.block" = {} # .documentation "variable" = "light" # .builtin +"variable.builtin" = { fg = "red", modifiers = ["underlined"] } "variable.parameter" = "light" # "variable.other" = {} # .member -"variable.other.member" = "yellow" +"variable.other.member" = "purple" "label" = "yellow" "punctuation" = "light" # .delimiter / .bracket "keyword" = "cyan" # .operator / .directive / .function -"keyword.control" = "yellow" # .conditional / .repeat / .import / .return / .exception +# "keyword.control" = "cyan" # .conditional / .repeat / .import / .return / .exception +"keyword.control.exception" = "purple" "operator" = "light" "function" = "yellow" "function.macro" = "green" "function.builtin" = "green" "function.special" = "green" "function.method" = "light" -"tag" = "green" +#"function.declaration.method" = { fg = "lightest", modifiers = ["bold"] } #depends on #4892 +"tag" = "light_blue" "special" = "green" "namespace" = "light" # used in theming +# "markup" = {} # .normal / .quote / .raw # "markup.normal" = {} # .completion / .hover -# "markup.raw.inline" = {} # .completion / .hover -"markup" = "purple" # .quote -"markup.bold" = { fg = "purple", modifiers = ["bold"] } -"markup.italic" = { fg = "purple", modifiers = ["italic"] } -"markup.heading" = "light" # .marker -"markup.heading.1" = "yellow" -"markup.heading.2" = "green" -"markup.heading.3" = "pink" -"markup.heading.4" = "purple" -"markup.heading.5" = "cyan" -"markup.heading.6" = "light_blue" -"markup.list" = "cyan" # .unnumbered / .numbered -"markup.link" = "green" -"markup.link.url" = "pink" +"markup.bold" = { fg = "lightest", modifiers = ["bold"] } +"markup.italic" = { modifiers = ["italic"] } +"markup.heading" = { fg = "cyan", modifiers = ["bold"] } # .marker / .1 / .2 / .3 / .4 / .5 / .6 +"markup.list" = "pink" # .unnumbered / .numbered +"markup.list.numbered" = "cyan" +"markup.list.unnumbered" = "cyan" +# "markup.link" = "green" +"markup.link.url" = { fg = "pink", modifiers = ['italic', 'underlined'] } "markup.link.text" = "cyan" -"markup.link.label" = "yellow" -"markup.raw" = "pink" # .inline -"markup.raw.block" = "orange" +"markup.link.label" = "purple" +"markup.quote" = "pink" +"markup.raw" = "pink" +"markup.raw.inline" = "cyan" # .completion / .hover +"markup.raw.block" = "pink" -"diff.plus" = "cyan" -"diff.minus" = "yellow" -"diff.delta" = "purple" +"diff.plus" = "diff_plus" +"diff.minus" = "red_accent" +"diff.delta" = "blue_accent" # ui specific -"ui.background" = { bg = "#0d0d0d" } # .separator +"ui.background" = { bg = "background" } # .separator "ui.cursor" = { bg = "dark_gray", modifiers = ["reversed"] } # .insert / .select / .match / .primary -"ui.cursor.match" = { fg = "light", bg = "blue_accent" } # .insert / .select / .match / .primary +"ui.cursor.match" = { fg = "light", bg = "selection" } # .insert / .select / .match / .primary "ui.cursorline" = { bg = "darker" } "ui.linenr" = "dark_gray" -"ui.linenr.selected" = { fg = "light_gray", bg = "darker" } +"ui.linenr.selected" = { fg = "light", bg = "darker" } "ui.statusline" = { fg = "light", bg = "darker" } # .inactive / .normal / .insert / .select "ui.statusline.inactive" = { fg = "dark", bg = "darker" } "ui.statusline.normal" = { fg = "lightest", bg = "darker"} @@ -74,27 +79,28 @@ "ui.window" = { fg = "dark", bg = "darkest" } "ui.help" = { fg = "light", bg = "darkest" } "ui.text" = "light" # .focus / .info +"ui.text.focus" = { fg = "lightest", bg = "focus" } "ui.virtual" = "dark" # .whitespace "ui.virtual.ruler" = { bg = "darker"} -"ui.menu" = { fg = "light", bg = "darker" } # .selected -"ui.menu.selected" = { fg = "lightest", bg = "blue_accent" } # .selected +"ui.menu" = { fg = "light", bg = "darkest" } # .selected +"ui.menu.selected" = { fg = "lightest", bg = "focus" } # .selected "ui.selection" = { bg = "darker" } # .primary -"ui.selection.primary" = { bg = "select" } # .primary +"ui.selection.primary" = { bg = "selection" } "hint" = "blue" "info" = "yellow_accent" "warning" = "orange_accent" -"error" = "red" +"error" = "red_error" "diagnostic" = { modifiers = [] } -"diagnostic.hint" = { underline = { color = "light", style = "curl" } } -"diagnostic.info" = { underline = { color = "blue", style = "curl" } } -"diagnostic.warning" = { underline = { color = "yellow", style = "curl" } } -"diagnostic.error" = { underline = { color = "red", style = "curl" } } +"diagnostic.hint" = { underline = { color = "light", style = "line" } } +"diagnostic.info" = { underline = { color = "blue_accent", style = "line" } } +"diagnostic.warning" = { underline = { color = "yellow_accent", style = "line" } } +"diagnostic.error" = { underline = { color = "red_error", style = "line" } } [palette] +background = "#181818" darkest = "#1e1e1e" -darker = "#262626" +darker = "#292929" dark = "#898989" -select = "#102f5b" light = "#d6d6dd" lightest = "#ffffff" @@ -109,13 +115,16 @@ green = "#afcb85" cyan = "#78d0bd" orange = "#efb080" yellow = "#e5c995" -red = "#f44747" +red = "#CC7C8A" blue_accent = "#2197F3" pink_accent = "#E44C7A" green_accent = "#00AF99" orange_accent = "#EE7F25" yellow_accent = "#DEA407" +red_accent = "#F44747" -# variables intended for future updates -checkmark = "#44B254" +red_error = "#EB5F6A" +selection = "#1F3661" +diff_plus = "#5A9F81" +focus = "#204474" From d3f670c0e2d8800bfeacb76a5b96753ac6529170 Mon Sep 17 00:00:00 2001 From: Jonathan LEI Date: Wed, 7 Dec 2022 10:11:45 +0800 Subject: [PATCH 209/491] Use OSC 52 for tmux copy (#5027) --- helix-view/src/clipboard.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helix-view/src/clipboard.rs b/helix-view/src/clipboard.rs index 19fade69c7b6..4f83fb4dc693 100644 --- a/helix-view/src/clipboard.rs +++ b/helix-view/src/clipboard.rs @@ -136,7 +136,7 @@ pub fn get_clipboard_provider() -> Box { } else if env_var_is_set("TMUX") && binary_exists("tmux") { command_provider! { paste => "tmux", "save-buffer", "-"; - copy => "tmux", "load-buffer", "-"; + copy => "tmux", "load-buffer", "-w", "-"; } } else { Box::new(provider::FallbackProvider::new()) From 96ff64a84a4948b0aa85a453276cb0091fb9c792 Mon Sep 17 00:00:00 2001 From: Michael Davis Date: Tue, 6 Dec 2022 20:54:50 -0600 Subject: [PATCH 210/491] Add changelog notes for 22.12 (#4822) * Add changelog notes for 22.12 * Bump VERSION to 22.12 --- CHANGELOG.md | 286 +++++++++++++++++++++++++++++++++++++++++++++++++++ VERSION | 2 +- 2 files changed, 287 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 56d85751b940..dc91c9ff33a0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,289 @@ +# 22.12 (2022-12-06) + +This is a great big release filled with changes from a 99 contributors. A big _thank you_ to you all! + +As usual, the following is a summary of each of the changes since the last release. +For the full log, check out the [git log](https://github.com/helix-editor/helix/compare/22.08.1..22.12). + +Breaking changes: + +- Remove readline-like navigation bindings from the default insert mode keymap ([e12690e](https://github.com/helix-editor/helix/commit/e12690e), [#3811](https://github.com/helix-editor/helix/pull/3811), [#3827](https://github.com/helix-editor/helix/pull/3827), [#3915](https://github.com/helix-editor/helix/pull/3915), [#4088](https://github.com/helix-editor/helix/pull/4088)) +- Rename `append_to_line` as `insert_at_line_end` and `prepend_to_line` as `insert_at_line_start` ([#3753](https://github.com/helix-editor/helix/pull/3753)) +- Swap diagnostic picker and debug mode bindings in the space keymap ([#4229](https://github.com/helix-editor/helix/pull/4229)) +- Select newly inserted text on paste or from shell commands ([#4458](https://github.com/helix-editor/helix/pull/4458), [#4608](https://github.com/helix-editor/helix/pull/4608), [#4619](https://github.com/helix-editor/helix/pull/4619), [#4824](https://github.com/helix-editor/helix/pull/4824)) +- Select newly inserted surrounding characters on `ms` ([#4752](https://github.com/helix-editor/helix/pull/4752)) +- Exit select-mode after executing `replace_*` commands ([#4554](https://github.com/helix-editor/helix/pull/4554)) +- Exit select-mode after executing surround commands ([#4858](https://github.com/helix-editor/helix/pull/4858)) +- Change tree-sitter text-object keys ([#3782](https://github.com/helix-editor/helix/pull/3782)) +- Rename `fleetish` theme to `fleet_dark` ([#4997](https://github.com/helix-editor/helix/pull/4997)) + +Features: + +- Bufferline ([#2759](https://github.com/helix-editor/helix/pull/2759)) +- Support underline styles and colors ([#4061](https://github.com/helix-editor/helix/pull/4061), [98c121c](https://github.com/helix-editor/helix/commit/98c121c)) +- Inheritance for themes ([#3067](https://github.com/helix-editor/helix/pull/3067), [#4096](https://github.com/helix-editor/helix/pull/4096)) +- Cursorcolumn ([#4084](https://github.com/helix-editor/helix/pull/4084)) +- Overhauled system for writing files and quiting ([#2267](https://github.com/helix-editor/helix/pull/2267), [#4397](https://github.com/helix-editor/helix/pull/4397)) +- Autosave when terminal loses focus ([#3178](https://github.com/helix-editor/helix/pull/3178)) +- Use OSC52 as a fallback for the system clipboard ([#3220](https://github.com/helix-editor/helix/pull/3220)) +- Show git diffs in the gutter ([#3890](https://github.com/helix-editor/helix/pull/3890), [#5012](https://github.com/helix-editor/helix/pull/5012), [#4995](https://github.com/helix-editor/helix/pull/4995)) +- Add a logo ([dc1ec56](https://github.com/helix-editor/helix/commit/dc1ec56)) +- Multi-cursor completion ([#4496](https://github.com/helix-editor/helix/pull/4496)) + +Commands: + +- `file_picker_in_current_directory` (`F`) ([#3701](https://github.com/helix-editor/helix/pull/3701)) +- `:lsp-restart` to restart the current document's language server ([#3435](https://github.com/helix-editor/helix/pull/3435), [#3972](https://github.com/helix-editor/helix/pull/3972)) +- `join_selections_space` (`A-j`) which joins selections and selects the joining whitespace ([#3549](https://github.com/helix-editor/helix/pull/3549)) +- `:update` to write the current file if it is modified ([#4426](https://github.com/helix-editor/helix/pull/4426)) +- `:lsp-workspace-command` for picking LSP commands to execute ([#3140](https://github.com/helix-editor/helix/pull/3140)) +- `extend_prev_word_end` - the extend variant for `move_prev_word_end` ([7468fa2](https://github.com/helix-editor/helix/commit/7468fa2)) +- `make_search_word_bounded` which adds regex word boundaries to the current search register value ([#4322](https://github.com/helix-editor/helix/pull/4322)) +- `:reload-all` - `:reload` for all open buffers ([#4663](https://github.com/helix-editor/helix/pull/4663), [#4901](https://github.com/helix-editor/helix/pull/4901)) +- `goto_next_change` (`]g`), `goto_prev_change` (`[g`), `goto_first_change` (`[G`), `goto_last_change` (`]G`) textobjects for jumping between VCS changes ([#4650](https://github.com/helix-editor/helix/pull/4650)) + +Usability improvements and fixes: + +- Don't log 'LSP not defined' errors in the logfile ([1caba2d](https://github.com/helix-editor/helix/commit/1caba2d)) +- Look for the external formatter program before invoking it ([#3670](https://github.com/helix-editor/helix/pull/3670)) +- Don't send LSP didOpen events for documents without URLs ([44b4479](https://github.com/helix-editor/helix/commit/44b4479)) +- Fix off-by-one in `extend_line_above` command ([#3689](https://github.com/helix-editor/helix/pull/3689)) +- Use the original scroll offset when opening a split ([1acdfaa](https://github.com/helix-editor/helix/commit/1acdfaa)) +- Handle auto-formatting failures and save the file anyway ([#3684](https://github.com/helix-editor/helix/pull/3684)) +- Ensure the cursor is in view after `:reflow` ([#3733](https://github.com/helix-editor/helix/pull/3733)) +- Add default rulers and reflow config for git commit messages ([#3738](https://github.com/helix-editor/helix/pull/3738)) +- Improve grammar fetching and building output ([#3773](https://github.com/helix-editor/helix/pull/3773)) +- Add a `text` language to language completion ([cc47d3f](https://github.com/helix-editor/helix/commit/cc47d3f)) +- Improve error handling for `:set-language` ([e8add6f](https://github.com/helix-editor/helix/commit/e8add6f)) +- Improve error handling for `:config-reload` ([#3668](https://github.com/helix-editor/helix/pull/3668)) +- Improve error handling when passing improper ranges to syntax highlighting ([#3826](https://github.com/helix-editor/helix/pull/3826)) +- Render `` tags as raw markup in markdown ([#3425](https://github.com/helix-editor/helix/pull/3425)) +- Remove border around the LSP code-actions popup ([#3444](https://github.com/helix-editor/helix/pull/3444)) +- Canonicalize the path to the runtime directory ([#3794](https://github.com/helix-editor/helix/pull/3794)) +- Add a `themelint` xtask for linting themes ([#3234](https://github.com/helix-editor/helix/pull/3234)) +- Re-sort LSP diagnostics after applying transactions ([#3895](https://github.com/helix-editor/helix/pull/3895), [#4319](https://github.com/helix-editor/helix/pull/4319)) +- Add a command-line flag to specify the log file ([#3807](https://github.com/helix-editor/helix/pull/3807)) +- Track source and tag information in LSP diagnostics ([#3898](https://github.com/helix-editor/helix/pull/3898), [1df32c9](https://github.com/helix-editor/helix/commit/1df32c9)) +- Fix theme returning to normal when exiting the `:theme` completion ([#3644](https://github.com/helix-editor/helix/pull/3644)) +- Improve error messages for invalid commands in the keymap ([#3931](https://github.com/helix-editor/helix/pull/3931)) +- Deduplicate regexs in `search_selection` command ([#3941](https://github.com/helix-editor/helix/pull/3941)) +- Split the finding of LSP root and config roots ([#3929](https://github.com/helix-editor/helix/pull/3929)) +- Ensure that the cursor is within view after auto-formatting ([#4047](https://github.com/helix-editor/helix/pull/4047)) +- Add pseudo-pending to commands with on-next-key callbacks ([#4062](https://github.com/helix-editor/helix/pull/4062), [#4077](https://github.com/helix-editor/helix/pull/4077)) +- Add live preview to `:goto` ([#2982](https://github.com/helix-editor/helix/pull/2982)) +- Show regex compilation failure in a popup ([#3049](https://github.com/helix-editor/helix/pull/3049)) +- Add 'cycled to end' and 'no more matches' for search ([#3176](https://github.com/helix-editor/helix/pull/3176), [#4101](https://github.com/helix-editor/helix/pull/4101)) +- Add extending behavior to tree-sitter textobjects ([#3266](https://github.com/helix-editor/helix/pull/3266)) +- Add `ui.gutter.selected` option for themes ([#3303](https://github.com/helix-editor/helix/pull/3303)) +- Make statusline mode names configurable ([#3311](https://github.com/helix-editor/helix/pull/3311)) +- Add a statusline element for total line count ([#3960](https://github.com/helix-editor/helix/pull/3960)) +- Add extending behavior to `goto_window_*` commands ([#3985](https://github.com/helix-editor/helix/pull/3985)) +- Fix a panic in signature help when the preview is too large ([#4030](https://github.com/helix-editor/helix/pull/4030)) +- Add command names to the command palette ([#4071](https://github.com/helix-editor/helix/pull/4071), [#4223](https://github.com/helix-editor/helix/pull/4223), [#4495](https://github.com/helix-editor/helix/pull/4495)) +- Find the LSP workspace root from the current document's path ([#3553](https://github.com/helix-editor/helix/pull/3553)) +- Add an option to skip indent-guide levels ([#3819](https://github.com/helix-editor/helix/pull/3819), [2c36e33](https://github.com/helix-editor/helix/commit/2c36e33)) +- Change focus to modified docs on quit ([#3872](https://github.com/helix-editor/helix/pull/3872)) +- Respond to `USR1` signal by reloading config ([#3952](https://github.com/helix-editor/helix/pull/3952)) +- Exit gracefully when the close operation fails ([#4081](https://github.com/helix-editor/helix/pull/4081)) +- Fix goto/view center mismatch ([#4135](https://github.com/helix-editor/helix/pull/4135)) +- Highlight the current file picker document on idle-timeout ([#3172](https://github.com/helix-editor/helix/pull/3172), [a85e386](https://github.com/helix-editor/helix/commit/a85e386)) +- Apply transactions to jumplist selections ([#4186](https://github.com/helix-editor/helix/pull/4186), [#4227](https://github.com/helix-editor/helix/pull/4227), [#4733](https://github.com/helix-editor/helix/pull/4733), [#4865](https://github.com/helix-editor/helix/pull/4865), [#4912](https://github.com/helix-editor/helix/pull/4912), [#4965](https://github.com/helix-editor/helix/pull/4965), [#4981](https://github.com/helix-editor/helix/pull/4981)) +- Use space as a separator for fuzzy matcher ([#3969](https://github.com/helix-editor/helix/pull/3969)) +- Overlay all diagnostics with highest severity on top ([#4113](https://github.com/helix-editor/helix/pull/4113)) +- Avoid re-parsing unmodified tree-sitter injections ([#4146](https://github.com/helix-editor/helix/pull/4146)) +- Add extending captures for indentation, re-enable python indentation ([#3382](https://github.com/helix-editor/helix/pull/3382), [3e84434](https://github.com/helix-editor/helix/commit/3e84434)) +- Only allow either `--vsplit` or `--hsplit` CLI flags at once ([#4202](https://github.com/helix-editor/helix/pull/4202)) +- Fix append cursor location when selection anchor is at the end of the document ([#4147](https://github.com/helix-editor/helix/pull/4147)) +- Improve selection yanking message ([#4275](https://github.com/helix-editor/helix/pull/4275)) +- Log failures to load tree-sitter grammars as errors ([#4315](https://github.com/helix-editor/helix/pull/4315)) +- Fix rendering of lines longer than 65,536 columns ([#4172](https://github.com/helix-editor/helix/pull/4172)) +- Skip searching `.git` in `global_search` ([#4334](https://github.com/helix-editor/helix/pull/4334)) +- Display tree-sitter scopes in a popup ([#4337](https://github.com/helix-editor/helix/pull/4337)) +- Fix deleting a word from the end of the buffer ([#4328](https://github.com/helix-editor/helix/pull/4328)) +- Pretty print the syntax tree in `:tree-sitter-subtree` ([#4295](https://github.com/helix-editor/helix/pull/4295), [#4606](https://github.com/helix-editor/helix/pull/4606)) +- Allow specifying suffixes for file-type detection ([#2455](https://github.com/helix-editor/helix/pull/2455), [#4414](https://github.com/helix-editor/helix/pull/4414)) +- Fix multi-byte auto-pairs ([#4024](https://github.com/helix-editor/helix/pull/4024)) +- Improve sort scoring for LSP code-actions and completions ([#4134](https://github.com/helix-editor/helix/pull/4134)) +- Fix the handling of quotes within shellwords ([#4098](https://github.com/helix-editor/helix/pull/4098)) +- Fix `delete_word_backward` and `delete_word_forward` on newlines ([#4392](https://github.com/helix-editor/helix/pull/4392)) +- Fix 'no entry found for key' crash on `:write-all` ([#4384](https://github.com/helix-editor/helix/pull/4384)) +- Remove lowercase requirement for tree-sitter grammars ([#4346](https://github.com/helix-editor/helix/pull/4346)) +- Resolve LSP completion items on idle-timeout ([#4406](https://github.com/helix-editor/helix/pull/4406), [#4797](https://github.com/helix-editor/helix/pull/4797)) +- Render diagnostics in the file picker preview ([#4324](https://github.com/helix-editor/helix/pull/4324)) +- Fix terminal freezing on `shell_insert_output` ([#4156](https://github.com/helix-editor/helix/pull/4156)) +- Allow use of the count in the repeat operator (`.`) ([#4450](https://github.com/helix-editor/helix/pull/4450)) +- Show the current theme name on `:theme` with no arguments ([#3740](https://github.com/helix-editor/helix/pull/3740)) +- Fix rendering in very large terminals ([#4318](https://github.com/helix-editor/helix/pull/4318)) +- Sort LSP preselected items to the top of the completion menu ([#4480](https://github.com/helix-editor/helix/pull/4480)) +- Trim braces and quotes from paths in goto-file ([#4370](https://github.com/helix-editor/helix/pull/4370)) +- Prevent automatic signature help outside of insert mode ([#4456](https://github.com/helix-editor/helix/pull/4456)) +- Fix freezes with external programs that process stdin and stdout concurrently ([#4180](https://github.com/helix-editor/helix/pull/4180)) +- Make `scroll` aware of tabs and wide characters ([#4519](https://github.com/helix-editor/helix/pull/4519)) +- Correctly handle escaping in `command_mode` completion ([#4316](https://github.com/helix-editor/helix/pull/4316), [#4587](https://github.com/helix-editor/helix/pull/4587), [#4632](https://github.com/helix-editor/helix/pull/4632)) +- Fix `delete_char_backward` for paired characters ([#4558](https://github.com/helix-editor/helix/pull/4558)) +- Fix crash from two windows editing the same document ([#4570](https://github.com/helix-editor/helix/pull/4570)) +- Fix pasting from the blackhole register ([#4497](https://github.com/helix-editor/helix/pull/4497)) +- Support LSP insertReplace completion items ([1312682](https://github.com/helix-editor/helix/commit/1312682)) +- Dynamically resize the line number gutter width ([#3469](https://github.com/helix-editor/helix/pull/3469)) +- Fix crash for unknown completion item kinds ([#4658](https://github.com/helix-editor/helix/pull/4658)) +- Re-enable `format_selections` for single selection ranges ([d4f5cab](https://github.com/helix-editor/helix/commit/d4f5cab)) +- Limit the number of in-progress tree-sitter query matches ([#4707](https://github.com/helix-editor/helix/pull/4707), [#4830](https://github.com/helix-editor/helix/pull/4830)) +- Use the special `#` register with `increment`/`decrement` to change by range number ([#4418](https://github.com/helix-editor/helix/pull/4418)) +- Add a statusline element to show number of selected chars ([#4682](https://github.com/helix-editor/helix/pull/4682)) +- Add a statusline element showing global LSP diagnostic warning and error counts ([#4569](https://github.com/helix-editor/helix/pull/4569)) +- Add a scrollbar to popups ([#4449](https://github.com/helix-editor/helix/pull/4449)) +- Prefer shorter matches in fuzzy matcher scoring ([#4698](https://github.com/helix-editor/helix/pull/4698)) +- Use key-sequence format for command palette keybinds ([#4712](https://github.com/helix-editor/helix/pull/4712)) +- Remove prefix filtering from autocompletion menu ([#4578](https://github.com/helix-editor/helix/pull/4578)) +- Focus on the parent buffer when closing a split ([#4766](https://github.com/helix-editor/helix/pull/4766)) +- Handle language server termination ([#4797](https://github.com/helix-editor/helix/pull/4797), [#4852](https://github.com/helix-editor/helix/pull/4852)) +- Allow `r`/`t`/`f` to work on tab characters ([#4817](https://github.com/helix-editor/helix/pull/4817)) +- Show a preview for scratch buffers in the buffer picker ([#3454](https://github.com/helix-editor/helix/pull/3454)) +- Set a limit of entries in the jumplist ([#4750](https://github.com/helix-editor/helix/pull/4750)) +- Re-use shell outputs when inserting or appending shell output ([#3465](https://github.com/helix-editor/helix/pull/3465)) +- Check LSP server provider capabilities ([#3554](https://github.com/helix-editor/helix/pull/3554)) +- Improve tree-sitter parsing performance on files with many language layers ([#4716](https://github.com/helix-editor/helix/pull/4716)) +- Move indentation to the next line when using `` on a line with only whitespace ([#4854](https://github.com/helix-editor/helix/pull/4854)) +- Remove selections for closed views from all documents ([#4888](https://github.com/helix-editor/helix/pull/4888)) +- Improve performance of the `:reload` command ([#4457](https://github.com/helix-editor/helix/pull/4457)) +- Properly handle media keys ([#4887](https://github.com/helix-editor/helix/pull/4887)) +- Support LSP diagnostic data field ([#4935](https://github.com/helix-editor/helix/pull/4935)) +- Handle C-i keycode as tab ([#4961](https://github.com/helix-editor/helix/pull/4961)) +- Fix view alignment for jumplist picker jumps ([#3743](https://github.com/helix-editor/helix/pull/3743)) +- Use OSC52 for tmux clipboard provider ([#5027](https://github.com/helix-editor/helix/pull/5027)) + +Themes: + +- Add `varua` ([#3610](https://github.com/helix-editor/helix/pull/3610), [#4964](https://github.com/helix-editor/helix/pull/4964)) +- Update `boo_berry` ([#3653](https://github.com/helix-editor/helix/pull/3653)) +- Add `rasmus` ([#3728](https://github.com/helix-editor/helix/pull/3728)) +- Add `papercolor_dark` ([#3742](https://github.com/helix-editor/helix/pull/3742)) +- Update `monokai_pro_spectrum` ([#3814](https://github.com/helix-editor/helix/pull/3814)) +- Update `nord` ([#3792](https://github.com/helix-editor/helix/pull/3792)) +- Update `fleetish` ([#3844](https://github.com/helix-editor/helix/pull/3844), [#4487](https://github.com/helix-editor/helix/pull/4487), [#4813](https://github.com/helix-editor/helix/pull/4813)) +- Update `flatwhite` ([#3843](https://github.com/helix-editor/helix/pull/3843)) +- Add `darcula` ([#3739](https://github.com/helix-editor/helix/pull/3739)) +- Update `papercolor` ([#3938](https://github.com/helix-editor/helix/pull/3938), [#4317](https://github.com/helix-editor/helix/pull/4317)) +- Add bufferline colors to multiple themes ([#3881](https://github.com/helix-editor/helix/pull/3881)) +- Add `gruvbox_dark_hard` ([#3948](https://github.com/helix-editor/helix/pull/3948)) +- Add `onedarker` ([#3980](https://github.com/helix-editor/helix/pull/3980), [#4060](https://github.com/helix-editor/helix/pull/4060)) +- Add `dark_high_contrast` ([#3312](https://github.com/helix-editor/helix/pull/3312)) +- Update `bogster` ([#4121](https://github.com/helix-editor/helix/pull/4121), [#4264](https://github.com/helix-editor/helix/pull/4264)) +- Update `sonokai` ([#4089](https://github.com/helix-editor/helix/pull/4089)) +- Update `ayu_*` themes ([#4140](https://github.com/helix-editor/helix/pull/4140), [#4109](https://github.com/helix-editor/helix/pull/4109), [#4662](https://github.com/helix-editor/helix/pull/4662), [#4764](https://github.com/helix-editor/helix/pull/4764)) +- Update `everforest` ([#3998](https://github.com/helix-editor/helix/pull/3998)) +- Update `monokai_pro_octagon` ([#4247](https://github.com/helix-editor/helix/pull/4247)) +- Add `heisenberg` ([#4209](https://github.com/helix-editor/helix/pull/4209)) +- Add `bogster_light` ([#4265](https://github.com/helix-editor/helix/pull/4265)) +- Update `pop-dark` ([#4323](https://github.com/helix-editor/helix/pull/4323)) +- Update `rose_pine` ([#4221](https://github.com/helix-editor/helix/pull/4221)) +- Add `kanagawa` ([#4300](https://github.com/helix-editor/helix/pull/4300)) +- Add `hex_steel`, `hex_toxic` and `hex_lavendar` ([#4367](https://github.com/helix-editor/helix/pull/4367), [#4990](https://github.com/helix-editor/helix/pull/4990)) +- Update `tokyonight` and `tokyonight_storm` ([#4415](https://github.com/helix-editor/helix/pull/4415)) +- Update `gruvbox` ([#4626](https://github.com/helix-editor/helix/pull/4626)) +- Update `dark_plus` ([#4661](https://github.com/helix-editor/helix/pull/4661), [#4678](https://github.com/helix-editor/helix/pull/4678)) +- Add `zenburn` ([#4613](https://github.com/helix-editor/helix/pull/4613), [#4977](https://github.com/helix-editor/helix/pull/4977)) +- Update `monokai_pro` ([#4789](https://github.com/helix-editor/helix/pull/4789)) +- Add `mellow` ([#4770](https://github.com/helix-editor/helix/pull/4770)) +- Add `nightfox` ([#4769](https://github.com/helix-editor/helix/pull/4769), [#4966](https://github.com/helix-editor/helix/pull/4966)) +- Update `doom_acario_dark` ([#4979](https://github.com/helix-editor/helix/pull/4979)) +- Update `autumn` ([#4996](https://github.com/helix-editor/helix/pull/4996)) +- Update `acme` ([#4999](https://github.com/helix-editor/helix/pull/4999)) +- Update `nord_light` ([#4999](https://github.com/helix-editor/helix/pull/4999)) +- Update `serika_*` ([#5015](https://github.com/helix-editor/helix/pull/5015)) + +LSP configurations: + +- Switch to `openscad-lsp` for OpenScad ([#3750](https://github.com/helix-editor/helix/pull/3750)) +- Support Jsonnet ([#3748](https://github.com/helix-editor/helix/pull/3748)) +- Support Markdown ([#3499](https://github.com/helix-editor/helix/pull/3499)) +- Support Bass ([#3771](https://github.com/helix-editor/helix/pull/3771)) +- Set roots configuration for Elixir and HEEx ([#3917](https://github.com/helix-editor/helix/pull/3917), [#3959](https://github.com/helix-editor/helix/pull/3959)) +- Support Purescript ([#4242](https://github.com/helix-editor/helix/pull/4242)) +- Set roots configuration for Julia ([#4361](https://github.com/helix-editor/helix/pull/4361)) +- Support D ([#4372](https://github.com/helix-editor/helix/pull/4372)) +- Increase default language server timeout for Julia ([#4575](https://github.com/helix-editor/helix/pull/4575)) +- Use ElixirLS for HEEx ([#4679](https://github.com/helix-editor/helix/pull/4679)) +- Support Bicep ([#4403](https://github.com/helix-editor/helix/pull/4403)) +- Switch to `nil` for Nix ([433ccef](https://github.com/helix-editor/helix/commit/433ccef)) +- Support QML ([#4842](https://github.com/helix-editor/helix/pull/4842)) +- Enable auto-format for CSS ([#4987](https://github.com/helix-editor/helix/pull/4987)) +- Support CommonLisp ([4176769](https://github.com/helix-editor/helix/commit/4176769)) + +New languages: + +- SML ([#3692](https://github.com/helix-editor/helix/pull/3692)) +- Jsonnet ([#3714](https://github.com/helix-editor/helix/pull/3714)) +- Godot resource ([#3759](https://github.com/helix-editor/helix/pull/3759)) +- Astro ([#3829](https://github.com/helix-editor/helix/pull/3829)) +- SSH config ([#2455](https://github.com/helix-editor/helix/pull/2455), [#4538](https://github.com/helix-editor/helix/pull/4538)) +- Bass ([#3771](https://github.com/helix-editor/helix/pull/3771)) +- WAT (WebAssembly text format) ([#4040](https://github.com/helix-editor/helix/pull/4040), [#4542](https://github.com/helix-editor/helix/pull/4542)) +- Purescript ([#4242](https://github.com/helix-editor/helix/pull/4242)) +- D ([#4372](https://github.com/helix-editor/helix/pull/4372), [#4562](https://github.com/helix-editor/helix/pull/4562)) +- VHS ([#4486](https://github.com/helix-editor/helix/pull/4486)) +- KDL ([#4481](https://github.com/helix-editor/helix/pull/4481)) +- XML ([#4518](https://github.com/helix-editor/helix/pull/4518)) +- WIT ([#4525](https://github.com/helix-editor/helix/pull/4525)) +- ENV ([#4536](https://github.com/helix-editor/helix/pull/4536)) +- INI ([#4538](https://github.com/helix-editor/helix/pull/4538)) +- Bicep ([#4403](https://github.com/helix-editor/helix/pull/4403), [#4751](https://github.com/helix-editor/helix/pull/4751)) +- QML ([#4842](https://github.com/helix-editor/helix/pull/4842)) +- CommonLisp ([4176769](https://github.com/helix-editor/helix/commit/4176769)) + +Updated languages and queries: + +- Zig ([#3621](https://github.com/helix-editor/helix/pull/3621), [#4745](https://github.com/helix-editor/helix/pull/4745)) +- Rust ([#3647](https://github.com/helix-editor/helix/pull/3647), [#3729](https://github.com/helix-editor/helix/pull/3729), [#3927](https://github.com/helix-editor/helix/pull/3927), [#4073](https://github.com/helix-editor/helix/pull/4073), [#4510](https://github.com/helix-editor/helix/pull/4510), [#4659](https://github.com/helix-editor/helix/pull/4659), [#4717](https://github.com/helix-editor/helix/pull/4717)) +- Solidity ([20ed8c2](https://github.com/helix-editor/helix/commit/20ed8c2)) +- Fish ([#3704](https://github.com/helix-editor/helix/pull/3704)) +- Elixir ([#3645](https://github.com/helix-editor/helix/pull/3645), [#4333](https://github.com/helix-editor/helix/pull/4333), [#4821](https://github.com/helix-editor/helix/pull/4821)) +- Diff ([#3708](https://github.com/helix-editor/helix/pull/3708)) +- Nix ([665e27f](https://github.com/helix-editor/helix/commit/665e27f), [1fe3273](https://github.com/helix-editor/helix/commit/1fe3273)) +- Markdown ([#3749](https://github.com/helix-editor/helix/pull/3749), [#4078](https://github.com/helix-editor/helix/pull/4078), [#4483](https://github.com/helix-editor/helix/pull/4483), [#4478](https://github.com/helix-editor/helix/pull/4478)) +- GDScript ([#3760](https://github.com/helix-editor/helix/pull/3760)) +- JSX and TSX ([#3853](https://github.com/helix-editor/helix/pull/3853), [#3973](https://github.com/helix-editor/helix/pull/3973)) +- Ruby ([#3976](https://github.com/helix-editor/helix/pull/3976), [#4601](https://github.com/helix-editor/helix/pull/4601)) +- R ([#4031](https://github.com/helix-editor/helix/pull/4031)) +- WGSL ([#3996](https://github.com/helix-editor/helix/pull/3996), [#4079](https://github.com/helix-editor/helix/pull/4079)) +- C# ([#4118](https://github.com/helix-editor/helix/pull/4118), [#4281](https://github.com/helix-editor/helix/pull/4281), [#4213](https://github.com/helix-editor/helix/pull/4213)) +- Twig ([#4176](https://github.com/helix-editor/helix/pull/4176)) +- Lua ([#3552](https://github.com/helix-editor/helix/pull/3552)) +- C/C++ ([#4079](https://github.com/helix-editor/helix/pull/4079), [#4278](https://github.com/helix-editor/helix/pull/4278), [#4282](https://github.com/helix-editor/helix/pull/4282)) +- Cairo ([17488f1](https://github.com/helix-editor/helix/commit/17488f1), [431f9c1](https://github.com/helix-editor/helix/commit/431f9c1), [09a6df1](https://github.com/helix-editor/helix/commit/09a6df1)) +- Rescript ([#4356](https://github.com/helix-editor/helix/pull/4356)) +- Zig ([#4409](https://github.com/helix-editor/helix/pull/4409)) +- Scala ([#4353](https://github.com/helix-editor/helix/pull/4353), [#4697](https://github.com/helix-editor/helix/pull/4697), [#4701](https://github.com/helix-editor/helix/pull/4701)) +- LaTeX ([#4528](https://github.com/helix-editor/helix/pull/4528), [#4922](https://github.com/helix-editor/helix/pull/4922)) +- SQL ([#4529](https://github.com/helix-editor/helix/pull/4529)) +- Python ([#4560](https://github.com/helix-editor/helix/pull/4560)) +- Bash/Zsh ([#4582](https://github.com/helix-editor/helix/pull/4582)) +- Nu ([#4583](https://github.com/helix-editor/helix/pull/4583)) +- Julia ([#4588](https://github.com/helix-editor/helix/pull/4588)) +- Typescript ([#4703](https://github.com/helix-editor/helix/pull/4703)) +- Meson ([#4572](https://github.com/helix-editor/helix/pull/4572)) +- Haskell ([#4800](https://github.com/helix-editor/helix/pull/4800)) +- CMake ([#4809](https://github.com/helix-editor/helix/pull/4809)) +- HTML ([#4829](https://github.com/helix-editor/helix/pull/4829), [#4881](https://github.com/helix-editor/helix/pull/4881)) +- Java ([#4886](https://github.com/helix-editor/helix/pull/4886)) +- Go ([#4906](https://github.com/helix-editor/helix/pull/4906), [#4969](https://github.com/helix-editor/helix/pull/4969), [#5010](https://github.com/helix-editor/helix/pull/5010)) +- CSS ([#4882](https://github.com/helix-editor/helix/pull/4882)) +- Racket ([#4915](https://github.com/helix-editor/helix/pull/4915)) +- SCSS ([#5003](https://github.com/helix-editor/helix/pull/5003)) + +Packaging: + +- Filter relevant source files in the Nix flake ([#3657](https://github.com/helix-editor/helix/pull/3657)) +- Build a binary for `aarch64-linux` in the release CI ([038a91d](https://github.com/helix-editor/helix/commit/038a91d)) +- Build an AppImage for `aarch64-linux` in the release CI ([b738031](https://github.com/helix-editor/helix/commit/b738031)) +- Enable CI builds for `riscv64-linux` ([#3685](https://github.com/helix-editor/helix/pull/3685)) +- Support preview releases in CI ([0090a2d](https://github.com/helix-editor/helix/commit/0090a2d)) +- Strip binaries built in CI ([#3780](https://github.com/helix-editor/helix/pull/3780)) +- Fix the development shell for the Nix Flake on `aarch64-darwin` ([#3810](https://github.com/helix-editor/helix/pull/3810)) +- Raise the MSRV and create an MSRV policy ([#3896](https://github.com/helix-editor/helix/pull/3896), [#3913](https://github.com/helix-editor/helix/pull/3913), [#3961](https://github.com/helix-editor/helix/pull/3961)) +- Fix Fish completions for `--config` and `--log` flags ([#3912](https://github.com/helix-editor/helix/pull/3912)) +- Use builtin filenames option in Bash completion ([#4648](https://github.com/helix-editor/helix/pull/4648)) + # 22.08.1 (2022-09-01) This is a patch release that fixes a panic caused by closing splits or buffers. ([#3633](https://github.com/helix-editor/helix/pull/3633)) diff --git a/VERSION b/VERSION index b9ed4c22ac55..e70b3aebd5b7 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -22.08.1 \ No newline at end of file +22.12 \ No newline at end of file From 9d4236941d581a1a9ed017db294fd3413a670b84 Mon Sep 17 00:00:00 2001 From: Alexander Brevig Date: Wed, 7 Dec 2022 12:29:56 +0100 Subject: [PATCH 211/491] fix(theme): serika toml syntax valid (#5038) --- runtime/themes/serika-light.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/themes/serika-light.toml b/runtime/themes/serika-light.toml index ad830d92c148..99d4b7f1bbbd 100644 --- a/runtime/themes/serika-light.toml +++ b/runtime/themes/serika-light.toml @@ -59,7 +59,7 @@ "error" = "nasty-red" "diagnostic" = { fg = "nasty-red", modifiers = ["underlined"] } -"diff.plus" = { fg = "bg_green" +"diff.plus" = { fg = "bg_green" } "diff.delta" = { fg = "bg_blue" } "diff.minus" = { fg = "nasty-red" } From a4de86e7afc0da3d847d467a21ff4fb67a51d620 Mon Sep 17 00:00:00 2001 From: Alexander Brevig Date: Wed, 7 Dec 2022 12:30:46 +0100 Subject: [PATCH 212/491] fix(theme): git gutter for flatwhite (#5036) --- runtime/themes/flatwhite.toml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/runtime/themes/flatwhite.toml b/runtime/themes/flatwhite.toml index d4c837b6930a..2fdc66d0fea9 100644 --- a/runtime/themes/flatwhite.toml +++ b/runtime/themes/flatwhite.toml @@ -77,9 +77,9 @@ "ui.popup" = { fg = "base1", bg = "base6" } "ui.window" = { fg = "base1", bg = "base6" } -"diff.plus" = { bg = "diff_add" } -"diff.delta" = { bg = "diff_change" } -"diff.minus" = { bg = "diff_delete" } +"diff.plus" = { fg = "diff_add" } +"diff.delta" = { fg = "diff_change" } +"diff.minus" = { fg = "diff_delete" } [palette] base1 = "#605a52" From f8b75a245a390fc3772d59cafe04ccaaa53c9ca9 Mon Sep 17 00:00:00 2001 From: Jens Getreu Date: Thu, 8 Dec 2022 02:48:01 +0100 Subject: [PATCH 213/491] Autumn theme: use new features (#5051) Co-authored-by: Jens Getreu --- runtime/themes/autumn.toml | 3 +- runtime/themes/autumn_night.toml | 62 +------------------------------- 2 files changed, 3 insertions(+), 62 deletions(-) diff --git a/runtime/themes/autumn.toml b/runtime/themes/autumn.toml index fe80261af294..501675da16ba 100644 --- a/runtime/themes/autumn.toml +++ b/runtime/themes/autumn.toml @@ -58,10 +58,11 @@ "markup.raw" = "my_green" "diff.plus" = "my_green" -"diff.delta" = "my_white" +"diff.delta" = "my_gray4" "diff.minus" = "my_red" "diagnostic" = { modifiers = ["underlined"] } +"diagnostic.error" = { underline = { style = "curl", color = "my_red" } } "ui.gutter" = { bg = "my_gray0" } "hint" = "my_gray5" "debug" = "my_yellow2" diff --git a/runtime/themes/autumn_night.toml b/runtime/themes/autumn_night.toml index d01f5356931e..c26cc777e144 100644 --- a/runtime/themes/autumn_night.toml +++ b/runtime/themes/autumn_night.toml @@ -7,67 +7,7 @@ # Jens Getreu ported and optimised the color theme for the Helix editor. # Author: Jens Getreu -"ui.background" = { bg = "my_gray0" } -"ui.menu" = { fg = "my_white", bg = "my_gray2" } -"ui.menu.selected" = { fg = "my_gray2", bg = "my_gray5" } -"ui.linenr" = { fg = "my_gray3", bg = "my_gray0" } -"ui.popup" = { bg = "my_gray2" } -"ui.window" = { fg = "my_gray3", bg = "my_gray2" } -"ui.linenr.selected" = { fg = "my_gray6", bg = "my_gray0"} -"ui.selection" = { bg = "my_gray3" } -"comment" = { fg = "my_gray4", modifiers = ["italic"] } -"ui.cursorline" = { bg = "my_gray3" } -"ui.statusline" = { fg = "my_gray6", bg = "my_gray2" } -"ui.statusline.inactive" = { fg = 'my_gray4', bg = 'my_gray2' } -"ui.statusline.insert" = {fg = "my_black", bg = "my_gray5", modifiers = ["bold"]} -"ui.statusline.normal" = {fg = "my_gray6", bg = "my_gray2"} -"ui.statusline.select" = {fg = "my_gray6", bg = "my_black", modifiers = ["bold"]} -"ui.cursor" = { fg = "my_gray5", modifiers = ["reversed"] } -"ui.cursor.primary" = { fg = "my_white", modifiers = ["reversed"] } -"ui.cursorline.primary" = { bg = "my_black" } -"ui.cursorline.secondary" = { bg = "my_black" } -"ui.text" = "my_white" -"operator" = "my_white" -"ui.text.focus" = "my_white" -"variable" = "my_white3" -"constant.numeric" = "my_turquoise" -"constant" = "my_white3" -"attribute" = "my_turquoise" -"type" = { fg = "my_white3", modifiers = ["italic"] } -"ui.cursor.match" = { fg = "my_white3", modifiers = ["underlined"] } -"string" = "my_green" -"variable.other.member" = "my_brown" -"constant.character.escape" = "my_turquoise" -"function" = "my_yellow1" -"constructor" = "my_yellow1" -"special" = "my_yellow1" -"keyword" = "my_red" -"label" = "my_red" -"namespace" = "my_white3" -"ui.help" = { fg = "my_gray6", bg = "my_gray2" } -"ui.virtual.whitespace" = { fg = "my_gray5" } -"ui.virtual.ruler" = { bg = "my_gray1" } - -"markup.heading" = "my_yellow1" -"markup.list" = "my_white2" -"markup.bold" = { modifiers = ["bold"] } -"markup.italic" = { modifiers = ["italic"] } -"markup.link.url" = "my_turquoise2" -"markup.link.text" = "my_white2" -"markup.quote" = "my_brown" -"markup.raw" = "my_green" - -"diff.plus" = "my_green" -"diff.delta" = "my_white" -"diff.minus" = "my_red" - -"diagnostic" = { modifiers = ["underlined"] } -"ui.gutter" = { bg = "my_gray0" } -"hint" = "my_gray5" -"debug" = "my_yellow2" -"info" = "my_yellow2" -"warning" = "my_yellow2" -"error" = "my_red" +inherits = "autumn" [palette] my_black = "#111111" # Cursorline From 36eff1da8cdc4efc9cec362311718fa6a4c75563 Mon Sep 17 00:00:00 2001 From: LeoniePhiline <22329650+LeoniePhiline@users.noreply.github.com> Date: Fri, 9 Dec 2022 03:58:15 +0100 Subject: [PATCH 214/491] fix(tutor): Capitalize first letter of a sentence (#5075) --- runtime/tutor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/tutor b/runtime/tutor index d977e078c78f..418c4195487e 100644 --- a/runtime/tutor +++ b/runtime/tutor @@ -96,7 +96,7 @@ _________________________________________________________________ 2. Move to a place in the line which is missing text and type i to enter Insert mode. Keys you type will now type text. 3. Enter the missing text. - 4. type Escape to exit Insert mode and return to Normal mode. + 4. Type Escape to exit Insert mode and return to Normal mode. 5. Repeat until the line matches the line below it. --> Th stce misg so. From d91464208958b6f44b431d244e0f369d7907ba59 Mon Sep 17 00:00:00 2001 From: cor Date: Fri, 9 Dec 2022 04:48:56 +0100 Subject: [PATCH 215/491] use curl underlines for gruvbox_dark_hard (#5066) --- runtime/themes/gruvbox_dark_hard.toml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/runtime/themes/gruvbox_dark_hard.toml b/runtime/themes/gruvbox_dark_hard.toml index 708ca2b2c279..27d9ab9b36e8 100644 --- a/runtime/themes/gruvbox_dark_hard.toml +++ b/runtime/themes/gruvbox_dark_hard.toml @@ -39,6 +39,12 @@ "info" = { fg = "aqua1", bg = "bg1" } "hint" = { fg = "blue1", bg = "bg1" } +"diagnostic" = { modifiers = ["underlined"] } +"diagnostic.error" = { underline = { style = "curl", color = "red0" } } +"diagnostic.warning" = { underline = { style = "curl", color = "orange1" } } +"diagnostic.info" = { underline = { style = "curl", color = "aqua1" } } +"diagnostic.hint" = { underline = { style = "curl", color = "blue1" } } + "ui.background" = { bg = "bg0" } "ui.linenr" = { fg = "bg4" } "ui.linenr.selected" = { fg = "yellow1" } @@ -61,8 +67,6 @@ "ui.virtual.whitespace" = "bg2" "ui.virtual.ruler" = { bg = "bg1" } -"diagnostic" = { modifiers = ["underlined"] } - "markup.heading" = "aqua1" "markup.bold" = { modifiers = ["bold"] } "markup.italic" = { modifiers = ["italic"] } From 6798a6651f9d314eacefddfd051661b030ca9d78 Mon Sep 17 00:00:00 2001 From: ath3 <45574139+ath3@users.noreply.github.com> Date: Fri, 9 Dec 2022 04:55:15 +0100 Subject: [PATCH 216/491] Only write newlines in menu selection popup if the lsp returns detail (#4902) --- helix-term/src/ui/completion.rs | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/helix-term/src/ui/completion.rs b/helix-term/src/ui/completion.rs index c54990e8ec75..11d7886a37d6 100644 --- a/helix-term/src/ui/completion.rs +++ b/helix-term/src/ui/completion.rs @@ -411,7 +411,7 @@ impl Component for Completion { "```{}\n{}\n```\n{}", language, option.detail.as_deref().unwrap_or_default(), - contents.clone() + contents ), cx.editor.syn_loader.clone(), ) @@ -421,15 +421,14 @@ impl Component for Completion { value: contents, })) => { // TODO: set language based on doc scope - Markdown::new( - format!( - "```{}\n{}\n```\n{}", - language, - option.detail.as_deref().unwrap_or_default(), - contents.clone() - ), - cx.editor.syn_loader.clone(), - ) + if let Some(detail) = &option.detail.as_deref() { + Markdown::new( + format!("```{}\n{}\n```\n{}", language, detail, contents), + cx.editor.syn_loader.clone(), + ) + } else { + Markdown::new(contents.to_string(), cx.editor.syn_loader.clone()) + } } None if option.detail.is_some() => { // TODO: copied from above From 8abed3bd78200fc5f7e3890fd853c17ce518d157 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matou=C5=A1=20Dzivjak?= Date: Fri, 9 Dec 2022 04:57:03 +0100 Subject: [PATCH 217/491] feat(lsp): pass client_info on initialization (#4904) Pass client name ('helix') and client version (version / git hash) to LSP server on initialization. --- Cargo.lock | 1 + helix-loader/build.rs | 20 ++++++++++++++++++++ helix-loader/src/lib.rs | 2 ++ helix-lsp/Cargo.toml | 1 + helix-lsp/src/client.rs | 6 +++++- helix-term/build.rs | 21 --------------------- helix-term/src/main.rs | 5 +++-- 7 files changed, 32 insertions(+), 24 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 014834e43349..b204214fc42e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1187,6 +1187,7 @@ dependencies = [ "futures-executor", "futures-util", "helix-core", + "helix-loader", "log", "lsp-types", "serde", diff --git a/helix-loader/build.rs b/helix-loader/build.rs index e0ebd1c48f17..c4b89e6b93fe 100644 --- a/helix-loader/build.rs +++ b/helix-loader/build.rs @@ -1,6 +1,26 @@ +use std::borrow::Cow; +use std::process::Command; + +const VERSION: &str = include_str!("../VERSION"); + fn main() { + let git_hash = Command::new("git") + .args(["rev-parse", "HEAD"]) + .output() + .ok() + .filter(|output| output.status.success()) + .and_then(|x| String::from_utf8(x.stdout).ok()); + + let version: Cow<_> = match git_hash { + Some(git_hash) => format!("{} ({})", VERSION, &git_hash[..8]).into(), + None => VERSION.into(), + }; + println!( "cargo:rustc-env=BUILD_TARGET={}", std::env::var("TARGET").unwrap() ); + + println!("cargo:rerun-if-changed=../VERSION"); + println!("cargo:rustc-env=VERSION_AND_GIT_HASH={}", version); } diff --git a/helix-loader/src/lib.rs b/helix-loader/src/lib.rs index a02a59afc821..29a9f2e75a2b 100644 --- a/helix-loader/src/lib.rs +++ b/helix-loader/src/lib.rs @@ -4,6 +4,8 @@ pub mod grammar; use etcetera::base_strategy::{choose_base_strategy, BaseStrategy}; use std::path::PathBuf; +pub const VERSION_AND_GIT_HASH: &str = env!("VERSION_AND_GIT_HASH"); + pub static RUNTIME_DIR: once_cell::sync::Lazy = once_cell::sync::Lazy::new(runtime_dir); static CONFIG_FILE: once_cell::sync::OnceCell = once_cell::sync::OnceCell::new(); diff --git a/helix-lsp/Cargo.toml b/helix-lsp/Cargo.toml index 41884e73a249..05c5467ea8ac 100644 --- a/helix-lsp/Cargo.toml +++ b/helix-lsp/Cargo.toml @@ -13,6 +13,7 @@ homepage = "https://helix-editor.com" [dependencies] helix-core = { version = "0.6", path = "../helix-core" } +helix-loader = { version = "0.6", path = "../helix-loader" } anyhow = "1.0" futures-executor = "0.3" diff --git a/helix-lsp/src/client.rs b/helix-lsp/src/client.rs index 2c2c7c88ec1d..90fd2f21507c 100644 --- a/helix-lsp/src/client.rs +++ b/helix-lsp/src/client.rs @@ -5,6 +5,7 @@ use crate::{ }; use helix_core::{find_root, ChangeSet, Rope}; +use helix_loader::{self, VERSION_AND_GIT_HASH}; use lsp_types as lsp; use serde::Deserialize; use serde_json::Value; @@ -376,7 +377,10 @@ impl Client { ..Default::default() }, trace: None, - client_info: None, + client_info: Some(lsp::ClientInfo { + name: String::from("helix"), + version: Some(String::from(VERSION_AND_GIT_HASH)), + }), locale: None, // TODO }; diff --git a/helix-term/build.rs b/helix-term/build.rs index 719113ff2c37..b47dae8ef653 100644 --- a/helix-term/build.rs +++ b/helix-term/build.rs @@ -1,30 +1,9 @@ use helix_loader::grammar::{build_grammars, fetch_grammars}; -use std::borrow::Cow; -use std::process::Command; - -const VERSION: &str = include_str!("../VERSION"); fn main() { - let git_hash = Command::new("git") - .args(["rev-parse", "HEAD"]) - .output() - .ok() - .filter(|output| output.status.success()) - .and_then(|x| String::from_utf8(x.stdout).ok()); - - let version: Cow<_> = match git_hash { - Some(git_hash) => format!("{} ({})", VERSION, &git_hash[..8]).into(), - None => VERSION.into(), - }; - if std::env::var("HELIX_DISABLE_AUTO_GRAMMAR_BUILD").is_err() { fetch_grammars().expect("Failed to fetch tree-sitter grammars"); build_grammars(Some(std::env::var("TARGET").unwrap())) .expect("Failed to compile tree-sitter grammars"); } - - println!("cargo:rerun-if-changed=../runtime/grammars/"); - println!("cargo:rerun-if-changed=../VERSION"); - - println!("cargo:rustc-env=VERSION_AND_GIT_HASH={}", version); } diff --git a/helix-term/src/main.rs b/helix-term/src/main.rs index 96b695c6fcde..aac5c5379f37 100644 --- a/helix-term/src/main.rs +++ b/helix-term/src/main.rs @@ -1,5 +1,6 @@ use anyhow::{Context, Error, Result}; use crossterm::event::EventStream; +use helix_loader::VERSION_AND_GIT_HASH; use helix_term::application::Application; use helix_term::args::Args; use helix_term::config::Config; @@ -74,7 +75,7 @@ FLAGS: --hsplit Splits all given files horizontally into different windows ", env!("CARGO_PKG_NAME"), - env!("VERSION_AND_GIT_HASH"), + VERSION_AND_GIT_HASH, env!("CARGO_PKG_AUTHORS"), env!("CARGO_PKG_DESCRIPTION"), logpath.display(), @@ -89,7 +90,7 @@ FLAGS: } if args.display_version { - println!("helix {}", env!("VERSION_AND_GIT_HASH")); + println!("helix {}", VERSION_AND_GIT_HASH); std::process::exit(0); } From 2ea20a23e26a771e095972bdda673d491b4aacc5 Mon Sep 17 00:00:00 2001 From: Jummit Date: Fri, 9 Dec 2022 05:02:34 +0100 Subject: [PATCH 218/491] Fix LSP completions ignoring auto-completion option (#5042) --- helix-term/src/commands.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index 1843e7a2be4e..2bac5be08e8d 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -3049,6 +3049,11 @@ pub mod insert { } fn language_server_completion(cx: &mut Context, ch: char) { + let config = cx.editor.config(); + if !config.auto_completion { + return; + } + use helix_lsp::lsp; // if ch matches completion char, trigger completion let doc = doc_mut!(cx.editor); From 16e13b9789359282cb6c2681262f46fb1b70134b Mon Sep 17 00:00:00 2001 From: TotalKrill Date: Fri, 9 Dec 2022 05:09:23 +0100 Subject: [PATCH 219/491] allow specifying environment for language servers in language.toml (#4004) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Stephen Wakely Co-authored-by: Stephen Wakely Co-authored-by: Blaž Hrastnik --- book/src/languages.md | 3 ++- helix-core/src/syntax.rs | 2 ++ helix-lsp/src/client.rs | 3 +++ helix-lsp/src/lib.rs | 1 + 4 files changed, 8 insertions(+), 1 deletion(-) diff --git a/book/src/languages.md b/book/src/languages.md index 133e6447941c..e45ef910a8d4 100644 --- a/book/src/languages.md +++ b/book/src/languages.md @@ -39,7 +39,7 @@ injection-regex = "^mylang$" file-types = ["mylang", "myl"] comment-token = "#" indent = { tab-width = 2, unit = " " } -language-server = { command = "mylang-lsp", args = ["--stdio"] } +language-server = { command = "mylang-lsp", args = ["--stdio"], environment = { "ENV1" = "value1", "ENV2" = "value2" } } formatter = { command = "mylang-formatter" , args = ["--stdin"] } ``` @@ -99,6 +99,7 @@ The `language-server` field takes the following keys: | `args` | A list of arguments to pass to the language server binary | | `timeout` | The maximum time a request to the language server may take, in seconds. Defaults to `20` | | `language-id` | The language name to pass to the language server. Some language servers support multiple languages and use this field to determine which one is being served in a buffer | +| `environment` | Any environment variables that will be used when starting the language server `{ "KEY1" = "Value1", "KEY2" = "Value2" }` | The top-level `config` field is used to configure the LSP initialization options. A `format` sub-table within `config` can be used to pass extra formatting options to diff --git a/helix-core/src/syntax.rs b/helix-core/src/syntax.rs index 8dc34a3e3631..41ab23e1343a 100644 --- a/helix-core/src/syntax.rs +++ b/helix-core/src/syntax.rs @@ -207,6 +207,8 @@ pub struct LanguageServerConfiguration { #[serde(default)] #[serde(skip_serializing_if = "Vec::is_empty")] pub args: Vec, + #[serde(default, skip_serializing_if = "HashMap::is_empty")] + pub environment: HashMap, #[serde(default = "default_timeout")] pub timeout: u64, pub language_id: Option, diff --git a/helix-lsp/src/client.rs b/helix-lsp/src/client.rs index 90fd2f21507c..dd2581c6d916 100644 --- a/helix-lsp/src/client.rs +++ b/helix-lsp/src/client.rs @@ -42,10 +42,12 @@ pub struct Client { impl Client { #[allow(clippy::type_complexity)] + #[allow(clippy::too_many_arguments)] pub fn start( cmd: &str, args: &[String], config: Option, + server_environment: HashMap, root_markers: &[String], id: usize, req_timeout: u64, @@ -55,6 +57,7 @@ impl Client { let cmd = which::which(cmd).map_err(|err| anyhow::anyhow!(err))?; let process = Command::new(cmd) + .envs(server_environment) .args(args) .stdin(Stdio::piped()) .stdout(Stdio::piped()) diff --git a/helix-lsp/src/lib.rs b/helix-lsp/src/lib.rs index f714395f28f5..8418896cbb73 100644 --- a/helix-lsp/src/lib.rs +++ b/helix-lsp/src/lib.rs @@ -550,6 +550,7 @@ fn start_client( &ls_config.command, &ls_config.args, config.config.clone(), + ls_config.environment.clone(), &config.roots, id, ls_config.timeout, From 37e7dd1df598312727aadb5c74919fd196fecffc Mon Sep 17 00:00:00 2001 From: two-six Date: Fri, 9 Dec 2022 05:11:25 +0100 Subject: [PATCH 220/491] Update `diagnostic.error` background for acme theme (#5019) --- runtime/themes/acme.toml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/runtime/themes/acme.toml b/runtime/themes/acme.toml index 696a4a9b2633..e1785f4a5fec 100644 --- a/runtime/themes/acme.toml +++ b/runtime/themes/acme.toml @@ -17,9 +17,9 @@ "ui.menu" = {fg="black", bg="acme_bg"} "ui.menu.selected" = {bg="selected"} "ui.window" = {bg="acme_bg"} -"diagnostic.error" = {bg="white", modifiers=["bold"]} -"diagnostic.warning" = {bg="white", modifiers=["bold"]} -"diagnostic.hint" = {bg="white", modifiers=["bold"]} +"diagnostic.error" = {bg="red", fg="white", modifiers=["bold"]} +"diagnostic.warning" = {bg="orange", fg="black", modifiers=["bold"]} +"diagnostic.hint" = {fg="gray", modifiers=["bold"]} "ui.bufferline" = { fg = "indent", bg = "acme_bar_bg" } "ui.bufferline.active" = { fg = "black", bg = "acme_bg" } "diff.plus" = {fg = "green"} @@ -37,3 +37,5 @@ cursor = "#444444" red = "#a0342f" green = "#065905" indent = "#aaaaaa" +orange = "#f0ad4e" +gray = "#777777" From d14de277092d7eab555ea2abc1435101d12e308c Mon Sep 17 00:00:00 2001 From: "Felipe S. S. Schneider" <37125+schneiderfelipe@users.noreply.github.com> Date: Fri, 9 Dec 2022 01:33:08 -0300 Subject: [PATCH 221/491] Add support for the BibTeX file format (#5064) --- book/src/generated/lang-support.md | 1 + languages.toml | 28 ++++++++++++++++ runtime/queries/bibtex/highlights.scm | 47 +++++++++++++++++++++++++++ runtime/queries/bibtex/locals.scm | 0 runtime/queries/bibtex/tags.scm | 0 5 files changed, 76 insertions(+) create mode 100644 runtime/queries/bibtex/highlights.scm create mode 100644 runtime/queries/bibtex/locals.scm create mode 100644 runtime/queries/bibtex/tags.scm diff --git a/book/src/generated/lang-support.md b/book/src/generated/lang-support.md index ccfd18c00fca..28dafd7ada47 100644 --- a/book/src/generated/lang-support.md +++ b/book/src/generated/lang-support.md @@ -5,6 +5,7 @@ | bash | ✓ | | | `bash-language-server` | | bass | ✓ | | | `bass` | | beancount | ✓ | | | | +| bibtex | ✓ | | | `texlab` | | bicep | ✓ | | | `bicep-langserver` | | c | ✓ | ✓ | ✓ | `clangd` | | c-sharp | ✓ | ✓ | | `OmniSharp` | diff --git a/languages.toml b/languages.toml index 325a39dfc4c6..96d92ce84ab1 100644 --- a/languages.toml +++ b/languages.toml @@ -576,6 +576,34 @@ indent = { tab-width = 4, unit = "\t" } name = "latex" source = { git = "https://github.com/latex-lsp/tree-sitter-latex", rev = "8c75e93cd08ccb7ce1ccab22c1fbd6360e3bcea6" } +[[language]] +name = "bibtex" +scope = "source.bib" +injection-regex = "bib" +file-types = ["bib"] +roots = [] +comment-token = "%" +language-server = { command = "texlab" } +indent = { tab-width = 4, unit = "\t" } +auto-format = true + +[language.formatter] +command = 'bibtex-tidy' +args = [ + "-", + "--curly", + "--drop-all-caps", + "--remove-empty-fields", + "--sort-fields", + "--sort=year,author,id", + "--strip-enclosing-braces", + "--trailing-commas", +] + +[[grammar]] +name = "bibtex" +source = { git = "https://github.com/latex-lsp/tree-sitter-bibtex", rev = "ccfd77db0ed799b6c22c214fe9d2937f47bc8b34" } + [[language]] name = "lean" scope = "source.lean" diff --git a/runtime/queries/bibtex/highlights.scm b/runtime/queries/bibtex/highlights.scm new file mode 100644 index 000000000000..db1ab70c16f9 --- /dev/null +++ b/runtime/queries/bibtex/highlights.scm @@ -0,0 +1,47 @@ +[ + (string_type) + (preamble_type) + (entry_type) +] @keyword + +[ + (junk) + (comment) +] @comment + +[ + "=" + "#" +] @operator + +(command) @function.builtin + +(number) @constant.numeric + +(field + name: (identifier) @variable.builtin) + +(token + (identifier) @variable.parameter) + +[ + (brace_word) + (quote_word) +] @string + +[ + (key_brace) + (key_paren) +] @attribute + +(string + name: (identifier) @constant) + +[ + "{" + "}" + "(" + ")" +] @punctuation.bracket + +"," @punctuation.delimiter diff --git a/runtime/queries/bibtex/locals.scm b/runtime/queries/bibtex/locals.scm new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/runtime/queries/bibtex/tags.scm b/runtime/queries/bibtex/tags.scm new file mode 100644 index 000000000000..e69de29bb2d1 From f323ffabcc5846f647e3ba1d3d2ff5dec95257bd Mon Sep 17 00:00:00 2001 From: Danilo Spinella Date: Sat, 10 Dec 2022 01:40:27 +0100 Subject: [PATCH 222/491] Treat patches as diff files (#5085) --- languages.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/languages.toml b/languages.toml index 96d92ce84ab1..06af52bd340e 100644 --- a/languages.toml +++ b/languages.toml @@ -1083,7 +1083,7 @@ source = { git = "https://github.com/the-mikedavis/tree-sitter-git-commit", rev name = "diff" scope = "source.diff" roots = [] -file-types = ["diff"] +file-types = ["diff", "patch"] injection-regex = "diff" comment-token = "#" indent = { tab-width = 2, unit = " " } From 0e8ea13696206aa8ad289d539a5df62f34a73dec Mon Sep 17 00:00:00 2001 From: Ollie Charles Date: Sat, 10 Dec 2022 20:03:18 +0000 Subject: [PATCH 223/491] Add Haskell text objects (#5061) --- book/src/generated/lang-support.md | 2 +- runtime/queries/haskell/textobjects.scm | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 runtime/queries/haskell/textobjects.scm diff --git a/book/src/generated/lang-support.md b/book/src/generated/lang-support.md index 28dafd7ada47..4dca810478db 100644 --- a/book/src/generated/lang-support.md +++ b/book/src/generated/lang-support.md @@ -51,7 +51,7 @@ | gowork | ✓ | | | `gopls` | | graphql | ✓ | | | | | hare | ✓ | | | | -| haskell | ✓ | | | `haskell-language-server-wrapper` | +| haskell | ✓ | ✓ | | `haskell-language-server-wrapper` | | hcl | ✓ | | ✓ | `terraform-ls` | | heex | ✓ | ✓ | | `elixir-ls` | | html | ✓ | | | `vscode-html-language-server` | diff --git a/runtime/queries/haskell/textobjects.scm b/runtime/queries/haskell/textobjects.scm new file mode 100644 index 000000000000..9870dc4a4128 --- /dev/null +++ b/runtime/queries/haskell/textobjects.scm @@ -0,0 +1,13 @@ +(comment) @comment.inside + +[ + (adt) + (decl_type) + (newtype) +] @class.around + +((signature)? (function rhs:(_) @function.inside)) @function.around +(exp_lambda) @function.around + +(adt (type_variable) @parameter.inside) +(patterns (_) @parameter.inside) From 70d78123b94d93c801171ac3dd29e2a493feee20 Mon Sep 17 00:00:00 2001 From: Pascal Kuthe Date: Sun, 11 Dec 2022 11:20:34 +0100 Subject: [PATCH 224/491] properly handle detachted git worktrees (#5097) --- helix-core/src/lib.rs | 2 +- helix-loader/src/grammar.rs | 2 +- helix-loader/src/lib.rs | 2 +- helix-term/src/ui/mod.rs | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/helix-core/src/lib.rs b/helix-core/src/lib.rs index 0e76ebbbefca..ee174e69d1cd 100644 --- a/helix-core/src/lib.rs +++ b/helix-core/src/lib.rs @@ -69,7 +69,7 @@ pub fn find_root(root: Option<&str>, root_markers: &[String]) -> std::path::Path top_marker = Some(ancestor); } - if ancestor.join(".git").is_dir() { + if ancestor.join(".git").exists() { // Top marker is repo root if not root marker was detected yet if top_marker.is_none() { top_marker = Some(ancestor); diff --git a/helix-loader/src/grammar.rs b/helix-loader/src/grammar.rs index 833616e046d9..2aa924755112 100644 --- a/helix-loader/src/grammar.rs +++ b/helix-loader/src/grammar.rs @@ -263,7 +263,7 @@ fn fetch_grammar(grammar: GrammarConfiguration) -> Result { ))?; // create the grammar dir contains a git directory - if !grammar_dir.join(".git").is_dir() { + if !grammar_dir.join(".git").exists() { git(&grammar_dir, ["init"])?; } diff --git a/helix-loader/src/lib.rs b/helix-loader/src/lib.rs index 29a9f2e75a2b..80d44a8264b8 100644 --- a/helix-loader/src/lib.rs +++ b/helix-loader/src/lib.rs @@ -97,7 +97,7 @@ pub fn find_local_config_dirs() -> Vec { let mut directories = Vec::new(); for ancestor in current_dir.ancestors() { - if ancestor.join(".git").is_dir() { + if ancestor.join(".git").exists() { directories.push(ancestor.to_path_buf()); // Don't go higher than repo if we're in one break; diff --git a/helix-term/src/ui/mod.rs b/helix-term/src/ui/mod.rs index f61c4c450c7d..107e48dd1ca3 100644 --- a/helix-term/src/ui/mod.rs +++ b/helix-term/src/ui/mod.rs @@ -207,7 +207,7 @@ pub fn file_picker(root: PathBuf, config: &helix_view::editor::Config) -> FilePi // Cap the number of files if we aren't in a git project, preventing // hangs when using the picker in your home directory - let files: Vec<_> = if root.join(".git").is_dir() { + let files: Vec<_> = if root.join(".git").exists() { files.collect() } else { // const MAX: usize = 8192; From cdc54f50a2ceb62c9f1c38b939ca988ff0e96855 Mon Sep 17 00:00:00 2001 From: Michael Davis Date: Sun, 11 Dec 2022 09:04:08 -0600 Subject: [PATCH 225/491] Reset mode when changing buffers (#5072) * Reset mode when changing buffers This is similar to the change in e4c9d4082a139aac3aea4506918171b96e81f5b9: reset the editor to normal mode when changing buffers. Usually the editor is already in normal mode but it's possible to setup insert-mode keybindings that change buffers. * Move normal mode entering code to Editor This should be called internally in the Editor when changing documents (Editor::switch) or changing focuses (Editor::focus). --- helix-term/src/commands.rs | 57 +------------------------------ helix-view/src/editor.rs | 70 +++++++++++++++++++++++++++++++++++++- 2 files changed, 70 insertions(+), 57 deletions(-) diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index 2bac5be08e8d..1310417e47be 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -2672,62 +2672,7 @@ fn open_above(cx: &mut Context) { } fn normal_mode(cx: &mut Context) { - if cx.editor.mode == Mode::Normal { - return; - } - - cx.editor.mode = Mode::Normal; - let (view, doc) = current!(cx.editor); - - try_restore_indent(doc, view); - - // if leaving append mode, move cursor back by 1 - if doc.restore_cursor { - let text = doc.text().slice(..); - let selection = doc.selection(view.id).clone().transform(|range| { - Range::new( - range.from(), - graphemes::prev_grapheme_boundary(text, range.to()), - ) - }); - - doc.set_selection(view.id, selection); - doc.restore_cursor = false; - } -} - -fn try_restore_indent(doc: &mut Document, view: &mut View) { - use helix_core::chars::char_is_whitespace; - use helix_core::Operation; - - fn inserted_a_new_blank_line(changes: &[Operation], pos: usize, line_end_pos: usize) -> bool { - if let [Operation::Retain(move_pos), Operation::Insert(ref inserted_str), Operation::Retain(_)] = - changes - { - move_pos + inserted_str.len() == pos - && inserted_str.starts_with('\n') - && inserted_str.chars().skip(1).all(char_is_whitespace) - && pos == line_end_pos // ensure no characters exists after current position - } else { - false - } - } - - let doc_changes = doc.changes().changes(); - let text = doc.text().slice(..); - let range = doc.selection(view.id).primary(); - let pos = range.cursor(text); - let line_end_pos = line_end_char_index(&text, range.cursor_line(text)); - - if inserted_a_new_blank_line(doc_changes, pos, line_end_pos) { - // Removes tailing whitespaces. - let transaction = - Transaction::change_by_selection(doc.text(), doc.selection(view.id), |range| { - let line_start_pos = text.line_to_char(range.cursor_line(text)); - (line_start_pos, pos, None) - }); - apply_transaction(&transaction, doc, view); - } + cx.editor.enter_normal_mode(); } // Store a jump on the jumplist. diff --git a/helix-view/src/editor.rs b/helix-view/src/editor.rs index 973cf82ea109..c13a66736948 100644 --- a/helix-view/src/editor.rs +++ b/helix-view/src/editor.rs @@ -1005,6 +1005,8 @@ impl Editor { return; } + self.enter_normal_mode(); + match action { Action::Replace => { let (view, doc) = current_ref!(self); @@ -1025,6 +1027,9 @@ impl Editor { let (view, doc) = current!(self); let view_id = view.id; + // Append any outstanding changes to history in the old document. + doc.append_changes_to_history(view); + 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`. @@ -1262,7 +1267,7 @@ impl Editor { // if leaving the view: mode should reset and the cursor should be // within view if prev_id != view_id { - self.mode = Mode::Normal; + self.enter_normal_mode(); self.ensure_cursor_in_view(view_id); // Update jumplist selections with new document changes. @@ -1427,4 +1432,67 @@ impl Editor { Ok(()) } + + /// Switches the editor into normal mode. + pub fn enter_normal_mode(&mut self) { + use helix_core::{graphemes, Range}; + + if self.mode == Mode::Normal { + return; + } + + self.mode = Mode::Normal; + let (view, doc) = current!(self); + + try_restore_indent(doc, view); + + // if leaving append mode, move cursor back by 1 + if doc.restore_cursor { + let text = doc.text().slice(..); + let selection = doc.selection(view.id).clone().transform(|range| { + Range::new( + range.from(), + graphemes::prev_grapheme_boundary(text, range.to()), + ) + }); + + doc.set_selection(view.id, selection); + doc.restore_cursor = false; + } + } +} + +fn try_restore_indent(doc: &mut Document, view: &mut View) { + use helix_core::{ + chars::char_is_whitespace, line_ending::line_end_char_index, Operation, Transaction, + }; + + fn inserted_a_new_blank_line(changes: &[Operation], pos: usize, line_end_pos: usize) -> bool { + if let [Operation::Retain(move_pos), Operation::Insert(ref inserted_str), Operation::Retain(_)] = + changes + { + move_pos + inserted_str.len() == pos + && inserted_str.starts_with('\n') + && inserted_str.chars().skip(1).all(char_is_whitespace) + && pos == line_end_pos // ensure no characters exists after current position + } else { + false + } + } + + let doc_changes = doc.changes().changes(); + let text = doc.text().slice(..); + let range = doc.selection(view.id).primary(); + let pos = range.cursor(text); + let line_end_pos = line_end_char_index(&text, range.cursor_line(text)); + + if inserted_a_new_blank_line(doc_changes, pos, line_end_pos) { + // Removes tailing whitespaces. + let transaction = + Transaction::change_by_selection(doc.text(), doc.selection(view.id), |range| { + let line_start_pos = text.line_to_char(range.cursor_line(text)); + (line_start_pos, pos, None) + }); + crate::apply_transaction(&transaction, doc, view); + } } From c5bfb792b2a26545f6515a1e7b62d4f37b10841e Mon Sep 17 00:00:00 2001 From: Slug <106496265+GreasySlug@users.noreply.github.com> Date: Mon, 12 Dec 2022 03:14:10 +0900 Subject: [PATCH 226/491] update(theme): adjust base16_transparent and dark_high_contrast (#5105) --- book/src/themes.md | 2 +- runtime/themes/base16_transparent.toml | 45 +++++++++++++------------ runtime/themes/dark_high_contrast.toml | 46 ++++++++++++++------------ 3 files changed, 48 insertions(+), 45 deletions(-) diff --git a/book/src/themes.md b/book/src/themes.md index 392b5f8c956a..322caea54b48 100644 --- a/book/src/themes.md +++ b/book/src/themes.md @@ -103,7 +103,7 @@ Some styles might not be supported by your terminal emulator. | `line` | | `curl` | | `dashed` | -| `dot` | +| `dotted` | | `double_line` | diff --git a/runtime/themes/base16_transparent.toml b/runtime/themes/base16_transparent.toml index 0c6d924f64cd..f8ee0890d082 100644 --- a/runtime/themes/base16_transparent.toml +++ b/runtime/themes/base16_transparent.toml @@ -1,27 +1,28 @@ # Author: GreasySlug <9619abgoni@gmail.com> +# This theme is base on base16_theme(Author: NNB ) "ui.background" = { fg = "white"} "ui.background.separator" = { fg = "gray" } -"ui.menu" = { fg = "gray" } +"ui.menu" = { fg = "white" } "ui.menu.selected" = { modifiers = ["reversed"] } "ui.menu.scroll" = { fg = "light-gray" } "ui.linenr" = { fg = "light-gray" } "ui.linenr.selected" = { fg = "white", modifiers = ["bold"] } "ui.popup" = { fg = "white" } "ui.window" = { fg = "white" } -"ui.selection" = { modifiers = [ "reversed"] } -"comment" = { fg = "gray", modifiers = ["italic"] } +"ui.selection" = { bg = "gray" } +"comment" = "light-gray" "ui.statusline" = { fg = "white" } "ui.statusline.inactive" = { fg = "gray" } -"ui.statusline.normal" = { fg = "blue", modifiers = ["reversed"] } -"ui.statusline.insert" = { fg = "green", modifiers = ["reversed"] } -"ui.statusline.select" = { fg = "magenta", modifiers = ["reversed"] } +"ui.statusline.normal" = { fg = "black", bg = "blue" } +"ui.statusline.insert" = { fg = "black", bg = "green" } +"ui.statusline.select" = { fg = "black", bg = "magenta" } "ui.help" = { fg = "light-gray" } "ui.cursor" = { modifiers = ["reversed"] } -"ui.cursor.match" = { fg = "light-yellow", modifiers = ["underlined"] } +"ui.cursor.match" = { fg = "light-yellow", underline = { color = "light-yellow", style = "line" } } "ui.cursor.primary" = { modifiers = ["reversed", "slow_blink"] } "ui.cursor.secondary" = { modifiers = ["reversed"] } -"ui.virtual.ruler" = { fg = "gray", modifiers = ["reversed"] } +"ui.virtual.ruler" = { bg = "gray" } "ui.virtual.whitespace" = "gray" "ui.virtual.indent-guide" = "gray" @@ -44,7 +45,7 @@ "markup.list" = "light-red" "markup.bold" = { fg = "light-yellow", modifiers = ["bold"] } "markup.italic" = { fg = "light-magenta", modifiers = ["italic"] } -"markup.link.url" = { fg = "yellow", modifiers = ["underlined"] } +"markup.link.url" = { fg = "yellow", underline = { color = "yellow", style = "line"} } "markup.link.text" = "light-red" "markup.quote" = "light-cyan" "markup.raw" = "green" @@ -53,19 +54,19 @@ "markup.select" = { fg = "magenta" } "diff.plus" = "light-green" -"diff.delta" = "yellow" +"diff.delta" = "light-blue" +"diff.delta.moved" = "blue" "diff.minus" = "light-red" -"ui.gutter" = "gray" -"info" = "light-blue" -"hint" = "gray" -"debug" = "gray" -"warning" = "yellow" -"error" = "light-red" +"ui.gutter" = "gray" +"info" = "light-blue" +"hint" = "light-gray" +"debug" = "light-gray" +"warning" = "light-yellow" +"error" = "light-red" -"diagnostic" = { modifiers = ["underlined"] } -"diagnostic.info" = { fg = "light-blue", modifiers = ["underlined"] } -"diagnostic.hint" = { fg = "gray", modifiers = ["underlined"] } -"diagnostic.debug" ={ fg ="gray", modifiers = ["underlined"] } -"diagnostic.warning" = { fg = "yellow", modifiers = ["underlined"] } -"diagnostic.error" = { fg ="light-red", modifiers = ["underlined"] } +"diagnostic.info" = { underline = { color = "light-blue", style = "dotted" } } +"diagnostic.hint" = { underline = { color = "light-gray", style = "double_line" } } +"diagnostic.debug" = { underline ={ color ="light-gray", style = "dashed" } } +"diagnostic.warning" = { underline = { color = "light-yellow", style = "curl" } } +"diagnostic.error" = { underline = { color ="light-red", style = "curl" } } diff --git a/runtime/themes/dark_high_contrast.toml b/runtime/themes/dark_high_contrast.toml index c65750f4ee01..1c911eb5fc94 100644 --- a/runtime/themes/dark_high_contrast.toml +++ b/runtime/themes/dark_high_contrast.toml @@ -9,29 +9,29 @@ "ui.text.focus" = { modifiers = ["reversed"] } # file picker selected "ui.virtual.whitespace" = "gray" -"ui.virtual.ruler" = { fg = "gray", bg = "white", modifiers = ["reversed"] } +"ui.virtual.ruler" = { fg = "white", bg = "gray" } "ui.virtual.indent-guide" = "white" "ui.statusline" = { fg = "white", bg = "deep_blue" } -"ui.statusline.inactive" = { fg = "gray" } +"ui.statusline.inactive" = { fg = "gray", bg = "deep_blue" } "ui.statusline.normal" = { fg = "black", bg = "aqua" } "ui.statusline.insert" = { fg = "black", bg = "orange" } "ui.statusline.select" = { fg = "black", bg = "purple" } -# "ui.statusline.separator" = { fg = "aqua", bg = "white" } +"ui.statusline.separator" = { fg = "aqua", bg = "white" } "ui.cursor" = { fg = "black", bg = "white" } "ui.cursor.insert" = { fg = "black", bg = "white" } "ui.cursor.select" = { fg = "black", bg = "white" } "ui.cursor.match" = { bg = "white", modifiers = ["dim"] } "ui.cursor.primary" = { fg = "black", bg = "white", modifiers = ["slow_blink"] } - "ui.cursor.secondary" = "white" -"ui.cursorline.primary" = { fg = "orange", modifiers = ["underlined"] } -"ui.cursorline.secondary" = { fg = "orange", modifiers = ["underlined"] } -"ui.selection" = { fg = "deep_blue", bg = "white" } +"ui.cursorline.primary" = { bg = "deep_blue", underline = { color = "orange", style = "double_line" } } +"ui.cursorline.secondary" = { bg = "dark_blue", underline = { color = "white", style = "line" } } +"ui.selection" = { fg = "dark_blue", bg = "white" } +"ui.selection.primary" = { fg = "deep_blue", bg = "white" } "ui.menu" = { fg = "white", bg = "deep_blue" } -"ui.menu.selected" = { fg = "orange", modifiers = ["underlined"] } +"ui.menu.selected" = { fg = "orange", underline = { style = "line" } } "ui.menu.scroll" = { fg = "aqua", bg = "black" } "ui.help" = { fg = "white", bg = "deep_blue" } @@ -39,15 +39,16 @@ "ui.popup.info" = { fg = "white", bg = "deep_blue" } "ui.gutter" = { bg = "black" } +"ui.gutter.selected" = { bg = "black" } "ui.linenr" = { fg = "white", bg = "black" } "ui.linenr.selected" = { fg = "orange", bg = "black", modifiers = ["bold"] } # Diagnostic -"diagnostic" = "white" -"diagnostic.info" = { bg = "white", modifiers = ["underlined"] } -"diagnostic.hint" = { fg = "yellow", modifiers = ["underlined"] } -"diagnostic.warning" = { fg = "orange", modifiers = ["underlined"] } -"diagnostic.error" = { fg = "red", modifiers = ["underlined"] } +"diagnostic" = { fg = "white" } +"diagnostic.info" = { underline = { color = "white", style = "dotted" } } +"diagnostic.hint" = { underline = { color = "yellow", style = "dashed" } } +"diagnostic.warning" = { underline = { color = "orange", style = "curl" } } +"diagnostic.error" = { underline = { color = "red", style = "curl" } } "info" = "white" "hint" = "yellow" "warning" = "orange" @@ -59,31 +60,31 @@ "diff.minus" = "pink" # Syntax high light -"type" = { fg = "emerald_green" } +"type" = "emerald_green" "type.buildin" = "emerald_green" -"comment" = { fg = "white" } +"comment" = "white" "operator" = "white" -"variable" = { fg = "aqua" } +"variable" = "aqua" "variable.other.member" = "brown" "constant" = "aqua" "constant.numeric" = "emerald_green" -"attributes" = { fg = "blue" } +"attributes" = "blue" "namespace" = "blue" "string" = "brown" -"string.special.url" = { fg = "brown", modifiers =["underlined"]} +"string.special.url" = "brown" "constant.character.escape" = "yellow" "constructor" = "aqua" -"keyword" = { fg = "blue", modifiers = ["underlined"] } +"keyword" = "blue" "keyword.control" = "purple" "function" = "yellow" "label" = "blue" # Markup -"markup.heading" = { fg = "yellow", modifiers = ["bold", "underlined"] } -"markup.list" = { fg = "pink" } +"markup.heading" = { fg = "yellow", modifiers = ["bold"], underline = { color = "yellow", style = "double_line"} } +"markup.list" = "pink" "markup.bold" = { fg = "emerald_green", modifiers = ["bold"] } "markup.italic" = { fg = "blue", modifiers = ["italic"] } -"markup.link.url" = { fg = "blue", modifiers = ["underlined"] } +"markup.link.url" = { fg = "blue", underline = { color = "blue", style = "line" } } "markup.link.text" = "pink" "markup.quote" = "yellow" "markup.raw" = "brown" @@ -94,6 +95,7 @@ gray = "#585858" white = "#ffffff" blue = "#66a4ff" deep_blue = "#142743" +dark_blue = "#0d1a2d" aqua = "#6fc3df" purple = "#c586c0" red = "#b65f5f" From a34ba071be0a48a35f36ada7759dee53d783e57b Mon Sep 17 00:00:00 2001 From: garlic0x1 <43155857+garlic0x1@users.noreply.github.com> Date: Sun, 11 Dec 2022 19:59:27 -0600 Subject: [PATCH 227/491] Fix commonlisp filetypes typo and auto-pairs (#5091) --- languages.toml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/languages.toml b/languages.toml index 06af52bd340e..dae675dfc14d 100644 --- a/languages.toml +++ b/languages.toml @@ -918,13 +918,19 @@ grammar = "scheme" name = "common-lisp" scope = "source.lisp" roots = [] -file-types = ["lisp", "asd", "cl", "l", "lsp", "ny"," podsl", "sexp"] +file-types = ["lisp", "asd", "cl", "l", "lsp", "ny", "podsl", "sexp"] shebangs = ["lisp", "sbcl", "ccl", "clisp", "ecl"] comment-token = ";" indent = { tab-width = 2, unit = " " } language-server = { command = "cl-lsp", args = [ "stdio" ] } grammar = "scheme" +[language.auto-pairs] +'(' = ')' +'{' = '}' +'[' = ']' +'"' = '"' + [[language]] name = "comment" scope = "scope.comment" From d5ab974d38fd5565a63c8d7c35967c77c0e434d0 Mon Sep 17 00:00:00 2001 From: Marco Ieni <11428655+MarcoIeni@users.noreply.github.com> Date: Mon, 12 Dec 2022 02:59:53 +0100 Subject: [PATCH 228/491] chore(book): link repository (#5101) --- book/book.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/book/book.toml b/book/book.toml index 2277a0bd9dc6..9835145cea3f 100644 --- a/book/book.toml +++ b/book/book.toml @@ -9,3 +9,4 @@ edit-url-template = "https://github.com/helix-editor/helix/tree/master/book/{pat cname = "docs.helix-editor.com" default-theme = "colibri" preferred-dark-theme = "colibri" +git-repository-url = "https://github.com/helix-editor/helix" From 0b960216433956503e9e6fe5220523eb1970eaee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20Schl=C3=B6gl?= Date: Mon, 12 Dec 2022 03:06:24 +0100 Subject: [PATCH 229/491] Add `:pipe-to` typable command that ignores shell output (#4931) --- book/src/generated/typable-cmd.md | 1 + helix-term/src/commands/typed.rs | 26 +++++++++++++++++++++++++- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/book/src/generated/typable-cmd.md b/book/src/generated/typable-cmd.md index 6390ef858e7b..66e6ac039c26 100644 --- a/book/src/generated/typable-cmd.md +++ b/book/src/generated/typable-cmd.md @@ -71,4 +71,5 @@ | `:insert-output` | Run shell command, inserting output before each selection. | | `:append-output` | Run shell command, appending output after each selection. | | `:pipe` | Pipe each selection to the shell command. | +| `:pipe-to` | Pipe each selection to the shell command, ignoring output. | | `:run-shell-command`, `:sh` | Run a shell command | diff --git a/helix-term/src/commands/typed.rs b/helix-term/src/commands/typed.rs index 03fcaa553a53..2119a48d67a4 100644 --- a/helix-term/src/commands/typed.rs +++ b/helix-term/src/commands/typed.rs @@ -1741,13 +1741,30 @@ fn insert_output( Ok(()) } +fn pipe_to( + cx: &mut compositor::Context, + args: &[Cow], + event: PromptEvent, +) -> anyhow::Result<()> { + pipe_impl(cx, args, event, &ShellBehavior::Ignore) +} + fn pipe(cx: &mut compositor::Context, args: &[Cow], event: PromptEvent) -> anyhow::Result<()> { + pipe_impl(cx, args, event, &ShellBehavior::Replace) +} + +fn pipe_impl( + cx: &mut compositor::Context, + args: &[Cow], + event: PromptEvent, + behavior: &ShellBehavior, +) -> anyhow::Result<()> { if event != PromptEvent::Validate { return Ok(()); } ensure!(!args.is_empty(), "Shell command required"); - shell(cx, &args.join(" "), &ShellBehavior::Replace); + shell(cx, &args.join(" "), behavior); Ok(()) } @@ -2292,6 +2309,13 @@ pub const TYPABLE_COMMAND_LIST: &[TypableCommand] = &[ fun: pipe, completer: None, }, + TypableCommand { + name: "pipe-to", + aliases: &[], + doc: "Pipe each selection to the shell command, ignoring output.", + fun: pipe_to, + completer: None, + }, TypableCommand { name: "run-shell-command", aliases: &["sh"], From bae890d8faa993333d81e662b6f0a6bc5e921a92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bla=C5=BE=20Hrastnik?= Date: Mon, 12 Dec 2022 17:49:57 +0900 Subject: [PATCH 230/491] Update tree-sitter-scheme --- languages.toml | 2 +- runtime/queries/rust/highlights.scm | 11 +++++- runtime/queries/scheme/highlights.scm | 55 +++++++++++++-------------- 3 files changed, 37 insertions(+), 31 deletions(-) diff --git a/languages.toml b/languages.toml index dae675dfc14d..e6bc344ccfee 100644 --- a/languages.toml +++ b/languages.toml @@ -1583,7 +1583,7 @@ indent = { tab-width = 2, unit = " " } [[grammar]] name = "scheme" -source = { git = "https://github.com/6cdh/tree-sitter-scheme", rev = "27fb77db05f890c2823b4bd751c6420378df146b" } +source = { git = "https://github.com/6cdh/tree-sitter-scheme", rev = "c0741320bfca6b7b5b7a13b5171275951e96a842" } [[language]] name = "v" diff --git a/runtime/queries/rust/highlights.scm b/runtime/queries/rust/highlights.scm index 5606e93d3007..d3c292708b63 100644 --- a/runtime/queries/rust/highlights.scm +++ b/runtime/queries/rust/highlights.scm @@ -5,8 +5,6 @@ ; overrides are unnecessary. ; ------- - - ; ------- ; Types ; ------- @@ -241,6 +239,14 @@ +(attribute + (identifier) @_macro + arguments: (token_tree (identifier) @constant.numeric.integer) + (#eq? @_macro "derive") +) +@special + + ; ------- ; Functions ; ------- @@ -271,6 +277,7 @@ ; --- ; Macros ; --- + (attribute (identifier) @function.macro) (attribute diff --git a/runtime/queries/scheme/highlights.scm b/runtime/queries/scheme/highlights.scm index 3b7a42755b1b..468193745d93 100644 --- a/runtime/queries/scheme/highlights.scm +++ b/runtime/queries/scheme/highlights.scm @@ -2,29 +2,40 @@ (character) @constant.character (boolean) @constant.builtin.boolean -[(string) - (character)] @string +(string) @string (escape_sequence) @constant.character.escape -[(comment) - (block_comment) - (directive)] @comment +(comment) @comment.line +(block_comment) @comment.block +(directive) @keyword.directive -[(boolean) - (character)] @constant +; operators -((symbol) @function.builtin - (#match? @function.builtin "^(eqv\\?|eq\\?|equal\\?)")) ; TODO +((symbol) @operator + (#match? @operator "^(\\+|-|\\*|/|=|>|<|>=|<=)$")) ; keywords -((symbol) @keyword.conditional - (#match? @keyword.conditional "^(if|cond|case|when|unless)$")) +(list + . + ((symbol) @keyword.conditional + (#match? @keyword.conditional "^(if|cond|case|when|unless)$" + ))) -((symbol) @keyword - (#match? @keyword - "^(define|lambda|begin|do|define-syntax|and|or|if|cond|case|when|unless|else|=>|let|let*|let-syntax|let-values|let*-values|letrec|letrec*|letrec-syntax|set!|syntax-rules|identifier-syntax|quote|unquote|quote-splicing|quasiquote|unquote-splicing|delay|assert|library|export|import|rename|only|except|prefix)$")) +(list + . + (symbol) @keyword + (#match? @keyword + "^(define-syntax|let\\*|lambda|λ|case|=>|quote-splicing|unquote-splicing|set!|let|letrec|letrec-syntax|let-values|let\\*-values|do|else|define|cond|syntax-rules|unquote|begin|quote|let-syntax|and|if|quasiquote|letrec|delay|or|when|unless|identifier-syntax|assert|library|export|import|rename|only|except|prefix)$" + )) + +(list + . + (symbol) @function.builtin + (#match? @function.builtin + "^(caar|cadr|call-with-input-file|call-with-output-file|cdar|cddr|list|open-input-file|open-output-file|with-input-from-file|with-output-to-file|\\*|\\+|-|/|<|<=|=|>|>=|abs|acos|angle|append|apply|asin|assoc|assq|assv|atan|boolean\\?|caaaar|caaadr|caaar|caadar|caaddr|caadr|cadaar|cadadr|cadar|caddar|cadddr|caddr|call-with-current-continuation|call-with-values|car|cdaaar|cdaadr|cdaar|cdadar|cdaddr|cdadr|cddaar|cddadr|cddar|cdddar|cddddr|cdddr|cdr|ceiling|char->integer|char-alphabetic\\?|char-ci<=\\?|char-ci<\\?|char-ci=\\?|char-ci>=\\?|char-ci>\\?|char-downcase|char-lower-case\\?|char-numeric\\?|char-ready\\?|char-upcase|char-upper-case\\?|char-whitespace\\?|char<=\\?|char<\\?|char=\\?|char>=\\?|char>\\?|char\\?|close-input-port|close-output-port|complex\\?|cons|cos|current-error-port|current-input-port|current-output-port|denominator|display|dynamic-wind|eof-object\\?|eq\\?|equal\\?|eqv\\?|eval|even\\?|exact->inexact|exact\\?|exp|expt|floor|flush-output|for-each|force|gcd|imag-part|inexact->exact|inexact\\?|input-port\\?|integer->char|integer\\?|interaction-environment|lcm|length|list->string|list->vector|list-ref|list-tail|list\\?|load|log|magnitude|make-polar|make-rectangular|make-string|make-vector|map|max|member|memq|memv|min|modulo|negative\\?|newline|not|null-environment|null\\?|number->string|number\\?|numerator|odd\\?|output-port\\?|pair\\?|peek-char|positive\\?|procedure\\?|quotient|rational\\?|rationalize|read|read-char|real-part|real\\?|remainder|reverse|round|scheme-report-environment|set-car!|set-cdr!|sin|sqrt|string|string->list|string->number|string->symbol|string-append|string-ci<=\\?|string-ci<\\?|string-ci=\\?|string-ci>=\\?|string-ci>\\?|string-copy|string-fill!|string-length|string-ref|string-set!|string<=\\?|string<\\?|string=\\?|string>=\\?|string>\\?|string\\?|substring|symbol->string|symbol\\?|tan|transcript-off|transcript-on|truncate|values|vector|vector->list|vector-fill!|vector-length|vector-ref|vector-set!|vector\\?|write|write-char|zero\\?)$" + )) ; special forms @@ -47,26 +58,16 @@ . (list (list - (symbol) @variable)) + (symbol) @variable.parameter)) (#match? @_f "^(let|let\\*|let-syntax|let-values|let\\*-values|letrec|letrec\\*|letrec-syntax)$")) -; operators - -(list - . - (symbol) @operator - (#match? @operator "^([+*/<>=-]|(<=)|(>=))$")) - ; quote -(abbreviation - "'" (symbol)) @constant - (list . (symbol) @_f - (#eq? @_f "quote")) @symbol + (#eq? @_f "quote")) @string.symbol ; library @@ -89,12 +90,10 @@ ((symbol) @variable.builtin (#eq? @variable.builtin "...")) -(symbol) @variable ((symbol) @variable.builtin (#eq? @variable.builtin ".")) (symbol) @variable - ["(" ")" "[" "]" "{" "}"] @punctuation.bracket From f995f2610b3ad3aa68cec42ea14ce067a1ed3655 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 12 Dec 2022 17:20:26 -0600 Subject: [PATCH 231/491] build(deps): bump serde from 1.0.149 to 1.0.150 (#5138) Bumps [serde](https://github.com/serde-rs/serde) from 1.0.149 to 1.0.150. - [Release notes](https://github.com/serde-rs/serde/releases) - [Commits](https://github.com/serde-rs/serde/compare/v1.0.149...v1.0.150) --- updated-dependencies: - dependency-name: serde dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Cargo.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b204214fc42e..040a039c4f2b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1805,18 +1805,18 @@ checksum = "9c8132065adcfd6e02db789d9285a0deb2f3fcb04002865ab67d5fb103533898" [[package]] name = "serde" -version = "1.0.149" +version = "1.0.150" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "256b9932320c590e707b94576e3cc1f7c9024d0ee6612dfbcf1cb106cbe8e055" +checksum = "e326c9ec8042f1b5da33252c8a37e9ffbd2c9bef0155215b6e6c80c790e05f91" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.149" +version = "1.0.150" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4eae9b04cbffdfd550eb462ed33bc6a1b68c935127d008b27444d08380f94e4" +checksum = "42a3df25b0713732468deadad63ab9da1f1fd75a48a15024b50363f128db627e" dependencies = [ "proc-macro2", "quote", From fa436fa680b5bcf6d46666a03ae23b94a74e0414 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 12 Dec 2022 17:25:05 -0600 Subject: [PATCH 232/491] build(deps): bump tokio from 1.22.0 to 1.23.0 (#5137) Bumps [tokio](https://github.com/tokio-rs/tokio) from 1.22.0 to 1.23.0. - [Release notes](https://github.com/tokio-rs/tokio/releases) - [Commits](https://github.com/tokio-rs/tokio/compare/tokio-1.22.0...tokio-1.23.0) --- updated-dependencies: - dependency-name: tokio dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Cargo.lock | 6 +++--- helix-lsp/Cargo.toml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 040a039c4f2b..6ae0a71f8c1b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2100,9 +2100,9 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" [[package]] name = "tokio" -version = "1.22.0" +version = "1.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d76ce4a75fb488c605c54bf610f221cea8b0dafb53333c1a67e8ee199dcd2ae3" +checksum = "eab6d665857cc6ca78d6e80303a02cea7a7851e85dfbd77cbdc09bd129f1ef46" dependencies = [ "autocfg", "bytes", @@ -2115,7 +2115,7 @@ dependencies = [ "signal-hook-registry", "socket2", "tokio-macros", - "winapi", + "windows-sys", ] [[package]] diff --git a/helix-lsp/Cargo.toml b/helix-lsp/Cargo.toml index 05c5467ea8ac..d04edcd52288 100644 --- a/helix-lsp/Cargo.toml +++ b/helix-lsp/Cargo.toml @@ -23,6 +23,6 @@ lsp-types = { version = "0.93", features = ["proposed"] } serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" thiserror = "1.0" -tokio = { version = "1.22", features = ["rt", "rt-multi-thread", "io-util", "io-std", "time", "process", "macros", "fs", "parking_lot", "sync"] } +tokio = { version = "1.23", features = ["rt", "rt-multi-thread", "io-util", "io-std", "time", "process", "macros", "fs", "parking_lot", "sync"] } tokio-stream = "0.1.11" which = "4.2" From 00092a29c4f8ca7402455a9a494147ee3521bd4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bla=C5=BE=20Hrastnik?= Date: Tue, 13 Dec 2022 15:07:20 +0900 Subject: [PATCH 233/491] Use dtolnay/rust-toolchain in more places --- .github/workflows/build.yml | 9 ++------ .github/workflows/release.yml | 42 ++++++++++++++++++++--------------- 2 files changed, 26 insertions(+), 25 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index deeff80e1059..3a4896f1ecf1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -44,10 +44,7 @@ jobs: uses: actions/checkout@v3 - name: Install stable toolchain - uses: helix-editor/rust-toolchain@v1 - with: - profile: minimal - override: true + uses: dtolnay/rust-toolchain@1.61 - uses: Swatinem/rust-cache@v2 @@ -76,10 +73,8 @@ jobs: uses: actions/checkout@v3 - name: Install stable toolchain - uses: helix-editor/rust-toolchain@v1 + uses: dtolnay/rust-toolchain@1.61 with: - profile: minimal - override: true components: rustfmt, clippy - uses: Swatinem/rust-cache@v2 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c242f089464b..8c105bfcf317 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -26,10 +26,7 @@ jobs: uses: actions/checkout@v3 - name: Install stable toolchain - uses: helix-editor/rust-toolchain@v1 - with: - profile: minimal - override: true + uses: dtolnay/rust-toolchain@stable - uses: Swatinem/rust-cache@v2 @@ -47,6 +44,16 @@ jobs: dist: name: Dist needs: [fetch-grammars] + env: + # For some builds, we use cross to test on 32-bit and big-endian + # systems. + CARGO: cargo + # When CARGO is set to CROSS, this is set to `--target matrix.target`. + TARGET_FLAGS: + # When CARGO is set to CROSS, TARGET_DIR includes matrix.target. + TARGET_DIR: ./target + # Emit backtraces on panics. + RUST_BACKTRACE: 1 runs-on: ${{ matrix.os }} strategy: fail-fast: false # don't fail other jobs if one fails @@ -107,12 +114,10 @@ jobs: tar xJf grammars/grammars.tar.xz -C runtime/grammars/sources - name: Install ${{ matrix.rust }} toolchain - uses: actions-rs/toolchain@v1 + uses: dtolnay/rust-toolchain@master with: - profile: minimal toolchain: ${{ matrix.rust }} target: ${{ matrix.target }} - override: true # Install a pre-release version of Cross # TODO: We need to pre-install Cross because we need cross-rs/cross#591 to @@ -120,15 +125,20 @@ jobs: # 0.3.0, which includes cross-rs/cross#591, is released. - name: Install Cross if: "matrix.cross" - run: cargo install cross --git https://github.com/cross-rs/cross.git --rev 47df5c76e7cba682823a0b6aa6d95c17b31ba63a + run: | + cargo install cross --git https://github.com/cross-rs/cross.git --rev 47df5c76e7cba682823a0b6aa6d95c17b31ba63a + echo "CARGO=cross" >> $GITHUB_ENV + # echo "TARGET_FLAGS=--target ${{ matrix.target }}" >> $GITHUB_ENV + # echo "TARGET_DIR=./target/${{ matrix.target }}" >> $GITHUB_ENV + + - name: Show command used for Cargo + run: | + echo "cargo command is: ${{ env.CARGO }}" + echo "target flag is: ${{ env.TARGET_FLAGS }}" - name: Run cargo test - uses: actions-rs/cargo@v1 if: "!matrix.skip_tests" - with: - use-cross: ${{ matrix.cross }} - command: test - args: --release --locked --target ${{ matrix.target }} --workspace + run: ${{ env.CARGO }} test --release --locked --target ${{ matrix.target }} --workspace - name: Set profile.release.strip = true shell: bash @@ -139,11 +149,7 @@ jobs: EOF - name: Build release binary - uses: actions-rs/cargo@v1 - with: - use-cross: ${{ matrix.cross }} - command: build - args: --release --locked --target ${{ matrix.target }} + run: ${{ env.CARGO }} build --release --locked --target ${{ matrix.target }} - name: Build AppImage shell: bash From e6fce860b10faab1cb50b7709a67ded113364392 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bla=C5=BE=20Hrastnik?= Date: Tue, 13 Dec 2022 15:08:24 +0900 Subject: [PATCH 234/491] Use latest github runner images --- .github/workflows/release.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8c105bfcf317..9518a5373ccb 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -61,17 +61,17 @@ jobs: build: [x86_64-linux, x86_64-macos, x86_64-windows] #, x86_64-win-gnu, win32-msvc include: - build: x86_64-linux - os: ubuntu-20.04 + os: ubuntu-latest rust: stable target: x86_64-unknown-linux-gnu cross: false - build: aarch64-linux - os: ubuntu-20.04 + os: ubuntu-latest rust: stable target: aarch64-unknown-linux-gnu cross: true - build: riscv64-linux - os: ubuntu-20.04 + os: ubuntu-latest rust: stable target: riscv64gc-unknown-linux-gnu cross: true @@ -81,7 +81,7 @@ jobs: target: x86_64-apple-darwin cross: false - build: x86_64-windows - os: windows-2019 + os: windows-latest rust: stable target: x86_64-pc-windows-msvc cross: false From 0f2ae35a1336d5fef823127dc134ed5675e5b9cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bla=C5=BE=20Hrastnik?= Date: Tue, 13 Dec 2022 15:14:40 +0900 Subject: [PATCH 235/491] ci: Merge two jobs --- .github/workflows/build.yml | 25 ++++--------------------- 1 file changed, 4 insertions(+), 21 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3a4896f1ecf1..0d6fcb3e8426 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -98,13 +98,13 @@ jobs: uses: actions/checkout@v3 - name: Install stable toolchain - uses: helix-editor/rust-toolchain@v1 - with: - profile: minimal - override: true + uses: dtolnay/rust-toolchain@1.61 - uses: Swatinem/rust-cache@v2 + - name: Validate queries + run: cargo xtask query-check + - name: Generate docs run: cargo xtask docgen @@ -115,20 +115,3 @@ jobs: || (echo "Run 'cargo xtask docgen', commit the changes and push again" \ && exit 1) - queries: - name: Tree-sitter queries - runs-on: ubuntu-latest - steps: - - name: Checkout sources - uses: actions/checkout@v3 - - - name: Install stable toolchain - uses: helix-editor/rust-toolchain@v1 - with: - profile: minimal - override: true - - - uses: Swatinem/rust-cache@v2 - - - name: Generate docs - run: cargo xtask query-check From 436296b76c671446aab8863b467155ff9e94d4fc Mon Sep 17 00:00:00 2001 From: Erasin Date: Wed, 14 Dec 2022 21:51:00 +0800 Subject: [PATCH 236/491] Add Mermaid.js for markdown support (#5147) --- book/src/generated/lang-support.md | 1 + languages.toml | 13 ++ runtime/queries/mermaid/highlights.scm | 187 +++++++++++++++++++++++++ 3 files changed, 201 insertions(+) create mode 100644 runtime/queries/mermaid/highlights.scm diff --git a/book/src/generated/lang-support.md b/book/src/generated/lang-support.md index 4dca810478db..fa7b6edd30f1 100644 --- a/book/src/generated/lang-support.md +++ b/book/src/generated/lang-support.md @@ -77,6 +77,7 @@ | make | ✓ | | | | | markdown | ✓ | | | `marksman` | | markdown.inline | ✓ | | | | +| mermaid | ✓ | | | | | meson | ✓ | | ✓ | | | mint | | | | `mint` | | nickel | ✓ | | ✓ | `nls` | diff --git a/languages.toml b/languages.toml index e6bc344ccfee..e28476d3118a 100644 --- a/languages.toml +++ b/languages.toml @@ -2043,3 +2043,16 @@ grammar = "qmljs" [[grammar]] name = "qmljs" source = { git = "https://github.com/yuja/tree-sitter-qmljs", rev = "0b2b25bcaa7d4925d5f0dda16f6a99c588a437f1" } + +[[language]] +name = "mermaid" +scope = "source.mermaid" +injection-regex = "mermaid" +file-types = ["mermaid"] +roots = [] +comment-token = "%%" +indent = { tab-width = 4, unit = " " } + +[[grammar]] +name = "mermaid" +source = { git = "https://github.com/monaqa/tree-sitter-mermaid", rev = "d787c66276e7e95899230539f556e8b83ee16f6d" } diff --git a/runtime/queries/mermaid/highlights.scm b/runtime/queries/mermaid/highlights.scm new file mode 100644 index 000000000000..b546d39f27ab --- /dev/null +++ b/runtime/queries/mermaid/highlights.scm @@ -0,0 +1,187 @@ +[ + "sequenceDiagram" + "classDiagram" + "classDiagram-v2" + "stateDiagram" + "stateDiagram-v2" + "gantt" + "pie" + "flowchart" + "erdiagram" + + "participant" + "as" + "activate" + "deactivate" + "note " + "over" + "link" + "links" + ; "left of" + ; "right of" + "properties" + "details" + "title" + "loop" + "rect" + "opt" + "alt" + "else" + "par" + "and" + "end" + (sequence_stmt_autonumber) + (note_placement_left) + (note_placement_right) + + "class" + + "state " + + "dateformat" + "inclusiveenddates" + "topaxis" + "axisformat" + "includes" + "excludes" + "todaymarker" + "title" + "section" + + "direction" + "subgraph" + + ] @keyword + +[ + (comment) + ] @comment + +(flow_vertex_id) @type +(flow_arrow_text) @label +(flow_text_literal) @string + +[ + ":" + (sequence_signal_plus_sign) + (sequence_signal_minus_sign) + + (class_visibility_public) + (class_visibility_private) + (class_visibility_protected) + (class_visibility_internal) + + (state_division) + ] @punctuation.delimiter + +[ + "(" + ")" + "{" + "}" + ] @punctuation.bracket + +[ + "-->" + (solid_arrow) + (dotted_arrow) + (solid_open_arrow) + (dotted_open_arrow) + (solid_cross) + (dotted_cross) + (solid_point) + (dotted_point) + ] @operator + +[ + (class_reltype_aggregation) + (class_reltype_extension) + (class_reltype_composition) + (class_reltype_dependency) + (class_linetype_solid) + (class_linetype_dotted) + "&" + ] @operator + +(sequence_actor) @variable +(sequence_text) @string + +(class_name) @type +(class_label) @string +(class_method_line) @function.method + +(state_name) @variable + +(gantt_section) @markup.heading +(gantt_task_text) @variable.builtin +(gantt_task_data) @string + +[ + (class_annotation_line) + (class_stmt_annotation) + (class_generics) + + (state_annotation_fork) + (state_annotation_join) + (state_annotation_choice) + ] @type + +(directive) @keyword.directive + +(pie_label) @string +(pie_value) @constant.numeric + +[ +(flowchart_direction_lr) +(flowchart_direction_rl) +(flowchart_direction_tb) +(flowchart_direction_bt) + ] @constant + +(flow_vertex_id) @variable + +[ + (flow_link_arrow) + (flow_link_arrow_start) + ] @operator + +(flow_link_arrowtext "|" @punctuation.bracket) + +(flow_vertex_square [ "[" "]" ] @punctuation.bracket ) +(flow_vertex_circle ["((" "))"] @punctuation.bracket ) +(flow_vertex_ellipse ["(-" "-)"] @punctuation.bracket ) +(flow_vertex_stadium ["([" "])"] @punctuation.bracket ) +(flow_vertex_subroutine ["[[" "]]"] @punctuation.bracket ) +(flow_vertex_rect ["[|" "|]"] @punctuation.bracket ) +(flow_vertex_cylinder ["[(" ")]"] @punctuation.bracket ) +(flow_vertex_round ["(" ")"] @punctuation.bracket ) +(flow_vertex_diamond ["{" "}"] @punctuation.bracket ) +(flow_vertex_hexagon ["{{" "}}"] @punctuation.bracket ) +(flow_vertex_odd [">" "]"] @punctuation.bracket ) +(flow_vertex_trapezoid ["[/" "\\]"] @punctuation.bracket ) +(flow_vertex_inv_trapezoid ["[\\" "/]"] @punctuation.bracket ) +(flow_vertex_leanright ["[/" "/]"] @punctuation.bracket ) +(flow_vertex_leanleft ["[\\" "\\]"] @punctuation.bracket ) + +(flow_stmt_subgraph ["[" "]"] @punctuation.bracket ) + +[ + (er_cardinarity_zero_or_one) + (er_cardinarity_zero_or_more) + (er_cardinarity_one_or_more) + (er_cardinarity_only_one) + (er_reltype_non_identifying) + (er_reltype_identifying) + ] @operator + +(er_entity_name) @variable + +(er_attribute_type) @type +(er_attribute_name) @variable + +[ + (er_attribute_key_type_pk) + (er_attribute_key_type_fk) + ] @keyword + +(er_attribute_comment) @string From 012fc12f97f4e8e0fc38af351388e41e8bc142d8 Mon Sep 17 00:00:00 2001 From: gavincrawford <94875769+gavincrawford@users.noreply.github.com> Date: Wed, 14 Dec 2022 07:42:11 -0700 Subject: [PATCH 237/491] Add Bash indents (#5149) --- book/src/generated/lang-support.md | 2 +- runtime/queries/bash/indents.scm | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 runtime/queries/bash/indents.scm diff --git a/book/src/generated/lang-support.md b/book/src/generated/lang-support.md index fa7b6edd30f1..1400fa875795 100644 --- a/book/src/generated/lang-support.md +++ b/book/src/generated/lang-support.md @@ -2,7 +2,7 @@ | --- | --- | --- | --- | --- | | astro | ✓ | | | | | awk | ✓ | ✓ | | `awk-language-server` | -| bash | ✓ | | | `bash-language-server` | +| bash | ✓ | | ✓ | `bash-language-server` | | bass | ✓ | | | `bass` | | beancount | ✓ | | | | | bibtex | ✓ | | | `texlab` | diff --git a/runtime/queries/bash/indents.scm b/runtime/queries/bash/indents.scm new file mode 100644 index 000000000000..f2077037d2e9 --- /dev/null +++ b/runtime/queries/bash/indents.scm @@ -0,0 +1,11 @@ +[ + (function_definition) + (if_statement) + (for_statement) + (case_statement) + (pipeline) +] @indent + +[ + "}" +] @outdent From db939801ebf299f11a6a52bdff7a3c9bfb87fc34 Mon Sep 17 00:00:00 2001 From: Michael Davis Date: Thu, 15 Dec 2022 02:49:49 -0600 Subject: [PATCH 238/491] Improve error message handling for theme loading failures (#5073) The error messages for a theme that failed to be deserialized (or otherwise failed to load) were covered up by the context/with_context calls: * The log message for a bad theme configured in config.toml would only say "Failed to deserilaize theme" * Selecting a bad theme via :theme would show "Theme does not exist" With these changes, we let the TOML deserializer errors bubble up, so the error messages can now say the line number of a duplicated key - and that key's name - when a theme fails to load because of a duplicated key. Providing a theme which does not exist to :theme still gives a helpful error message: "No such file or directory." --- helix-term/src/commands/typed.rs | 2 +- helix-view/src/theme.rs | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/helix-term/src/commands/typed.rs b/helix-term/src/commands/typed.rs index 2119a48d67a4..cb387fcb5b64 100644 --- a/helix-term/src/commands/typed.rs +++ b/helix-term/src/commands/typed.rs @@ -777,7 +777,7 @@ fn theme( .editor .theme_loader .load(theme_name) - .with_context(|| "Theme does not exist")?; + .map_err(|err| anyhow::anyhow!("Could not load theme: {}", err))?; if !(true_color || theme.is_16_color()) { bail!("Unsupported theme: theme requires true color support"); } diff --git a/helix-view/src/theme.rs b/helix-view/src/theme.rs index f1219ec5dc17..b2c8a79f76aa 100644 --- a/helix-view/src/theme.rs +++ b/helix-view/src/theme.rs @@ -136,8 +136,9 @@ impl Loader { // Loads the theme data as `toml::Value` first from the user_dir then in default_dir fn load_toml(&self, path: PathBuf) -> Result { let data = std::fs::read(&path)?; + let value = toml::from_slice(data.as_slice())?; - toml::from_slice(data.as_slice()).context("Failed to deserialize theme") + Ok(value) } // Returns the path to the theme with the name From c64debc7412c0769db8186694bd89f85ea057b1b Mon Sep 17 00:00:00 2001 From: Gokul Soumya Date: Tue, 19 Jul 2022 21:28:14 +0530 Subject: [PATCH 239/491] Add force_score() for scoring picker items without optimizations --- helix-term/src/ui/picker.rs | 45 +++++++++++++++++++++---------------- 1 file changed, 26 insertions(+), 19 deletions(-) diff --git a/helix-term/src/ui/picker.rs b/helix-term/src/ui/picker.rs index 5e9ca3d887a5..8b5d20eca6b8 100644 --- a/helix-term/src/ui/picker.rs +++ b/helix-term/src/ui/picker.rs @@ -469,34 +469,41 @@ impl Picker { self.matches.sort_unstable(); } else { - let query = FuzzyQuery::new(pattern); - self.matches.clear(); - self.matches.extend( - self.options - .iter() - .enumerate() - .filter_map(|(index, option)| { - let text = option.filter_text(&self.editor_data); - - query - .fuzzy_match(&text, &self.matcher) - .map(|score| PickerMatch { - index, - score, - len: text.chars().count(), - }) - }), - ); - self.matches.sort_unstable(); + self.force_score(); } log::debug!("picker score {:?}", Instant::now().duration_since(now)); // reset cursor position self.cursor = 0; + let pattern = self.prompt.line(); self.previous_pattern.clone_from(pattern); } + pub fn force_score(&mut self) { + let pattern = self.prompt.line(); + + let query = FuzzyQuery::new(pattern); + self.matches.clear(); + self.matches.extend( + self.options + .iter() + .enumerate() + .filter_map(|(index, option)| { + let text = option.filter_text(&self.editor_data); + + query + .fuzzy_match(&text, &self.matcher) + .map(|score| PickerMatch { + index, + score, + len: text.chars().count(), + }) + }), + ); + self.matches.sort_unstable(); + } + /// Move the cursor by a number of lines, either down (`Forward`) or up (`Backward`) pub fn move_by(&mut self, amount: usize, direction: Direction) { let len = self.matches.len(); From 914d2944997e11cf76eeabfe43f9031aeb2b1721 Mon Sep 17 00:00:00 2001 From: Gokul Soumya Date: Tue, 19 Jul 2022 21:49:02 +0530 Subject: [PATCH 240/491] Add DynamicPicker for updating options on every key --- helix-term/src/ui/mod.rs | 2 +- helix-term/src/ui/overlay.rs | 4 ++ helix-term/src/ui/picker.rs | 74 +++++++++++++++++++++++++++++++++++- 3 files changed, 78 insertions(+), 2 deletions(-) diff --git a/helix-term/src/ui/mod.rs b/helix-term/src/ui/mod.rs index 107e48dd1ca3..5b5924bff0e8 100644 --- a/helix-term/src/ui/mod.rs +++ b/helix-term/src/ui/mod.rs @@ -19,7 +19,7 @@ pub use completion::Completion; pub use editor::EditorView; pub use markdown::Markdown; pub use menu::Menu; -pub use picker::{FileLocation, FilePicker, Picker}; +pub use picker::{DynamicPicker, FileLocation, FilePicker, Picker}; pub use popup::Popup; pub use prompt::{Prompt, PromptEvent}; pub use spinner::{ProgressSpinners, Spinner}; diff --git a/helix-term/src/ui/overlay.rs b/helix-term/src/ui/overlay.rs index 0b8a93ae833d..5b2bc806093d 100644 --- a/helix-term/src/ui/overlay.rs +++ b/helix-term/src/ui/overlay.rs @@ -69,4 +69,8 @@ impl Component for Overlay { let dimensions = (self.calc_child_size)(area); self.content.cursor(dimensions, ctx) } + + fn id(&self) -> Option<&'static str> { + self.content.id() + } } diff --git a/helix-term/src/ui/picker.rs b/helix-term/src/ui/picker.rs index 8b5d20eca6b8..821a282cf61f 100644 --- a/helix-term/src/ui/picker.rs +++ b/helix-term/src/ui/picker.rs @@ -3,6 +3,7 @@ use crate::{ ctrl, key, shift, ui::{self, fuzzy_match::FuzzyQuery, EditorView}, }; +use futures_util::future::BoxFuture; use tui::{ buffer::Buffer as Surface, widgets::{Block, BorderType, Borders}, @@ -22,7 +23,7 @@ use helix_view::{ Document, DocumentId, Editor, }; -use super::menu::Item; +use super::{menu::Item, overlay::Overlay}; pub const MIN_AREA_WIDTH_FOR_PREVIEW: u16 = 72; /// Biggest file size to preview in bytes @@ -751,3 +752,74 @@ impl Component for Picker { self.prompt.cursor(area, editor) } } + +/// Returns a new list of options to replace the contents of the picker +/// when called with the current picker query, +pub type DynQueryCallback = + Box BoxFuture<'static, anyhow::Result>>>; + +/// A picker that updates its contents via a callback whenever the +/// query string changes. Useful for live grep, workspace symbols, etc. +pub struct DynamicPicker { + file_picker: FilePicker, + query_callback: DynQueryCallback, +} + +impl DynamicPicker { + pub const ID: &'static str = "dynamic-picker"; + + pub fn new(file_picker: FilePicker, query_callback: DynQueryCallback) -> Self { + Self { + file_picker, + query_callback, + } + } +} + +impl Component for DynamicPicker { + fn render(&mut self, area: Rect, surface: &mut Surface, cx: &mut Context) { + self.file_picker.render(area, surface, cx); + } + + fn handle_event(&mut self, event: &Event, cx: &mut Context) -> EventResult { + let prev_query = self.file_picker.picker.prompt.line().to_owned(); + let event_result = self.file_picker.handle_event(event, cx); + let current_query = self.file_picker.picker.prompt.line(); + + if *current_query == prev_query || matches!(event_result, EventResult::Ignored(_)) { + return event_result; + } + + let new_options = (self.query_callback)(current_query.to_owned(), cx.editor); + + cx.jobs.callback(async move { + let new_options = new_options.await?; + let callback = + crate::job::Callback::EditorCompositor(Box::new(move |_editor, compositor| { + // Wrapping of pickers in overlay is done outside the picker code, + // so this is fragile and will break if wrapped in some other widget. + let picker = match compositor.find_id::>>(Self::ID) { + Some(overlay) => &mut overlay.content.file_picker.picker, + None => return, + }; + picker.options = new_options; + picker.cursor = 0; + picker.force_score(); + })); + anyhow::Ok(callback) + }); + EventResult::Consumed(None) + } + + fn cursor(&self, area: Rect, ctx: &Editor) -> (Option, CursorKind) { + self.file_picker.cursor(area, ctx) + } + + fn required_size(&mut self, viewport: (u16, u16)) -> Option<(u16, u16)> { + self.file_picker.required_size(viewport) + } + + fn id(&self) -> Option<&'static str> { + Some(Self::ID) + } +} From d1f717eb8d02205ce224292f157bfe1bddd1f6db Mon Sep 17 00:00:00 2001 From: Gokul Soumya Date: Tue, 19 Jul 2022 22:15:03 +0530 Subject: [PATCH 241/491] Re-request workspace symbols on keypress in picker Most language servers limit the number of workspace symbols that are returned with an empty query even though all symbols are supposed to be returned, according to the spec (for perfomance reasons). This patch adds a workspace symbol picker based on a dynamic picker that allows re-requesting the symbols on every keypress (i.e. when the picker query text changes). The old behavior has been completely replaced, and I have only tested with rust-analyzer so far. --- helix-term/src/commands/lsp.rs | 50 ++++++++++++++++++++++++++++++---- 1 file changed, 45 insertions(+), 5 deletions(-) diff --git a/helix-term/src/commands/lsp.rs b/helix-term/src/commands/lsp.rs index 810e3adf1115..8052dcac2f48 100644 --- a/helix-term/src/commands/lsp.rs +++ b/helix-term/src/commands/lsp.rs @@ -1,3 +1,4 @@ +use futures_util::FutureExt; use helix_lsp::{ block_on, lsp::{self, CodeAction, CodeActionOrCommand, DiagnosticSeverity, NumberOrString}, @@ -14,7 +15,8 @@ use helix_view::{apply_transaction, document::Mode, editor::Action, theme::Style use crate::{ compositor::{self, Compositor}, ui::{ - self, lsp::SignatureHelp, overlay::overlayed, FileLocation, FilePicker, Popup, PromptEvent, + self, lsp::SignatureHelp, overlay::overlayed, DynamicPicker, FileLocation, FilePicker, + Popup, PromptEvent, }, }; @@ -384,10 +386,48 @@ pub fn workspace_symbol_picker(cx: &mut Context) { cx.callback( future, move |_editor, compositor, response: Option>| { - if let Some(symbols) = response { - let picker = sym_picker(symbols, current_url, offset_encoding); - compositor.push(Box::new(overlayed(picker))) - } + let symbols = match response { + Some(s) => s, + None => return, + }; + let picker = sym_picker(symbols, current_url, offset_encoding); + let get_symbols = |query: String, editor: &mut Editor| { + let doc = doc!(editor); + let language_server = match doc.language_server() { + Some(s) => s, + None => { + // This should not generally happen since the picker will not + // even open in the first place if there is no server. + return async move { Err(anyhow::anyhow!("LSP not active")) }.boxed(); + } + }; + let symbol_request = match language_server.workspace_symbols(query) { + Some(future) => future, + None => { + // This should also not happen since the language server must have + // supported workspace symbols before to reach this block. + return async move { + Err(anyhow::anyhow!( + "Language server does not support workspace symbols" + )) + } + .boxed(); + } + }; + + let future = async move { + let json = symbol_request.await?; + let response: Option> = + serde_json::from_value(json)?; + + response.ok_or_else(|| { + anyhow::anyhow!("No response for workspace symbols from language server") + }) + }; + future.boxed() + }; + let dyn_picker = DynamicPicker::new(picker, Box::new(get_symbols)); + compositor.push(Box::new(overlayed(dyn_picker))) }, ) } From a7daa02346789e43af51db2b944b0dc516354a29 Mon Sep 17 00:00:00 2001 From: Michael Davis Date: Wed, 7 Dec 2022 16:27:31 -0600 Subject: [PATCH 242/491] DynamicPicker: Use idle-timeout as debounce This change uses the idle-timeout event to trigger fetching new results in the DynamicPicker, so idle-timeout becomes a sort of debounce. This prevents querying the language server overly aggressively. --- helix-term/src/ui/picker.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/helix-term/src/ui/picker.rs b/helix-term/src/ui/picker.rs index 821a282cf61f..35597843bbf3 100644 --- a/helix-term/src/ui/picker.rs +++ b/helix-term/src/ui/picker.rs @@ -763,6 +763,7 @@ pub type DynQueryCallback = pub struct DynamicPicker { file_picker: FilePicker, query_callback: DynQueryCallback, + query: String, } impl DynamicPicker { @@ -772,6 +773,7 @@ impl DynamicPicker { Self { file_picker, query_callback, + query: String::new(), } } } @@ -782,14 +784,15 @@ impl Component for DynamicPicker { } fn handle_event(&mut self, event: &Event, cx: &mut Context) -> EventResult { - let prev_query = self.file_picker.picker.prompt.line().to_owned(); let event_result = self.file_picker.handle_event(event, cx); let current_query = self.file_picker.picker.prompt.line(); - if *current_query == prev_query || matches!(event_result, EventResult::Ignored(_)) { + if !matches!(event, Event::IdleTimeout) || self.query == *current_query { return event_result; } + self.query.clone_from(current_query); + let new_options = (self.query_callback)(current_query.to_owned(), cx.editor); cx.jobs.callback(async move { From 35cf972ce459eda6ceffb7a7c256a4bc9f4e6e39 Mon Sep 17 00:00:00 2001 From: Michael Davis Date: Wed, 7 Dec 2022 16:24:32 -0600 Subject: [PATCH 243/491] DynamicPicker: Reset idle timeout on refresh If the new results shown by the picker select a file that hasn't been previewed before, the idle timeout would not trigger highlighting on that file. With this change, we reset the idle timeout and allow that file to be highlighted on the next idle timeout event. --- helix-term/src/ui/picker.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/helix-term/src/ui/picker.rs b/helix-term/src/ui/picker.rs index 35597843bbf3..2d471aae6e8e 100644 --- a/helix-term/src/ui/picker.rs +++ b/helix-term/src/ui/picker.rs @@ -798,7 +798,7 @@ impl Component for DynamicPicker { cx.jobs.callback(async move { let new_options = new_options.await?; let callback = - crate::job::Callback::EditorCompositor(Box::new(move |_editor, compositor| { + crate::job::Callback::EditorCompositor(Box::new(move |editor, compositor| { // Wrapping of pickers in overlay is done outside the picker code, // so this is fragile and will break if wrapped in some other widget. let picker = match compositor.find_id::>>(Self::ID) { @@ -808,6 +808,7 @@ impl Component for DynamicPicker { picker.options = new_options; picker.cursor = 0; picker.force_score(); + editor.reset_idle_timer(); })); anyhow::Ok(callback) }); From 2a60de74f9ccc935fa65031cfe30c62cf07bbbaf Mon Sep 17 00:00:00 2001 From: Michael Davis Date: Thu, 8 Dec 2022 19:54:15 -0600 Subject: [PATCH 244/491] workspace symbols: Default to empty Vec on None A language server might send None as the response to workspace symbols. We should treat this as the empty Vec rather than the server sending an error status. This fixes the interaction with gopls which uses None to mean no matching symbols. --- helix-term/src/commands/lsp.rs | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/helix-term/src/commands/lsp.rs b/helix-term/src/commands/lsp.rs index 8052dcac2f48..86b0c5fa7417 100644 --- a/helix-term/src/commands/lsp.rs +++ b/helix-term/src/commands/lsp.rs @@ -386,10 +386,7 @@ pub fn workspace_symbol_picker(cx: &mut Context) { cx.callback( future, move |_editor, compositor, response: Option>| { - let symbols = match response { - Some(s) => s, - None => return, - }; + let symbols = response.unwrap_or_default(); let picker = sym_picker(symbols, current_url, offset_encoding); let get_symbols = |query: String, editor: &mut Editor| { let doc = doc!(editor); @@ -420,9 +417,7 @@ pub fn workspace_symbol_picker(cx: &mut Context) { let response: Option> = serde_json::from_value(json)?; - response.ok_or_else(|| { - anyhow::anyhow!("No response for workspace symbols from language server") - }) + Ok(response.unwrap_or_default()) }; future.boxed() }; From 42ad1a9e043e2e0fb148924ff79b9abbe06907ae Mon Sep 17 00:00:00 2001 From: Michael Davis Date: Thu, 15 Dec 2022 02:57:31 -0600 Subject: [PATCH 245/491] Select diagnostic range in goto_*_diag commands (#4713) This roughly matches the behavior of the diagnostic picker: when jumping to a diagnostic with `[d`/`]d`/`[D`/`]D`, the range of the diagnostic is selected instead of the start point. --- helix-term/src/commands.rs | 50 +++++++++++++++++--------------------- 1 file changed, 22 insertions(+), 28 deletions(-) diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index 1310417e47be..0f04ecba6c31 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -2789,35 +2789,28 @@ fn exit_select_mode(cx: &mut Context) { } } -fn goto_pos(editor: &mut Editor, pos: usize) { - let (view, doc) = current!(editor); - - push_jump(view, doc); - doc.set_selection(view.id, Selection::point(pos)); - align_view(doc, view, Align::Center); -} - fn goto_first_diag(cx: &mut Context) { - let doc = doc!(cx.editor); - let pos = match doc.diagnostics().first() { - Some(diag) => diag.range.start, + let (view, doc) = current!(cx.editor); + let selection = match doc.diagnostics().first() { + Some(diag) => Selection::single(diag.range.start, diag.range.end), None => return, }; - goto_pos(cx.editor, pos); + doc.set_selection(view.id, selection); + align_view(doc, view, Align::Center); } fn goto_last_diag(cx: &mut Context) { - let doc = doc!(cx.editor); - let pos = match doc.diagnostics().last() { - Some(diag) => diag.range.start, + let (view, doc) = current!(cx.editor); + let selection = match doc.diagnostics().last() { + Some(diag) => Selection::single(diag.range.start, diag.range.end), None => return, }; - goto_pos(cx.editor, pos); + doc.set_selection(view.id, selection); + align_view(doc, view, Align::Center); } fn goto_next_diag(cx: &mut Context) { - let editor = &mut cx.editor; - let (view, doc) = current!(editor); + let (view, doc) = current!(cx.editor); let cursor_pos = doc .selection(view.id) @@ -2830,17 +2823,16 @@ fn goto_next_diag(cx: &mut Context) { .find(|diag| diag.range.start > cursor_pos) .or_else(|| doc.diagnostics().first()); - let pos = match diag { - Some(diag) => diag.range.start, + let selection = match diag { + Some(diag) => Selection::single(diag.range.start, diag.range.end), None => return, }; - - goto_pos(editor, pos); + doc.set_selection(view.id, selection); + align_view(doc, view, Align::Center); } fn goto_prev_diag(cx: &mut Context) { - let editor = &mut cx.editor; - let (view, doc) = current!(editor); + let (view, doc) = current!(cx.editor); let cursor_pos = doc .selection(view.id) @@ -2854,12 +2846,14 @@ fn goto_prev_diag(cx: &mut Context) { .find(|diag| diag.range.start < cursor_pos) .or_else(|| doc.diagnostics().last()); - let pos = match diag { - Some(diag) => diag.range.start, + let selection = match diag { + // NOTE: the selection is reversed because we're jumping to the + // previous diagnostic. + Some(diag) => Selection::single(diag.range.end, diag.range.start), None => return, }; - - goto_pos(editor, pos); + doc.set_selection(view.id, selection); + align_view(doc, view, Align::Center); } fn goto_first_change(cx: &mut Context) { From f916915b53fa6fedd3f9106bcf58163083cc052e Mon Sep 17 00:00:00 2001 From: Roberto Vidal Date: Thu, 15 Dec 2022 09:59:34 +0100 Subject: [PATCH 246/491] add redraw command (#4354) * add redraw command * update docs * Update helix-term/src/commands/typed.rs Co-authored-by: Michael Davis * update docs Co-authored-by: Michael Davis --- book/src/generated/typable-cmd.md | 1 + helix-term/src/commands/typed.rs | 29 +++++++++++++++++++++++++++++ helix-term/src/compositor.rs | 4 ++++ 3 files changed, 34 insertions(+) diff --git a/book/src/generated/typable-cmd.md b/book/src/generated/typable-cmd.md index 66e6ac039c26..269d63e37ce5 100644 --- a/book/src/generated/typable-cmd.md +++ b/book/src/generated/typable-cmd.md @@ -73,3 +73,4 @@ | `:pipe` | Pipe each selection to the shell command. | | `:pipe-to` | Pipe each selection to the shell command, ignoring output. | | `:run-shell-command`, `:sh` | Run a shell command | +| `:redraw` | Clear and re-render the whole UI | diff --git a/helix-term/src/commands/typed.rs b/helix-term/src/commands/typed.rs index cb387fcb5b64..90dde7e144e6 100644 --- a/helix-term/src/commands/typed.rs +++ b/helix-term/src/commands/typed.rs @@ -1808,6 +1808,28 @@ fn run_shell_command( Ok(()) } +fn redraw( + cx: &mut compositor::Context, + _args: &[Cow], + event: PromptEvent, +) -> anyhow::Result<()> { + if event != PromptEvent::Validate { + return Ok(()); + } + + let callback = Box::pin(async move { + let call: job::Callback = Box::new(|_editor, compositor| { + compositor.clear().expect("unable to redraw"); + }); + + Ok(call) + }); + + cx.jobs.callback(callback); + + Ok(()) +} + pub const TYPABLE_COMMAND_LIST: &[TypableCommand] = &[ TypableCommand { name: "quit", @@ -2323,6 +2345,13 @@ pub const TYPABLE_COMMAND_LIST: &[TypableCommand] = &[ fun: run_shell_command, completer: Some(completers::directory), }, + TypableCommand { + name: "redraw", + aliases: &[], + doc: "Clear and re-render the whole UI", + fun: redraw, + completer: None, + }, ]; pub static TYPABLE_COMMAND_MAP: Lazy> = diff --git a/helix-term/src/compositor.rs b/helix-term/src/compositor.rs index 9dad36209c62..18620b7bb29c 100644 --- a/helix-term/src/compositor.rs +++ b/helix-term/src/compositor.rs @@ -197,6 +197,10 @@ impl Compositor { .find(|component| component.id() == Some(id)) .and_then(|component| component.as_any_mut().downcast_mut()) } + + pub fn clear(&mut self) -> std::io::Result<()> { + self.terminal.clear() + } } // View casting, taken straight from Cursive From 5c4a9cba9a14ca10437e979c884d2ccba78ef1e7 Mon Sep 17 00:00:00 2001 From: Sebastian Zivota Date: Thu, 15 Dec 2022 14:20:26 +0100 Subject: [PATCH 247/491] Restore deleted goto_pos function (#5164) --- helix-term/src/commands.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index 0f04ecba6c31..6cf494646d85 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -2789,6 +2789,14 @@ fn exit_select_mode(cx: &mut Context) { } } +fn goto_pos(editor: &mut Editor, pos: usize) { + let (view, doc) = current!(editor); + + push_jump(view, doc); + doc.set_selection(view.id, Selection::point(pos)); + align_view(doc, view, Align::Center); +} + fn goto_first_diag(cx: &mut Context) { let (view, doc) = current!(cx.editor); let selection = match doc.diagnostics().first() { From ec9aa6690244bccefac24037c9f7a659816bffdd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bla=C5=BE=20Hrastnik?= Date: Thu, 15 Dec 2022 22:23:06 +0900 Subject: [PATCH 248/491] Remove redraw to fix build --- book/src/generated/typable-cmd.md | 1 - helix-term/src/commands/typed.rs | 29 ----------------------------- helix-term/src/compositor.rs | 4 ---- 3 files changed, 34 deletions(-) diff --git a/book/src/generated/typable-cmd.md b/book/src/generated/typable-cmd.md index 269d63e37ce5..66e6ac039c26 100644 --- a/book/src/generated/typable-cmd.md +++ b/book/src/generated/typable-cmd.md @@ -73,4 +73,3 @@ | `:pipe` | Pipe each selection to the shell command. | | `:pipe-to` | Pipe each selection to the shell command, ignoring output. | | `:run-shell-command`, `:sh` | Run a shell command | -| `:redraw` | Clear and re-render the whole UI | diff --git a/helix-term/src/commands/typed.rs b/helix-term/src/commands/typed.rs index 90dde7e144e6..cb387fcb5b64 100644 --- a/helix-term/src/commands/typed.rs +++ b/helix-term/src/commands/typed.rs @@ -1808,28 +1808,6 @@ fn run_shell_command( Ok(()) } -fn redraw( - cx: &mut compositor::Context, - _args: &[Cow], - event: PromptEvent, -) -> anyhow::Result<()> { - if event != PromptEvent::Validate { - return Ok(()); - } - - let callback = Box::pin(async move { - let call: job::Callback = Box::new(|_editor, compositor| { - compositor.clear().expect("unable to redraw"); - }); - - Ok(call) - }); - - cx.jobs.callback(callback); - - Ok(()) -} - pub const TYPABLE_COMMAND_LIST: &[TypableCommand] = &[ TypableCommand { name: "quit", @@ -2345,13 +2323,6 @@ pub const TYPABLE_COMMAND_LIST: &[TypableCommand] = &[ fun: run_shell_command, completer: Some(completers::directory), }, - TypableCommand { - name: "redraw", - aliases: &[], - doc: "Clear and re-render the whole UI", - fun: redraw, - completer: None, - }, ]; pub static TYPABLE_COMMAND_MAP: Lazy> = diff --git a/helix-term/src/compositor.rs b/helix-term/src/compositor.rs index 18620b7bb29c..9dad36209c62 100644 --- a/helix-term/src/compositor.rs +++ b/helix-term/src/compositor.rs @@ -197,10 +197,6 @@ impl Compositor { .find(|component| component.id() == Some(id)) .and_then(|component| component.as_any_mut().downcast_mut()) } - - pub fn clear(&mut self) -> std::io::Result<()> { - self.terminal.clear() - } } // View casting, taken straight from Cursive From 3e6887648c386372839e29028a3459d4674ce68b Mon Sep 17 00:00:00 2001 From: alice Date: Fri, 16 Dec 2022 15:43:58 +0100 Subject: [PATCH 249/491] set 'c++' as a recognised extension for cpp (#5183) --- languages.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/languages.toml b/languages.toml index e28476d3118a..d03726e72a91 100644 --- a/languages.toml +++ b/languages.toml @@ -190,7 +190,7 @@ source = { git = "https://github.com/tree-sitter/tree-sitter-c", rev = "7175a6dd name = "cpp" scope = "source.cpp" injection-regex = "cpp" -file-types = ["cc", "hh", "cpp", "hpp", "h", "ipp", "tpp", "cxx", "hxx", "ixx", "txx", "ino"] +file-types = ["cc", "hh", "c++", "cpp", "hpp", "h", "ipp", "tpp", "cxx", "hxx", "ixx", "txx", "ino"] roots = [] comment-token = "//" language-server = { command = "clangd" } From 9c9c775a27f23b2fa5c8c856af0b15671916efd6 Mon Sep 17 00:00:00 2001 From: Ifiok Jr Date: Sat, 17 Dec 2022 15:09:14 +0000 Subject: [PATCH 250/491] Fix a typo in the docs (#5191) --- book/src/keymap.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/book/src/keymap.md b/book/src/keymap.md index 139e8fddf613..153294007ee6 100644 --- a/book/src/keymap.md +++ b/book/src/keymap.md @@ -317,7 +317,7 @@ Mappings in the style of [vim-unimpaired](https://github.com/tpope/vim-unimpaire | `]c` | Go to next comment (**TS**) | `goto_next_comment` | | `[c` | Go to previous comment (**TS**) | `goto_prev_comment` | | `]T` | Go to next test (**TS**) | `goto_next_test` | -| `]T` | Go to previous test (**TS**) | `goto_prev_test` | +| `[T` | Go to previous test (**TS**) | `goto_prev_test` | | `]p` | Go to next paragraph | `goto_next_paragraph` | | `[p` | Go to previous paragraph | `goto_prev_paragraph` | | `]g` | Go to next change | `goto_next_change` | From b12c65678aacc577b070c70307ef6fce528e4d85 Mon Sep 17 00:00:00 2001 From: Eric Thorburn <60004386+hyderix@users.noreply.github.com> Date: Sat, 17 Dec 2022 20:03:18 +0100 Subject: [PATCH 251/491] Print the binary required by the debug adapter (#5195) This commit addresses issue 5193, where the author requested that the name of the binary needed is printed along with the rest of the health information. This commit adds a format! macro which formats in the name of the binary and then it will be printed along with the rest of the debug information. The value in cmd is referenced to the call to which, and then consumed upon the call to format! --- helix-term/src/health.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/helix-term/src/health.rs b/helix-term/src/health.rs index e8fbb84d0982..6558fe19fb4c 100644 --- a/helix-term/src/health.rs +++ b/helix-term/src/health.rs @@ -281,9 +281,9 @@ fn probe_protocol(protocol_name: &str, server_cmd: Option) -> std::io::R writeln!(stdout, "Configured {}: {}", protocol_name, cmd_name)?; if let Some(cmd) = server_cmd { - let path = match which::which(cmd) { + let path = match which::which(&cmd) { Ok(path) => path.display().to_string().green(), - Err(_) => "Not found in $PATH".to_string().red(), + Err(_) => format!("'{}' not found in $PATH", cmd).red(), }; writeln!(stdout, "Binary for {}: {}", protocol_name, path)?; } From e6a2df8c798537a7dc5aff264eeccc773525aa6c Mon Sep 17 00:00:00 2001 From: Alex Kladov Date: Sat, 17 Dec 2022 19:30:43 +0000 Subject: [PATCH 252/491] Better sorting in picker in case of ties (#5169) --- helix-term/src/ui/mod.rs | 3 ++- helix-term/src/ui/picker.rs | 19 +++++++++++++------ 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/helix-term/src/ui/mod.rs b/helix-term/src/ui/mod.rs index 5b5924bff0e8..ade1d8cf4c7f 100644 --- a/helix-term/src/ui/mod.rs +++ b/helix-term/src/ui/mod.rs @@ -207,13 +207,14 @@ pub fn file_picker(root: PathBuf, config: &helix_view::editor::Config) -> FilePi // Cap the number of files if we aren't in a git project, preventing // hangs when using the picker in your home directory - let files: Vec<_> = if root.join(".git").exists() { + let mut files: Vec = if root.join(".git").exists() { files.collect() } else { // const MAX: usize = 8192; const MAX: usize = 100_000; files.take(MAX).collect() }; + files.sort(); log::debug!("file_picker init {:?}", Instant::now().duration_since(now)); diff --git a/helix-term/src/ui/picker.rs b/helix-term/src/ui/picker.rs index 2d471aae6e8e..aad3f81ceac3 100644 --- a/helix-term/src/ui/picker.rs +++ b/helix-term/src/ui/picker.rs @@ -12,7 +12,10 @@ use tui::{ use fuzzy_matcher::skim::SkimMatcherV2 as Matcher; use tui::widgets::Widget; -use std::{cmp::Ordering, time::Instant}; +use std::{ + cmp::{self, Ordering}, + time::Instant, +}; use std::{collections::HashMap, io::Read, path::PathBuf}; use crate::ui::{Prompt, PromptEvent}; @@ -344,11 +347,17 @@ impl Component for FilePicker { #[derive(PartialEq, Eq, Debug)] struct PickerMatch { - index: usize, score: i64, + index: usize, len: usize, } +impl PickerMatch { + fn key(&self) -> impl Ord { + (cmp::Reverse(self.score), self.len, self.index) + } +} + impl PartialOrd for PickerMatch { fn partial_cmp(&self, other: &Self) -> Option { Some(self.cmp(other)) @@ -357,10 +366,7 @@ impl PartialOrd for PickerMatch { impl Ord for PickerMatch { fn cmp(&self, other: &Self) -> Ordering { - self.score - .cmp(&other.score) - .reverse() - .then_with(|| self.len.cmp(&other.len)) + self.key().cmp(&other.key()) } } @@ -502,6 +508,7 @@ impl Picker { }) }), ); + self.matches.sort_unstable(); } From aecb524e503363c2eed2a5a72d8fd881aae18e4b Mon Sep 17 00:00:00 2001 From: Jonas Everaert <62475953+Jomy10@users.noreply.github.com> Date: Sat, 17 Dec 2022 20:34:00 +0100 Subject: [PATCH 253/491] Crystal language support (#4993) --- book/src/generated/lang-support.md | 1 + languages.toml | 12 +++++ runtime/queries/crystal/highlights.scm | 66 ++++++++++++++++++++++++++ 3 files changed, 79 insertions(+) create mode 100644 runtime/queries/crystal/highlights.scm diff --git a/book/src/generated/lang-support.md b/book/src/generated/lang-support.md index 1400fa875795..73e0bfcd5f6a 100644 --- a/book/src/generated/lang-support.md +++ b/book/src/generated/lang-support.md @@ -16,6 +16,7 @@ | common-lisp | ✓ | | | `cl-lsp` | | cpon | ✓ | | ✓ | | | cpp | ✓ | ✓ | ✓ | `clangd` | +| crystal | ✓ | | | | | css | ✓ | | | `vscode-css-language-server` | | cue | ✓ | | | `cuelsp` | | d | ✓ | ✓ | ✓ | `serve-d` | diff --git a/languages.toml b/languages.toml index d03726e72a91..42495e5c08da 100644 --- a/languages.toml +++ b/languages.toml @@ -223,6 +223,18 @@ args = { console = "internalConsole", attachCommands = [ "platform select remote name = "cpp" source = { git = "https://github.com/tree-sitter/tree-sitter-cpp", rev = "d5e90fba898f320db48d81ddedd78d52c67c1fed" } +[[language]] +name = "crystal" +scope = "source.cr" +file-types = ["cr"] +roots = ["shard.yml", "shard.lock"] +comment-token = "#" +indent = { tab-width = 2, unit = " " } + +[[grammar]] +name = "crystal" +source = { git = "https://github.com/will/tree-sitter-crystal", rev = "15597b307b18028b04d288561f9c29794621562b" } + [[language]] name = "c-sharp" scope = "source.csharp" diff --git a/runtime/queries/crystal/highlights.scm b/runtime/queries/crystal/highlights.scm new file mode 100644 index 000000000000..33a53e7f94cb --- /dev/null +++ b/runtime/queries/crystal/highlights.scm @@ -0,0 +1,66 @@ +[ + "class" + "struct" + "module" + + "def" + "alias" + "do" + "end" + + "require" + "include" + "extend" +] @keyword + +[ + "[" "]" + "(" ")" + "{" "}" +] @punctuation.bracket + +(operator) @operator + +(comment) @comment + +; literals + +(nil) @constant.builtin +(bool) @constant.builtin.boolean + +(integer) @constant.numeric.integer +(float) @constant.numeric.float + +[ + (string) + (char) + (commandLiteral) +] @string + +(symbol) @string.special.symbol + +(regex) @string.special.regex + +; variables + +(local_variable) @variable + +[ + (instance_variable) + (class_variable) +] @variable.other.member + +(constant) @constant + +; type defintitions + +(type_identifier) @constructor + +; method definition/call +(identifier) @function.method + +; types +(generic_type) @type +(union_type) @type +(type_identifier) @type + From 042d03269ecbe68e0461548bcf6918324c967bbb Mon Sep 17 00:00:00 2001 From: g-s-k Date: Sat, 17 Dec 2022 20:44:08 +0100 Subject: [PATCH 254/491] Add support for MATLAB/Octave files (#5192) --- book/src/generated/lang-support.md | 1 + languages.toml | 13 ++++ runtime/queries/matlab/highlights.scm | 97 +++++++++++++++++++++++++++ 3 files changed, 111 insertions(+) create mode 100644 runtime/queries/matlab/highlights.scm diff --git a/book/src/generated/lang-support.md b/book/src/generated/lang-support.md index 73e0bfcd5f6a..1a3aed79b914 100644 --- a/book/src/generated/lang-support.md +++ b/book/src/generated/lang-support.md @@ -78,6 +78,7 @@ | make | ✓ | | | | | markdown | ✓ | | | `marksman` | | markdown.inline | ✓ | | | | +| matlab | ✓ | | | | | mermaid | ✓ | | | | | meson | ✓ | | ✓ | | | mint | | | | `mint` | diff --git a/languages.toml b/languages.toml index 42495e5c08da..8972a6e94389 100644 --- a/languages.toml +++ b/languages.toml @@ -2068,3 +2068,16 @@ indent = { tab-width = 4, unit = " " } [[grammar]] name = "mermaid" source = { git = "https://github.com/monaqa/tree-sitter-mermaid", rev = "d787c66276e7e95899230539f556e8b83ee16f6d" } + +[[language]] +name = "matlab" +scope = "source.m" +file-types = ["m"] +comment-token = "%" +shebangs = ["octave-cli", "matlab"] +roots = [] +indent = { tab-width = 2, unit = " " } + +[[grammar]] +name = "matlab" +source = { git = "https://github.com/mstanciu552/tree-sitter-matlab", rev = "2d5d3d5193718a86477d4335aba5b34e79147326" } diff --git a/runtime/queries/matlab/highlights.scm b/runtime/queries/matlab/highlights.scm new file mode 100644 index 000000000000..c0e23e917541 --- /dev/null +++ b/runtime/queries/matlab/highlights.scm @@ -0,0 +1,97 @@ + ; highlights.scm + +function_keyword: (function_keyword) @keyword.function + +(function_definition +function_name: (identifier) @function +(end) @function) + +(parameter_list (identifier) @variable.parameter) + +[ + "if" + "elseif" + "else" + "switch" + "case" + "otherwise" +] @keyword.control.conditional + +(if_statement (end) @keyword.control.conditional) +(switch_statement (end) @keyword.control.conditional) + +["for" "while"] @keyword.control.repeat +(for_statement (end) @keyword.control.repeat) +(while_statement (end) @keyword.control.repeat) + +["try" "catch"] @keyword.control.exception +(try_statement (end) @keyword.control.exception) + +(function_definition end: (end) @keyword) + +["return" "break" "continue"] @keyword.return + +( +(identifier) @constant.builtin +(#any-of? @constant.builtin "true" "false") +) + +( + (identifier) @constant.builtin + (#eq? @constant.builtin "end") +) + +;; Punctuations + +[";" ","] @punctuation.special +(argument_list "," @punctuation.delimiter) +(vector_definition ["," ";"] @punctuation.delimiter) +(cell_definition ["," ";"] @punctuation.delimiter) +":" @punctuation.delimiter +(parameter_list "," @punctuation.delimiter) +(return_value "," @punctuation.delimiter) + +; ;; Brackets + +[ + "(" + ")" + "[" + "]" + "{" + "}" +] @punctuation.bracket + +;; Operators +"=" @operator +(operation [ ">" + "<" + "==" + "<=" + ">=" + "=<" + "=>" + "~=" + "*" + ".*" + "/" + "\\" + "./" + "^" + ".^" + "+"] @operator) + +;; boolean operator +[ + "&&" + "||" +] @operator + +;; Number +(number) @constant.numeric + +;; String +(string) @string + +;; Comment +(comment) @comment From 24cd7f6adf7a46b8386583b17f01839eb592a2eb Mon Sep 17 00:00:00 2001 From: Jonathan LEI Date: Sat, 10 Dec 2022 09:56:12 +0000 Subject: [PATCH 255/491] Make prompt suggestions greyed out --- book/src/themes.md | 1 + helix-term/src/ui/prompt.rs | 19 ++++++++++++++----- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/book/src/themes.md b/book/src/themes.md index 322caea54b48..0f94828ebb9d 100644 --- a/book/src/themes.md +++ b/book/src/themes.md @@ -268,6 +268,7 @@ These scopes are used for theming the editor interface. | `ui.help` | Description box for commands | | `ui.text` | Command prompts, popup text, etc. | | `ui.text.focus` | | +| `ui.text.inactive` | Same as `ui.text` but when the text is inactive (e.g. suggestions) | | `ui.text.info` | The key: command text in `ui.popup.info` boxes | | `ui.virtual.ruler` | Ruler columns (see the [`editor.rulers` config][editor-section]) | | `ui.virtual.whitespace` | Visible whitespace characters | diff --git a/helix-term/src/ui/prompt.rs b/helix-term/src/ui/prompt.rs index b19b9a9fce90..5fb6745a90e5 100644 --- a/helix-term/src/ui/prompt.rs +++ b/helix-term/src/ui/prompt.rs @@ -352,6 +352,7 @@ impl Prompt { let prompt_color = theme.get("ui.text"); let completion_color = theme.get("ui.menu"); let selected_color = theme.get("ui.menu.selected"); + let suggestion_color = theme.get("ui.text.inactive"); // completion let max_len = self @@ -450,21 +451,29 @@ impl Prompt { // render buffer text surface.set_string(area.x, area.y + line, &self.prompt, prompt_color); - let input: Cow = if self.line.is_empty() { + let (input, is_suggestion): (Cow, bool) = if self.line.is_empty() { // latest value in the register list - self.history_register + match self + .history_register .and_then(|reg| cx.editor.registers.last(reg)) .map(|entry| entry.into()) - .unwrap_or_else(|| Cow::from("")) + { + Some(value) => (value, true), + None => (Cow::from(""), false), + } } else { - self.line.as_str().into() + (self.line.as_str().into(), false) }; surface.set_string( area.x + self.prompt.len() as u16, area.y + line, &input, - prompt_color, + if is_suggestion { + suggestion_color + } else { + prompt_color + }, ); } } From ba3c24aa0268735ac57321442d458ab6a1ac662c Mon Sep 17 00:00:00 2001 From: Jonathan LEI Date: Sat, 10 Dec 2022 09:56:37 +0000 Subject: [PATCH 256/491] Set ui.text.inactive for official themes --- base16_theme.toml | 1 + theme.toml | 1 + 2 files changed, 2 insertions(+) diff --git a/base16_theme.toml b/base16_theme.toml index 63fc2f790e72..268a38df61bd 100644 --- a/base16_theme.toml +++ b/base16_theme.toml @@ -7,6 +7,7 @@ "ui.linenr.selected" = { fg = "white", bg = "black", modifiers = ["bold"] } "ui.selection" = { fg = "black", bg = "blue" } "ui.selection.primary" = { fg = "white", bg = "blue" } +"ui.text.inactive" = { fg = "gray" } "comment" = { fg = "gray" } "ui.statusline" = { fg = "black", bg = "white" } "ui.statusline.inactive" = { fg = "gray", bg = "white" } diff --git a/theme.toml b/theme.toml index 054093195a87..c7b5dc84e7e0 100644 --- a/theme.toml +++ b/theme.toml @@ -54,6 +54,7 @@ label = "honey" "ui.text" = { fg = "lavender" } "ui.text.focus" = { fg = "white" } +"ui.text.inactive" = "sirocco" "ui.virtual" = { fg = "comet" } "ui.virtual.indent-guide" = { fg = "comet" } From 99b346a9238b9e7c5b9b93abdf787213c4d67f92 Mon Sep 17 00:00:00 2001 From: Lukas Werling Date: Mon, 19 Dec 2022 18:00:47 +0100 Subject: [PATCH 257/491] tutor: Fix typos in 8.2 (#5213) --- runtime/tutor | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/runtime/tutor b/runtime/tutor index 418c4195487e..885ea0bffcc9 100644 --- a/runtime/tutor +++ b/runtime/tutor @@ -848,13 +848,13 @@ lines. Ensure your cursor is on the '>' of the arrow. 2. Type Q to start recording. 3. Edit the line to look like the bottom one. - 4. Exit insert and Type Q again to stop recording. + 4. Exit insert and type Q again to stop recording. 5. Move to the line below and put your cursor on '>' again. 6. Type q to repeat the macro. - --> ... sentence doesn't have it's first and last ... . - --> ... sentence doesn't have it's first and last ... . - This sentence doesn't have it's first and last word. + --> ... sentence doesn't have its first and last ... . + --> ... sentence doesn't have its first and last ... . + This sentence doesn't have its first and last word. ================================================================= = CHAPTER 8 RECAP = From 45c58961424cca35bcab692b49949d45d917ef7e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 19 Dec 2022 17:16:26 -0600 Subject: [PATCH 258/491] build(deps): bump anyhow from 1.0.66 to 1.0.68 (#5222) Bumps [anyhow](https://github.com/dtolnay/anyhow) from 1.0.66 to 1.0.68. - [Release notes](https://github.com/dtolnay/anyhow/releases) - [Commits](https://github.com/dtolnay/anyhow/compare/1.0.66...1.0.68) --- updated-dependencies: - dependency-name: anyhow dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6ae0a71f8c1b..52ed478fb6d7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -51,9 +51,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.66" +version = "1.0.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "216261ddc8289130e551ddcd5ce8a064710c0d064a4d2895c67151c92b5443f6" +checksum = "2cb2f989d18dd141ab8ae82f64d1a8cdd37e0840f73a406896cf5e99502fab61" [[package]] name = "arc-swap" From bcb78c9382af059ccd89dd3c53a1846f2fff1d6c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 19 Dec 2022 17:21:30 -0600 Subject: [PATCH 259/491] build(deps): bump toml from 0.5.9 to 0.5.10 (#5224) Bumps [toml](https://github.com/toml-rs/toml) from 0.5.9 to 0.5.10. - [Release notes](https://github.com/toml-rs/toml/releases) - [Commits](https://github.com/toml-rs/toml/commits/toml-v0.5.10) --- updated-dependencies: - dependency-name: toml dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 52ed478fb6d7..3f4b081cba36 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2142,9 +2142,9 @@ dependencies = [ [[package]] name = "toml" -version = "0.5.9" +version = "0.5.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d82e1a7758622a465f8cee077614c73484dac5b836c02ff6a40d5d1010324d7" +checksum = "1333c76748e868a4d9d1017b5ab53171dfd095f70c712fdb4653a406547f598f" dependencies = [ "serde", ] From 453c7b46993c7ecf2eb8c0549b93085907c6d6c9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 19 Dec 2022 17:21:51 -0600 Subject: [PATCH 260/491] build(deps): bump thiserror from 1.0.37 to 1.0.38 (#5223) Bumps [thiserror](https://github.com/dtolnay/thiserror) from 1.0.37 to 1.0.38. - [Release notes](https://github.com/dtolnay/thiserror/releases) - [Commits](https://github.com/dtolnay/thiserror/compare/1.0.37...1.0.38) --- updated-dependencies: - dependency-name: thiserror dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Cargo.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 3f4b081cba36..7e98a0f75e21 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2018,18 +2018,18 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.37" +version = "1.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10deb33631e3c9018b9baf9dcbbc4f737320d2b576bac10f6aefa048fa407e3e" +checksum = "6a9cd18aa97d5c45c6603caea1da6628790b37f7a34b6ca89522331c5180fed0" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.37" +version = "1.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "982d17546b47146b28f7c22e3d08465f6b8903d0ea13c1660d9d84a6e7adcdbb" +checksum = "1fb327af4685e4d03fa8cbcf1716380da910eeb2bb8be417e7f9fd3fb164f36f" dependencies = [ "proc-macro2", "quote", From 38fd20c858d166ce9e5b421722b18dc9f7d8810f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 19 Dec 2022 17:22:27 -0600 Subject: [PATCH 261/491] build(deps): bump indoc from 1.0.7 to 1.0.8 (#5226) Bumps [indoc](https://github.com/dtolnay/indoc) from 1.0.7 to 1.0.8. - [Release notes](https://github.com/dtolnay/indoc/releases) - [Commits](https://github.com/dtolnay/indoc/compare/1.0.7...1.0.8) --- updated-dependencies: - dependency-name: indoc dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Cargo.lock | 4 ++-- helix-term/Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7e98a0f75e21..1b4572bba57c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1386,9 +1386,9 @@ dependencies = [ [[package]] name = "indoc" -version = "1.0.7" +version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adab1eaa3408fb7f0c777a73e7465fd5656136fc93b670eb6df3c88c2c1344e3" +checksum = "da2d6f23ffea9d7e76c53eee25dfb67bcd8fde7f1198b0855350698c9f07c780" [[package]] name = "instant" diff --git a/helix-term/Cargo.toml b/helix-term/Cargo.toml index 30bfc7ea38a3..9f2e5188d78a 100644 --- a/helix-term/Cargo.toml +++ b/helix-term/Cargo.toml @@ -78,5 +78,5 @@ helix-loader = { version = "0.6", path = "../helix-loader" } [dev-dependencies] smallvec = "1.10" -indoc = "1.0.6" +indoc = "1.0.8" tempfile = "3.3.0" From f7a9717088fd00f875f03ff89e7229e64eb7f5fd Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 19 Dec 2022 17:24:26 -0600 Subject: [PATCH 262/491] build(deps): bump serde_json from 1.0.89 to 1.0.91 (#5225) Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.89 to 1.0.91. - [Release notes](https://github.com/serde-rs/json/releases) - [Commits](https://github.com/serde-rs/json/compare/v1.0.89...v1.0.91) --- updated-dependencies: - dependency-name: serde_json dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1b4572bba57c..e00e1f6381ba 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1825,9 +1825,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.89" +version = "1.0.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "020ff22c755c2ed3f8cf162dbb41a7268d934702f3ed3631656ea597e08fc3db" +checksum = "877c235533714907a8c2464236f5c4b2a17262ef1bd71f38f35ea592c8da6883" dependencies = [ "itoa", "ryu", From 03baec8a2d83de59d7e8ada655022e4f81d1fa68 Mon Sep 17 00:00:00 2001 From: Yusuf Bera Ertan Date: Tue, 20 Dec 2022 02:36:56 +0300 Subject: [PATCH 263/491] build(nix): update inputs (#5219) --- flake.lock | 70 ++++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 55 insertions(+), 15 deletions(-) diff --git a/flake.lock b/flake.lock index f097519e34af..4cf1018c4999 100644 --- a/flake.lock +++ b/flake.lock @@ -3,11 +3,11 @@ "crane": { "flake": false, "locked": { - "lastModified": 1661875961, - "narHash": "sha256-f1h/2c6Teeu1ofAHWzrS8TwBPcnN+EEu+z1sRVmMQTk=", + "lastModified": 1670900067, + "narHash": "sha256-VXVa+KBfukhmWizaiGiHRVX/fuk66P8dgSFfkVN4/MY=", "owner": "ipetkov", "repo": "crane", - "rev": "d9f394e4e20e97c2a60c3ad82c2b6ef99be19e24", + "rev": "59b31b41a589c0a65e4a1f86b0e5eac68081468b", "type": "github" }, "original": { @@ -45,6 +45,7 @@ "nci", "devshell" ], + "flake-parts": "flake-parts", "flake-utils-pre-commit": [ "nci" ], @@ -57,6 +58,9 @@ "mach-nix": [ "nci" ], + "nix-pypi-fetcher": [ + "nci" + ], "nixpkgs": [ "nci", "nixpkgs" @@ -69,11 +73,11 @@ ] }, "locked": { - "lastModified": 1668851003, - "narHash": "sha256-X7RCQQynbxStZR2m7HW38r/msMQwVl3afD6UXOCtvx4=", + "lastModified": 1671323629, + "narHash": "sha256-9KHTPjIDjfnzZ4NjpE3gGIVHVHopy6weRDYO/7Y3hF8=", "owner": "nix-community", "repo": "dream2nix", - "rev": "c77e8379d8fe01213ba072e40946cbfb7b58e628", + "rev": "2d7d68505c8619410df2c6b6463985f97cbcba6e", "type": "github" }, "original": { @@ -82,6 +86,24 @@ "type": "github" } }, + "flake-parts": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib" + }, + "locked": { + "lastModified": 1668450977, + "narHash": "sha256-cfLhMhnvXn6x1vPm+Jow3RiFAUSCw/l1utktCw5rVA4=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "d591857e9d7dd9ddbfba0ea02b43b927c3c0f1fa", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, "flake-utils": { "locked": { "lastModified": 1659877975, @@ -109,11 +131,11 @@ ] }, "locked": { - "lastModified": 1669011203, - "narHash": "sha256-Lymj4HktNEFmVXtwI0Os7srDXHZbZW0Nzw3/+5Hf8ko=", + "lastModified": 1671430291, + "narHash": "sha256-UIc7H8F3N8rK72J/Vj5YJdV72tvDvYjH+UPsOFvlcsE=", "owner": "yusdacra", "repo": "nix-cargo-integration", - "rev": "c5133b91fc1d549087c91228bd213f2518728a4b", + "rev": "b1b0d38b8c3b0d0e6a38638d5bbe10b0bc67522c", "type": "github" }, "original": { @@ -124,11 +146,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1668905981, - "narHash": "sha256-RBQa/+9Uk1eFTqIOXBSBezlEbA3v5OkgP+qptQs1OxY=", + "lastModified": 1671359686, + "narHash": "sha256-3MpC6yZo+Xn9cPordGz2/ii6IJpP2n8LE8e/ebUXLrs=", "owner": "nixos", "repo": "nixpkgs", - "rev": "690ffff026b4e635b46f69002c0f4e81c65dfc2e", + "rev": "04f574a1c0fde90b51bf68198e2297ca4e7cccf4", "type": "github" }, "original": { @@ -138,6 +160,24 @@ "type": "github" } }, + "nixpkgs-lib": { + "locked": { + "dir": "lib", + "lastModified": 1665349835, + "narHash": "sha256-UK4urM3iN80UXQ7EaOappDzcisYIuEURFRoGQ/yPkug=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "34c5293a71ffdb2fe054eb5288adc1882c1eb0b1", + "type": "github" + }, + "original": { + "dir": "lib", + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, "root": { "inputs": { "nci": "nci", @@ -153,11 +193,11 @@ ] }, "locked": { - "lastModified": 1668998422, - "narHash": "sha256-G/BklIplCHZEeDIabaaxqgITdIXtMolRGlwxn9jG2/Q=", + "lastModified": 1671416426, + "narHash": "sha256-kpSH1Jrxfk2qd0pRPJn1eQdIOseGv5JuE+YaOrqU9s4=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "68ab029c93f8f8eed4cf3ce9a89a9fd4504b2d6e", + "rev": "fbaaff24f375ac25ec64268b0a0d63f91e474b7d", "type": "github" }, "original": { From a7146f58f00b7d15f584c630ca6e123793a0a051 Mon Sep 17 00:00:00 2001 From: farwyler <1705805+farwyler@users.noreply.github.com> Date: Tue, 20 Dec 2022 00:40:08 +0100 Subject: [PATCH 264/491] Add missing comment injection for nix (#5208) --- runtime/queries/nix/injections.scm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/runtime/queries/nix/injections.scm b/runtime/queries/nix/injections.scm index 82d79cc762c6..a1a0ebb88620 100644 --- a/runtime/queries/nix/injections.scm +++ b/runtime/queries/nix/injections.scm @@ -1,3 +1,6 @@ +((comment) @injection.content + (#set! injection.language "comment")) + ; mark arbitary languages with a comment ((((comment) @injection.language) . (indented_string_expression (string_fragment) @injection.content)) From bdeefbfb23077fcbbfe1e7df6c6ac88516244bbc Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 19 Dec 2022 17:49:23 -0600 Subject: [PATCH 265/491] build(deps): bump serde from 1.0.150 to 1.0.151 (#5221) Bumps [serde](https://github.com/serde-rs/serde) from 1.0.150 to 1.0.151. - [Release notes](https://github.com/serde-rs/serde/releases) - [Commits](https://github.com/serde-rs/serde/compare/v1.0.150...v1.0.151) --- updated-dependencies: - dependency-name: serde dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Cargo.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e00e1f6381ba..a6ca94954c00 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1805,18 +1805,18 @@ checksum = "9c8132065adcfd6e02db789d9285a0deb2f3fcb04002865ab67d5fb103533898" [[package]] name = "serde" -version = "1.0.150" +version = "1.0.151" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e326c9ec8042f1b5da33252c8a37e9ffbd2c9bef0155215b6e6c80c790e05f91" +checksum = "97fed41fc1a24994d044e6db6935e69511a1153b52c15eb42493b26fa87feba0" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.150" +version = "1.0.151" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42a3df25b0713732468deadad63ab9da1f1fd75a48a15024b50363f128db627e" +checksum = "255abe9a125a985c05190d687b320c12f9b1f0b99445e608c21ba0782c719ad8" dependencies = [ "proc-macro2", "quote", From 6ab8591715daf932d0dc45d0d5fb9e5a272f2fe1 Mon Sep 17 00:00:00 2001 From: Chirikumbrah <78883260+Chirikumbrah@users.noreply.github.com> Date: Wed, 21 Dec 2022 02:33:14 +0300 Subject: [PATCH 266/491] Better diagnostics highlighting for Dracula theme. (#5236) --- runtime/themes/dracula.toml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/runtime/themes/dracula.toml b/runtime/themes/dracula.toml index 90bdb446bd0a..0f459311c3ff 100644 --- a/runtime/themes/dracula.toml +++ b/runtime/themes/dracula.toml @@ -55,6 +55,9 @@ "markup.quote" = { fg = "yellow", modifiers = ["italic"] } "markup.raw" = { fg = "foreground" } +"diagnostic".underline = { color = "orange", style = "curl" } +"diagnostic.error".underline = { color = "red", style = "curl" } + [palette] background = "#282a36" background_dark = "#21222c" From d0a5e11c28a3ad2533b79e2922ca06aa7036516c Mon Sep 17 00:00:00 2001 From: LeoniePhiline <22329650+LeoniePhiline@users.noreply.github.com> Date: Thu, 22 Dec 2022 00:10:12 +0100 Subject: [PATCH 267/491] fix(theme): Replace invalid `cyan` by `blue` in line with original theme (#5250) --- runtime/themes/monokai_pro_spectrum.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/themes/monokai_pro_spectrum.toml b/runtime/themes/monokai_pro_spectrum.toml index 89575e3a1414..f5787ca8c3b1 100644 --- a/runtime/themes/monokai_pro_spectrum.toml +++ b/runtime/themes/monokai_pro_spectrum.toml @@ -53,7 +53,7 @@ "constructor" = "blue" "function" = "green" "function.macro" = { fg = "blue" } -"function.builtin" = { fg = "cyan" } +"function.builtin" = { fg = "blue" } # operator, tags, units, punctuations "operator" = "red" From c4263d6a56c6490b34a43c7d393fce321514b6ef Mon Sep 17 00:00:00 2001 From: Chickenkeeper Date: Wed, 21 Dec 2022 23:10:45 +0000 Subject: [PATCH 268/491] Fix & Tweak Rust's Syntax Highlighting (#5238) --- runtime/queries/rust/highlights.scm | 31 ++++++++--------------------- 1 file changed, 8 insertions(+), 23 deletions(-) diff --git a/runtime/queries/rust/highlights.scm b/runtime/queries/rust/highlights.scm index d3c292708b63..66058034b79d 100644 --- a/runtime/queries/rust/highlights.scm +++ b/runtime/queries/rust/highlights.scm @@ -45,7 +45,8 @@ "'" @label (identifier) @label) (loop_label - (identifier) @type) + "'" @label + (identifier) @label) ; --- ; Punctuation @@ -102,8 +103,6 @@ (closure_parameters (identifier) @variable.parameter) - - ; ------- ; Keywords ; ------- @@ -129,9 +128,7 @@ [ "break" "continue" - "return" - "await" ] @keyword.control.return @@ -154,10 +151,7 @@ "trait" "for" - "unsafe" "default" - "macro_rules!" - "async" ] @keyword @@ -165,13 +159,13 @@ "struct" "enum" "union" - "type" ] @keyword.storage.type "let" @keyword.storage - "fn" @keyword.function +"unsafe" @keyword.special +"macro_rules!" @function.macro (mutable_specifier) @keyword.storage.modifier.mut @@ -202,11 +196,11 @@ (call_expression function: [ - ((identifier) @type.variant - (#match? @type.variant "^[A-Z]")) + ((identifier) @type.enum.variant + (#match? @type.enum.variant "^[A-Z]")) (scoped_identifier - name: ((identifier) @type.variant - (#match? @type.variant "^[A-Z]"))) + name: ((identifier) @type.enum.variant + (#match? @type.enum.variant "^[A-Z]"))) ]) ; --- @@ -237,8 +231,6 @@ ((identifier) @type (#match? @type "^[A-Z]")) - - (attribute (identifier) @_macro arguments: (token_tree (identifier) @constant.numeric.integer) @@ -246,7 +238,6 @@ ) @special - ; ------- ; Functions ; ------- @@ -303,8 +294,6 @@ (metavariable) @variable.parameter (fragment_specifier) @type - - ; ------- ; Operators ; ------- @@ -350,8 +339,6 @@ "'" ] @operator - - ; ------- ; Paths ; ------- @@ -382,8 +369,6 @@ (scoped_type_identifier path: (identifier) @namespace) - - ; ------- ; Remaining Identifiers ; ------- From 7905086b55eac2a817c16fe3a9ab987e718324c8 Mon Sep 17 00:00:00 2001 From: Michael Davis Date: Thu, 22 Dec 2022 19:21:02 -0600 Subject: [PATCH 269/491] Fix HTML injection within markdown (#5265) HTML nodes should be combined injections in the markdown block grammar. When nodes are together the highlighting works properly but when there is markdown content between HTML nodes like in a `
` tag, the highlighting of the closing tag breaks since tree-sitter-html looks for opening and closing tags. --- runtime/queries/markdown/injections.scm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/runtime/queries/markdown/injections.scm b/runtime/queries/markdown/injections.scm index e184db157aa6..e88393512f59 100644 --- a/runtime/queries/markdown/injections.scm +++ b/runtime/queries/markdown/injections.scm @@ -5,7 +5,10 @@ (language) @injection.language) (code_fence_content) @injection.content (#set! injection.include-unnamed-children)) -((html_block) @injection.content (#set! injection.language "html") (#set! injection.include-unnamed-children)) +((html_block) @injection.content + (#set! injection.language "html") + (#set! injection.include-unnamed-children) + (#set! injection.combined)) ((pipe_table_cell) @injection.content (#set! injection.language "markdown.inline") (#set! injection.include-unnamed-children)) From 7a1fa0c74fb2c3b7b1c9aea9aa77c5c612e0bd12 Mon Sep 17 00:00:00 2001 From: Gioele De Vitti Date: Fri, 23 Dec 2022 02:12:49 +0000 Subject: [PATCH 270/491] tutor: Add a content cycling section (#5161) --- runtime/tutor | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/runtime/tutor b/runtime/tutor index 885ea0bffcc9..1fc5605eab02 100644 --- a/runtime/tutor +++ b/runtime/tutor @@ -985,11 +985,33 @@ lines. --> How much would would a wouldchuck chuck --> if a wouldchuck could chuck would? - Note: Additionally, Alt-( and Alt-) cycle the *contents* of the - selections as well. + + + +================================================================= += 10.2 CYCLING THE CONTENT OF SELECTIONS = +================================================================= + + Type Alt-) and Alt-( to cycle the content of the selections + forward and backward respectively. + + 1. Move the cursor to the line marked '-->' below. + 2. Select both lines with xx or 2x. + 3. Type s to select, type "through|water|know" and enter. + 4. Use Alt-( and Alt-) to cycle the content of the selections. + + --> Jumping through the water, + --> daring to know. + + + + + + + ================================================================= -= 10.2 CHANGING CASE = += 10.3 CHANGING CASE = ================================================================= Type ~ to switch the case of all selected letters. @@ -1011,7 +1033,7 @@ lines. --> THIS sentence should ALL BE IN uppercase! ================================================================= -= 10.3 SPLITTING SELECTIONS = += 10.4 SPLITTING SELECTIONS = ================================================================= Type S to split each selection on a regex pattern. @@ -1039,6 +1061,7 @@ letters! that is not good grammar. you can fix this. * Use ) and ( to cycle the primary selection back and forward through selections respectively. * Type Alt-, to remove the primary selection. + * Type Alt-) and Alt-( to cycle the content of the selections. * Type ~ to alternate case of selected letters. * Use ` and Alt-` to set the case of selected letters to @@ -1053,7 +1076,6 @@ letters! that is not good grammar. you can fix this. - ================================================================= = = ================================================================= From 1b89d3e5350f83b2ffb86a86326bd2714308ee53 Mon Sep 17 00:00:00 2001 From: Jack Allison Date: Thu, 22 Dec 2022 21:23:34 -0500 Subject: [PATCH 271/491] Add file picker dialogue when opening a directory with :o (#2707) --- helix-term/src/commands/typed.rs | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/helix-term/src/commands/typed.rs b/helix-term/src/commands/typed.rs index cb387fcb5b64..c3a7c9faabd9 100644 --- a/helix-term/src/commands/typed.rs +++ b/helix-term/src/commands/typed.rs @@ -65,12 +65,28 @@ fn open(cx: &mut compositor::Context, args: &[Cow], event: PromptEvent) -> ensure!(!args.is_empty(), "wrong argument count"); for arg in args { let (path, pos) = args::parse_file(arg); - let _ = cx.editor.open(&path, Action::Replace)?; - let (view, doc) = current!(cx.editor); - let pos = Selection::point(pos_at_coords(doc.text().slice(..), pos, true)); - doc.set_selection(view.id, pos); - // does not affect opening a buffer without pos - align_view(doc, view, Align::Center); + // If the path is a directory, open a file picker on that directory and update the status + // message + if std::fs::canonicalize(&path)?.is_dir() { + let callback = async move { + let call: job::Callback = job::Callback::EditorCompositor(Box::new( + move |editor: &mut Editor, compositor: &mut Compositor| { + let picker = ui::file_picker(path, &editor.config()); + compositor.push(Box::new(overlayed(picker))); + }, + )); + Ok(call) + }; + cx.jobs.callback(callback); + } else { + // Otherwise, just open the file + let _ = cx.editor.open(&path, Action::Replace)?; + let (view, doc) = current!(cx.editor); + let pos = Selection::point(pos_at_coords(doc.text().slice(..), pos, true)); + doc.set_selection(view.id, pos); + // does not affect opening a buffer without pos + align_view(doc, view, Align::Center); + } } Ok(()) } From 1107296ca9bfd728258a4571be35eb7c811ff3b3 Mon Sep 17 00:00:00 2001 From: DylanBulfin <31492860+DylanBulfin@users.noreply.github.com> Date: Thu, 22 Dec 2022 21:27:20 -0500 Subject: [PATCH 272/491] Add command to merge consecutive ranges in selection (#5047) --- book/src/keymap.md | 1 + helix-core/src/selection.rs | 95 ++++++++++++++++++++++++++++---- helix-term/src/commands.rs | 7 +++ helix-term/src/keymap/default.rs | 1 + 4 files changed, 92 insertions(+), 12 deletions(-) diff --git a/book/src/keymap.md b/book/src/keymap.md index 153294007ee6..272c758b6317 100644 --- a/book/src/keymap.md +++ b/book/src/keymap.md @@ -111,6 +111,7 @@ | `s` | Select all regex matches inside selections | `select_regex` | | `S` | Split selection into subselections on regex matches | `split_selection` | | `Alt-s` | Split selection on newlines | `split_selection_on_newline` | +| `Alt-_ ` | Merge consecutive selections | `merge_consecutive_selections` | | `&` | Align selection in columns | `align_selections` | | `_` | Trim whitespace from the selection | `trim_selections` | | `;` | Collapse selection onto a single cursor | `collapse_selection` | diff --git a/helix-core/src/selection.rs b/helix-core/src/selection.rs index 1f28ecefb750..ffba46ab70ef 100644 --- a/helix-core/src/selection.rs +++ b/helix-core/src/selection.rs @@ -495,28 +495,53 @@ impl Selection { /// Normalizes a `Selection`. fn normalize(mut self) -> Self { - let primary = self.ranges[self.primary_index]; + let mut primary = self.ranges[self.primary_index]; self.ranges.sort_unstable_by_key(Range::from); + + self.ranges.dedup_by(|curr_range, prev_range| { + if prev_range.overlaps(curr_range) { + let new_range = curr_range.merge(*prev_range); + if prev_range == &primary || curr_range == &primary { + primary = new_range; + } + *prev_range = new_range; + true + } else { + false + } + }); + self.primary_index = self .ranges .iter() .position(|&range| range == primary) .unwrap(); - let mut prev_i = 0; - for i in 1..self.ranges.len() { - if self.ranges[prev_i].overlaps(&self.ranges[i]) { - self.ranges[prev_i] = self.ranges[prev_i].merge(self.ranges[i]); + self + } + + // Merges all ranges that are consecutive + pub fn merge_consecutive_ranges(mut self) -> Self { + let mut primary = self.ranges[self.primary_index]; + + self.ranges.dedup_by(|curr_range, prev_range| { + if prev_range.to() == curr_range.from() { + let new_range = curr_range.merge(*prev_range); + if prev_range == &primary || curr_range == &primary { + primary = new_range; + } + *prev_range = new_range; + true } else { - prev_i += 1; - self.ranges[prev_i] = self.ranges[i]; + false } - if i == self.primary_index { - self.primary_index = prev_i; - } - } + }); - self.ranges.truncate(prev_i + 1); + self.primary_index = self + .ranges + .iter() + .position(|&range| range == primary) + .unwrap(); self } @@ -1132,6 +1157,52 @@ mod test { &["", "abcd", "efg", "rs", "xyz"] ); } + + #[test] + fn test_merge_consecutive_ranges() { + let selection = Selection::new( + smallvec![ + Range::new(0, 1), + Range::new(1, 10), + Range::new(15, 20), + Range::new(25, 26), + Range::new(26, 30) + ], + 4, + ); + + let result = selection.merge_consecutive_ranges(); + + assert_eq!( + result.ranges(), + &[Range::new(0, 10), Range::new(15, 20), Range::new(25, 30)] + ); + assert_eq!(result.primary_index, 2); + + let selection = Selection::new(smallvec![Range::new(0, 1)], 0); + let result = selection.merge_consecutive_ranges(); + + assert_eq!(result.ranges(), &[Range::new(0, 1)]); + assert_eq!(result.primary_index, 0); + + let selection = Selection::new( + smallvec![ + Range::new(0, 1), + Range::new(1, 5), + Range::new(5, 8), + Range::new(8, 10), + Range::new(10, 15), + Range::new(18, 25) + ], + 3, + ); + + let result = selection.merge_consecutive_ranges(); + + assert_eq!(result.ranges(), &[Range::new(0, 15), Range::new(18, 25)]); + assert_eq!(result.primary_index, 0); + } + #[test] fn test_selection_contains() { fn contains(a: Vec<(usize, usize)>, b: Vec<(usize, usize)>) -> bool { diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index 6cf494646d85..437e11b5c238 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -244,6 +244,7 @@ impl MappableCommand { select_regex, "Select all regex matches inside selections", split_selection, "Split selections on regex matches", split_selection_on_newline, "Split selection on newlines", + merge_consecutive_selections, "Merge consecutive selections", search, "Search for regex pattern", rsearch, "Reverse search for regex pattern", search_next, "Select next search match", @@ -1589,6 +1590,12 @@ fn split_selection_on_newline(cx: &mut Context) { doc.set_selection(view.id, selection); } +fn merge_consecutive_selections(cx: &mut Context) { + let (view, doc) = current!(cx.editor); + let selection = doc.selection(view.id).clone().merge_consecutive_ranges(); + doc.set_selection(view.id, selection); +} + #[allow(clippy::too_many_arguments)] fn search_impl( editor: &mut Editor, diff --git a/helix-term/src/keymap/default.rs b/helix-term/src/keymap/default.rs index ebcd125aa129..ef93dee08a77 100644 --- a/helix-term/src/keymap/default.rs +++ b/helix-term/src/keymap/default.rs @@ -76,6 +76,7 @@ pub fn default() -> HashMap { "s" => select_regex, "A-s" => split_selection_on_newline, + "A-_" => merge_consecutive_selections, "S" => split_selection, ";" => collapse_selection, "A-;" => flip_selections, From df1830ef28a7cb49abe31a18e4bd1bcfc7eb802a Mon Sep 17 00:00:00 2001 From: jliaoh <48660001+hunterliao29@users.noreply.github.com> Date: Thu, 22 Dec 2022 21:30:33 -0500 Subject: [PATCH 273/491] mouse operations respect scrolloff (#5255) --- helix-term/src/ui/editor.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/helix-term/src/ui/editor.rs b/helix-term/src/ui/editor.rs index fc201853f7dc..35cf77abc9bf 100644 --- a/helix-term/src/ui/editor.rs +++ b/helix-term/src/ui/editor.rs @@ -1155,6 +1155,7 @@ impl EditorView { } editor.focus(view_id); + editor.ensure_cursor_in_view(view_id); return EventResult::Consumed(None); } @@ -1191,7 +1192,8 @@ impl EditorView { let primary = selection.primary_mut(); *primary = primary.put_cursor(doc.text().slice(..), pos, true); doc.set_selection(view.id, selection); - + let view_id = view.id; + cxt.editor.ensure_cursor_in_view(view_id); EventResult::Consumed(None) } @@ -1213,6 +1215,7 @@ impl EditorView { commands::scroll(cxt, offset, direction); cxt.editor.tree.focus = current_view; + cxt.editor.ensure_cursor_in_view(current_view); EventResult::Consumed(None) } From b1ca7ddf89c048a8da0d6cfe507ac3344e6f625f Mon Sep 17 00:00:00 2001 From: cor Date: Fri, 23 Dec 2022 15:03:54 +0100 Subject: [PATCH 274/491] Use curl underlines in the rose_pine theme (#5267) Also fixes the color "gold" being used for too many kinds of diagnostics, now there's a more conventional choice of diagnostics colors (redish = error, yellowish = warning, blueish = hint). --- runtime/themes/rose_pine.toml | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/runtime/themes/rose_pine.toml b/runtime/themes/rose_pine.toml index 14e240dd505e..8558db3ab444 100644 --- a/runtime/themes/rose_pine.toml +++ b/runtime/themes/rose_pine.toml @@ -1,5 +1,6 @@ # Author: RayGervais # Author: ChrisHa +# Diagnostics patch author: cor "ui.background" = { bg = "base" } "ui.menu" = { fg = "text", bg = "overlay" } @@ -45,12 +46,18 @@ "diff.delta" = "rose" "diff.minus" = "love" -"info" = "gold" -"hint" = "gold" +"info" = "foam" +"hint" = "iris" "debug" = "rose" -"diagnostic" = "rose" +"warning" = "gold" "error" = "love" +"diagnostic" = { modifiers = ["underlined"] } +"diagnostic.error" = { underline = { style = "curl", color = "love" } } +"diagnostic.warning" = { underline = { style = "curl", color = "gold" } } +"diagnostic.info" = { underline = { style = "curl", color = "foam" } } +"diagnostic.hint" = { underline = { style = "curl", color = "iris" } } + "markup.heading.marker" = "subtle" "markup.heading.1" = { fg = "love", modifiers = ["bold"] } "markup.heading.2" = { fg = "gold", modifiers = ["bold"] } From 24c3b00d10858a02c6c1c351a7509e204c2bc647 Mon Sep 17 00:00:00 2001 From: Nick Date: Fri, 23 Dec 2022 19:43:05 +0530 Subject: [PATCH 275/491] Avoid trailing `s` in message when only 1 file is opened (#5189) --- helix-term/src/application.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/helix-term/src/application.rs b/helix-term/src/application.rs index 7a50e007b9b9..5f013b9af0a6 100644 --- a/helix-term/src/application.rs +++ b/helix-term/src/application.rs @@ -227,7 +227,11 @@ impl Application { doc.set_selection(view_id, pos); } } - editor.set_status(format!("Loaded {} files.", nr_of_files)); + editor.set_status(format!( + "Loaded {} file{}.", + nr_of_files, + if nr_of_files == 1 { "" } else { "s" } // avoid "Loaded 1 files." grammo + )); // align the view to center after all files are loaded, // does not affect views without pos since it is at the top let (view, doc) = current!(editor); From f0c6e6c9eeb1f2772571bcefe02bd344fa70d62f Mon Sep 17 00:00:00 2001 From: Erasin Date: Sat, 24 Dec 2022 19:30:44 +0800 Subject: [PATCH 276/491] fix comment token of godot resource file (#5276) --- languages.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/languages.toml b/languages.toml index 8972a6e94389..53f65be7cf05 100644 --- a/languages.toml +++ b/languages.toml @@ -1460,7 +1460,7 @@ file-types = ["tscn","tres"] shebangs = [] roots = ["project.godot"] auto-format = false -comment-token = "#" +comment-token = ";" indent = { tab-width = 4, unit = "\t" } [[grammar]] From eb4ec3271005e9de7960a4dd08a9efbb648cb89f Mon Sep 17 00:00:00 2001 From: alois31 <36605164+alois31@users.noreply.github.com> Date: Sat, 24 Dec 2022 14:50:39 +0100 Subject: [PATCH 277/491] Fix opening new files (#5278) Commit 1b89d3e5350f83b2ffb86a86326bd2714308ee53 introduced a regression where opening a new file would no longer work, because attempting to canonicalize its path would lead to a "No such file or directory" error. Fall back to opening a new file when encountering an error to fix this case. --- helix-term/src/commands/typed.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helix-term/src/commands/typed.rs b/helix-term/src/commands/typed.rs index c3a7c9faabd9..c2ca1a47811b 100644 --- a/helix-term/src/commands/typed.rs +++ b/helix-term/src/commands/typed.rs @@ -67,7 +67,7 @@ fn open(cx: &mut compositor::Context, args: &[Cow], event: PromptEvent) -> let (path, pos) = args::parse_file(arg); // If the path is a directory, open a file picker on that directory and update the status // message - if std::fs::canonicalize(&path)?.is_dir() { + if let Ok(true) = std::fs::canonicalize(&path).map(|p| p.is_dir()) { let callback = async move { let call: job::Callback = job::Callback::EditorCompositor(Box::new( move |editor: &mut Editor, compositor: &mut Compositor| { From 1af76b738dd5bdae14b025d07d3001c4ad23e071 Mon Sep 17 00:00:00 2001 From: Alex Kladov Date: Sat, 24 Dec 2022 21:55:16 +0000 Subject: [PATCH 278/491] Add eb word selection trick to the tutor (#5247) --- runtime/tutor | 34 ++++++++++++++++++++++++++++------ 1 file changed, 28 insertions(+), 6 deletions(-) diff --git a/runtime/tutor b/runtime/tutor index 1fc5605eab02..baf32c274e01 100644 --- a/runtime/tutor +++ b/runtime/tutor @@ -241,7 +241,7 @@ _________________________________________________________________ ================================================================= -= 3.2 MORE ON MOTIONS = += 3.2 MORE MOTIONS = ================================================================= As you saw, typing w moves the cursor forward until the start @@ -253,6 +253,19 @@ _________________________________________________________________ e - Move forward to the end of the current word. b - Move backward to the beginning of the current word. + To select the word under cursor, combine e and b. + + 1. Move the cursor to the line marked '-->' below. + 2. Move to a 'd' letter. + 3. Type e to select a half of the word. + 4. Type b to select the rest. + +--> The Middle Kingdom. + +================================================================= += 3.3 WORDS AND words = +================================================================= + The w,e,b motions also have counterparts - W,E,B - which traverse WORDS instead of words. WORDS are only separated by whitespace, whereas words can be separated by other characters @@ -262,8 +275,17 @@ _________________________________________________________________ + + + + + + + + + ================================================================= -= 3.3 THE CHANGE COMMAND = += 3.4 THE CHANGE COMMAND = ================================================================= Type c to change the current selection. @@ -285,7 +307,7 @@ _________________________________________________________________ ================================================================= -= 3.4 COUNTS WITH MOTIONS = += 3.5 COUNTS WITH MOTIONS = ================================================================= Type a number before a motion to repeat it that many times. @@ -307,7 +329,7 @@ _________________________________________________________________ ================================================================= -= 3.5 SELECT / EXTEND MODE = += 3.6 SELECT / EXTEND MODE = ================================================================= Type v to enter Select mode. @@ -329,7 +351,7 @@ _________________________________________________________________ ================================================================= -= 3.6 SELECTING LINES = += 3.7 SELECTING LINES = ================================================================= Type x to select a whole line. Type x again to select the next. @@ -351,7 +373,7 @@ _________________________________________________________________ subsequent lines. X on an empty line does nothing. ================================================================= -= 3.7 COLLAPSING SELECTIONS = += 3.8 COLLAPSING SELECTIONS = ================================================================= Type ; to collapse selections to single cursors. From a637461677bed1468af5a5d86c57113de3345247 Mon Sep 17 00:00:00 2001 From: "Soc Virnyl S. Estela" Date: Tue, 27 Dec 2022 03:11:42 +0800 Subject: [PATCH 279/491] tutor: add chapter for commenting lines (#5211) --- runtime/tutor | 50 +++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 49 insertions(+), 1 deletion(-) diff --git a/runtime/tutor b/runtime/tutor index baf32c274e01..408f74514cd0 100644 --- a/runtime/tutor +++ b/runtime/tutor @@ -1099,10 +1099,58 @@ letters! that is not good grammar. you can fix this. ================================================================= -= = += 11.1 COMMENTING A LINE = ================================================================= +Type Ctrl-c to comment the line under your cursor. +To uncomment the line, press Ctrl-c again. +1. Move your cursor to the line marked '-->' below. +2. Now comment the line marked with '-->'. +3. Now try uncommenting the line. + +--> Comment me please + + + + + + + + + + +================================================================= += 11.2 COMMENTING MULTIPLE LINES = +================================================================= + +Using the selections and multi-cursor functionality, you can +comment multiple lines as long as it is under the selection or +cursors. + +1. Move your cursor to the line marked with '-->' below. +2. Now try to select or add more cursors the other lines marked + with '-->'. +3. Comment those lines. + +--> How many are you going to comment? +--> Is this enough for a comment? +--> What are you doing?! +--> Stop commenting me! +--> AAAAaargh!!! + +Note: If there are already commented lines under selections or +multiple cursors, they won't be uncommented but commented again. + +================================================================= += CHAPTER 11 RECAP = +================================================================= + + * Use Ctrl-c to comment a line under your cursor. Type Ctrl-c + again to uncomment. + * To comment multiple lines, use the selections + and multi-cursors before typing Ctrl-c. + * Commented lines cannot be uncommented but commented again. From 792c2e3dbf1ae355f5cba829dff25d17d8b8c7d9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 26 Dec 2022 17:15:00 -0600 Subject: [PATCH 280/491] build(deps): bump git-repository from 0.29.0 to 0.30.2 (#5306) Bumps [git-repository](https://github.com/Byron/gitoxide) from 0.29.0 to 0.30.2. - [Release notes](https://github.com/Byron/gitoxide/releases) - [Changelog](https://github.com/Byron/gitoxide/blob/main/CHANGELOG.md) - [Commits](https://github.com/Byron/gitoxide/compare/git-repository-v0.29.0...git-repository-v0.30.2) --- updated-dependencies: - dependency-name: git-repository dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Cargo.lock | 207 +++++++++++++++++++++++-------------------- helix-vcs/Cargo.toml | 2 +- 2 files changed, 112 insertions(+), 97 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a6ca94954c00..1243bc51d1d2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -63,9 +63,9 @@ checksum = "983cd8b9d4b02a6dc6ffa557262eb5858a27a0038ffffe21a0f133eaa819a164" [[package]] name = "atoi" -version = "1.0.0" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7c57d12312ff59c811c0643f4d80830505833c9ffaebd193d819392b265be8e" +checksum = "f28d99ec8bfea296261ca1af174f24225171fea9664ba9003cbebee704810528" dependencies = [ "num-traits", ] @@ -120,16 +120,6 @@ version = "3.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "572f695136211188308f16ad2ca5c851a712c464060ae6974944458eb83880ba" -[[package]] -name = "byte-unit" -version = "4.0.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "581ad4b3d627b0c09a0ccb2912148f839acaca0b93cf54cbe42b6c674e86079c" -dependencies = [ - "serde", - "utf8-width", -] - [[package]] name = "bytecount" version = "0.6.3" @@ -211,9 +201,9 @@ dependencies = [ [[package]] name = "clru" -version = "0.5.0" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "218d6bd3dde8e442a975fa1cd233c0e5fded7596bccfe39f58eca98d22421e0a" +checksum = "b8191fa7302e03607ff0e237d4246cc043ff5b3cb9409d995172ba3bea16b807" [[package]] name = "codespan-reporting" @@ -280,7 +270,7 @@ dependencies = [ "futures-core", "libc", "mio", - "parking_lot", + "parking_lot 0.12.1", "signal-hook", "signal-hook-mio", "winapi", @@ -349,7 +339,7 @@ dependencies = [ "hashbrown 0.12.3", "lock_api", "once_cell", - "parking_lot_core", + "parking_lot_core 0.9.4", ] [[package]] @@ -551,9 +541,9 @@ dependencies = [ [[package]] name = "git-actor" -version = "0.14.1" +version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac9fb99c934ed45a62d9ae1e7b21949f2d869d1b82a07dcbf16ed61daa665870" +checksum = "7def29b46f25f95a2e196323cfb336eae9965e0a3c7c35ad9506f295c3a8e234" dependencies = [ "bstr 1.0.1", "btoi", @@ -565,9 +555,9 @@ dependencies = [ [[package]] name = "git-attributes" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82e98446a2bf0eb5c8f29fa828d6529510a6fadeb59ce14ca98e58fa7e1e0199" +checksum = "f0affaed361598fdd06b2a184a566c823d0b5817b09f576018248fb267193a96" dependencies = [ "bstr 1.0.1", "compact_str", @@ -608,9 +598,9 @@ dependencies = [ [[package]] name = "git-config" -version = "0.12.0" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd1d13179bcf3dd68e83404f91a8d01c618f54eb97ef36c68ee5e6f30183a681" +checksum = "5ff189268cfb19d5151529ac30b6b708072ebfa1075643d785232675456ec320" dependencies = [ "bstr 1.0.1", "git-config-value", @@ -629,9 +619,9 @@ dependencies = [ [[package]] name = "git-config-value" -version = "0.9.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64561e9700f1fc737fa3c1c4ea55293be70dba98e45c54cf3715cb180f37a566" +checksum = "989a90c1c630513a153c685b4249b96fdf938afc75bf7ef2ae1ccbd3d799f5db" dependencies = [ "bitflags", "bstr 1.0.1", @@ -642,9 +632,9 @@ dependencies = [ [[package]] name = "git-credentials" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "621dd60288ae7b8f80bb0704f46d4d2b76fc1ec980a7804e48b02d94a927e331" +checksum = "28da3d029be10258007699d002321a3b1ebe45e67b0e140a4cf464ba3ee79b32" dependencies = [ "bstr 1.0.1", "git-command", @@ -658,9 +648,9 @@ dependencies = [ [[package]] name = "git-date" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e33db9f4462b565a33507aee113f3383bf16b988d2c573f07691e34302b7aa0a" +checksum = "8a2874ce2f3a77cb144167901ea830969e5c991eac7bfee85e6e3f53ef9fcdf2" dependencies = [ "bstr 1.0.1", "itoa", @@ -670,9 +660,9 @@ dependencies = [ [[package]] name = "git-diff" -version = "0.23.0" +version = "0.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82f77407381267be95f1b26acfb32007258af342ee61729bb4271b1869bf5bb2" +checksum = "8f30011a43908645c492dfbea7b004e10528be6bd667bf5cdc12ff4297fe1e3c" dependencies = [ "git-hash", "git-object", @@ -682,9 +672,9 @@ dependencies = [ [[package]] name = "git-discover" -version = "0.9.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c2cfd1272824b126c6997ef479a71288d00fae14dc5144dfc48658f4dd24fbe" +checksum = "93c244b1cf7cf45501116e948506c25324e33ddc613f00557ff5bfded2132009" dependencies = [ "bstr 1.0.1", "git-hash", @@ -696,9 +686,9 @@ dependencies = [ [[package]] name = "git-features" -version = "0.24.1" +version = "0.25.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7bdbe755d2129bc609437b6b18af1116f146128dda6070c15c0aa50201ac17c" +checksum = "0f98e6ede7b790dfba16bf3c62861ae75c3719485d675b522cf7d7e748a4011c" dependencies = [ "crc32fast", "flate2", @@ -713,9 +703,9 @@ dependencies = [ [[package]] name = "git-glob" -version = "0.5.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef858611602fce54b51e45671ca72f07fe6a3c0e24a0539c66b75dfd4d84bd77" +checksum = "3908404c9b76ac7b3f636a104142378d3eaa78623cbc6eb7c7f0651979d48e8a" dependencies = [ "bitflags", "bstr 1.0.1", @@ -731,11 +721,21 @@ dependencies = [ "thiserror", ] +[[package]] +name = "git-hashtable" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c52b625ad8cc360a0b7f426266f21fb07bd49b8f4ccf1b3ca7bc89424db1dec4" +dependencies = [ + "git-hash", + "hashbrown 0.13.1", +] + [[package]] name = "git-index" -version = "0.9.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a87c32d2e012ee316d4037b2151e5893599379ff1fc2c6adb36d2d4d1c461e2c" +checksum = "20627f71f3a884b0ae50f9f3abb3a07d9b117d06e16110d25b85da4d71d478c0" dependencies = [ "atoi", "bitflags", @@ -766,9 +766,9 @@ dependencies = [ [[package]] name = "git-mailmap" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "480eecdfaf1bfd05973678520d182dc07afa25b133db18c52575fb65b782b7ba" +checksum = "f90e3ee2eaeebda8a12d17f4d99dff5b19d81536476020bcebb99ee121820466" dependencies = [ "bstr 1.0.1", "git-actor", @@ -777,9 +777,9 @@ dependencies = [ [[package]] name = "git-object" -version = "0.23.0" +version = "0.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce0f14f9cd8f0782e843898a2fb7b0c2f5a6e37bd4cdff4409bb8ec698597dad" +checksum = "35b658f1e3e149d88cb3e0a2234be749bb0cab65887405975dbe6f3190cf6571" dependencies = [ "bstr 1.0.1", "btoi", @@ -796,9 +796,9 @@ dependencies = [ [[package]] name = "git-odb" -version = "0.37.0" +version = "0.38.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13493da6cf0326454215414d29f933a1e26bdba3b9b60ad8cdcbe06f0639584b" +checksum = "55333419bbb25aa6d39e29155f747ad8e1777fe385f70f447be9d680824d23dd" dependencies = [ "arc-swap", "git-features", @@ -807,16 +807,16 @@ dependencies = [ "git-pack", "git-path", "git-quote", - "parking_lot", + "parking_lot 0.12.1", "tempfile", "thiserror", ] [[package]] name = "git-pack" -version = "0.27.0" +version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa8391cbf293f0f8ffbb5e324f25741f5e1e2d35fb87b89ab222a025661e0454" +checksum = "9ed3c9af66949553af9795b9eac9d450a5bdceee9959352cda468997ddce0d2f" dependencies = [ "bytesize", "clru", @@ -825,22 +825,22 @@ dependencies = [ "git-diff", "git-features", "git-hash", + "git-hashtable", "git-object", "git-path", "git-tempfile", "git-traverse", - "hash_hasher", "memmap2", - "parking_lot", + "parking_lot 0.12.1", "smallvec", "thiserror", ] [[package]] name = "git-path" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f60cbc13bc0fdd95df5f4b80437197e2853116792894b1bf38d1a6b4a64f8c9" +checksum = "e40e68481a06da243d3f4dfd86a4be39c24eefb535017a862e845140dcdb878a" dependencies = [ "bstr 1.0.1", "thiserror", @@ -848,14 +848,14 @@ dependencies = [ [[package]] name = "git-prompt" -version = "0.2.0" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21c6aaeb3f0f8de91f5e0eb950282c6508e05babcedef768db5a6f085d6e5242" +checksum = "3612a486e507dd431ef0f7108eeaafc8fd1ed7bd0f205a88554f6f91fe5dccbf" dependencies = [ "git-command", "git-config-value", "nix", - "parking_lot", + "parking_lot 0.12.1", "thiserror", ] @@ -872,9 +872,9 @@ dependencies = [ [[package]] name = "git-ref" -version = "0.20.0" +version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22484043921e699edc170415789f1b882c8f3546e1fbbc447a0043ef07e088c4" +checksum = "c97b7d719e4320179fb64d081016e7faca56fed4a8ee4cf84e4697faad9235a3" dependencies = [ "git-actor", "git-features", @@ -891,9 +891,9 @@ dependencies = [ [[package]] name = "git-refspec" -version = "0.4.0" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac2e8f36e7d5d48903b60051dfb75aedfc4ea9ba66bdffa7a9081e8d276b0107" +checksum = "d478e9db0956d60cd386d3348b5ec093e3ae613105a7a75ff6084b886254eba8" dependencies = [ "bstr 1.0.1", "git-hash", @@ -905,12 +905,10 @@ dependencies = [ [[package]] name = "git-repository" -version = "0.29.0" +version = "0.30.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a89cec253dd3fba44694f7468d907506a52d0055850ecd7d84f4bac07f00e73f" +checksum = "1925a65a9fea6587e969a7a85cb239c8e1e438cf6dc520406df1b4c9d0e83bdc" dependencies = [ - "byte-unit", - "clru", "git-actor", "git-attributes", "git-config", @@ -921,6 +919,7 @@ dependencies = [ "git-features", "git-glob", "git-hash", + "git-hashtable", "git-index", "git-lock", "git-mailmap", @@ -940,6 +939,7 @@ dependencies = [ "git-worktree", "log", "once_cell", + "prodash", "signal-hook", "smallvec", "thiserror", @@ -948,23 +948,23 @@ dependencies = [ [[package]] name = "git-revision" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e629289b0d7f7f2f2e46248527f5cac838e6a7cb9507eab06fc8473082db6cb6" +checksum = "f7516b1db551756b4d3176c4b7d18ccc4b79d35dcc5e74f768c90f5bb11bb6c9" dependencies = [ "bstr 1.0.1", "git-date", "git-hash", + "git-hashtable", "git-object", - "hash_hasher", "thiserror", ] [[package]] name = "git-sec" -version = "0.5.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ecb370efde58da72827909292284b5c5b885e0621a342515a36976b0b3bf660" +checksum = "9e1802e8252fa223b0ad89a393aed461132174ced1e6842a41f56dc92a3fc14f" dependencies = [ "bitflags", "dirs", @@ -989,21 +989,21 @@ dependencies = [ [[package]] name = "git-traverse" -version = "0.19.0" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d2746935c92d252e24f9d345e0a981510596faceb7edae821b9e4c8c35c285b" +checksum = "5e5141dde56d0c4861193c760e01fb61c7e03a32d0840ba93a0ac1c597588d4d" dependencies = [ "git-hash", + "git-hashtable", "git-object", - "hash_hasher", "thiserror", ] [[package]] name = "git-url" -version = "0.11.0" +version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7dbd91c55b1b03a833ff8278776fed272918cd61cd48efe9a97ad1fea7ef93ec" +checksum = "8651924c9692a778f09141ca44d1bf2dada229fe9b240f1ff1bdecd9621a1a93" dependencies = [ "bstr 1.0.1", "git-features", @@ -1015,9 +1015,9 @@ dependencies = [ [[package]] name = "git-validate" -version = "0.7.0" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdf83bae632fc064ca938ebfb987364d9083b7f98b1476805f0a2d5eebb48686" +checksum = "0431cf9352c596dc7c8ec9066ee551ce54e63c86c3c767e5baf763f6019ff3c2" dependencies = [ "bstr 1.0.1", "thiserror", @@ -1025,9 +1025,9 @@ dependencies = [ [[package]] name = "git-worktree" -version = "0.9.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2eae0e0b1050208e611d5fac0d8366b29ef3f83849767ff9c4bcf570f0d5dc2b" +checksum = "17d748c54c3d904c914b987654a1416c7abe7cf048fdc83eeae69e6ac3d76f20" dependencies = [ "bstr 1.0.1", "git-attributes", @@ -1093,12 +1093,6 @@ dependencies = [ "memmap2", ] -[[package]] -name = "hash_hasher" -version = "2.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74721d007512d0cb3338cd20f0654ac913920061a4c4d0d8708edb3f2a698c0c" - [[package]] name = "hashbrown" version = "0.12.3" @@ -1258,7 +1252,7 @@ dependencies = [ "helix-core", "imara-diff", "log", - "parking_lot", + "parking_lot 0.12.1", "tempfile", "tokio", ] @@ -1531,14 +1525,14 @@ dependencies = [ [[package]] name = "nix" -version = "0.25.0" +version = "0.26.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e322c04a9e3440c327fca7b6c8a63e6890a32fa2ad689db972425f07e0d22abb" +checksum = "46a58d1d356c6597d08cde02c2f09d785b09e28711837b1ed667dc652c08a694" dependencies = [ - "autocfg", "bitflags", "cfg-if", "libc", + "static_assertions", ] [[package]] @@ -1595,6 +1589,17 @@ version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "86f0b0d4bf799edbc74508c1e8bf170ff5f41238e5f8225603ca7caaae2b7860" +[[package]] +name = "parking_lot" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" +dependencies = [ + "instant", + "lock_api", + "parking_lot_core 0.8.6", +] + [[package]] name = "parking_lot" version = "0.12.1" @@ -1602,7 +1607,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" dependencies = [ "lock_api", - "parking_lot_core", + "parking_lot_core 0.9.4", +] + +[[package]] +name = "parking_lot_core" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60a2cfe6f0ad2bfc16aefa463b497d5c7a5ecd44a23efa72aa342d90177356dc" +dependencies = [ + "cfg-if", + "instant", + "libc", + "redox_syscall", + "smallvec", + "winapi", ] [[package]] @@ -1647,12 +1666,14 @@ dependencies = [ [[package]] name = "prodash" -version = "21.1.0" +version = "22.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e13d7bd38cdab08b3a8b780cedcc54238c84fdca4084eb188807b308bcf11e6" +checksum = "38e2b91fcc982d0d8ae5e9d477561c73e09c24c5c19bac4858e202f6f065a13e" dependencies = [ "bytesize", + "dashmap", "human_format", + "parking_lot 0.11.2", ] [[package]] @@ -2110,7 +2131,7 @@ dependencies = [ "memchr", "mio", "num_cpus", - "parking_lot", + "parking_lot 0.12.1", "pin-project-lite", "signal-hook-registry", "socket2", @@ -2235,12 +2256,6 @@ dependencies = [ "serde", ] -[[package]] -name = "utf8-width" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5190c9442dcdaf0ddd50f37420417d219ae5261bbf5db120d0f9bab996c9cba1" - [[package]] name = "version_check" version = "0.9.4" diff --git a/helix-vcs/Cargo.toml b/helix-vcs/Cargo.toml index e54cf828f51b..8e713638dd9f 100644 --- a/helix-vcs/Cargo.toml +++ b/helix-vcs/Cargo.toml @@ -16,7 +16,7 @@ helix-core = { version = "0.6", path = "../helix-core" } tokio = { version = "1", features = ["rt", "rt-multi-thread", "time", "sync", "parking_lot", "macros"] } parking_lot = "0.12" -git-repository = { version = "0.29", default-features = false , optional = true } +git-repository = { version = "0.30", default-features = false , optional = true } imara-diff = "0.1.5" log = "0.4" From eed80ef1c231a27ea76e6cb1b8800b299f56d834 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 26 Dec 2022 17:28:21 -0600 Subject: [PATCH 281/491] build(deps): bump serde from 1.0.151 to 1.0.152 (#5307) Bumps [serde](https://github.com/serde-rs/serde) from 1.0.151 to 1.0.152. - [Release notes](https://github.com/serde-rs/serde/releases) - [Commits](https://github.com/serde-rs/serde/compare/v1.0.151...v1.0.152) --- updated-dependencies: - dependency-name: serde dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Cargo.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1243bc51d1d2..3592e621ed0f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1826,18 +1826,18 @@ checksum = "9c8132065adcfd6e02db789d9285a0deb2f3fcb04002865ab67d5fb103533898" [[package]] name = "serde" -version = "1.0.151" +version = "1.0.152" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97fed41fc1a24994d044e6db6935e69511a1153b52c15eb42493b26fa87feba0" +checksum = "bb7d1f0d3021d347a83e556fc4683dea2ea09d87bccdf88ff5c12545d89d5efb" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.151" +version = "1.0.152" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "255abe9a125a985c05190d687b320c12f9b1f0b99445e608c21ba0782c719ad8" +checksum = "af487d118eecd09402d70a5d72551860e788df87b464af30e5ea6a38c75c541e" dependencies = [ "proc-macro2", "quote", From ebaf01924dd0e6251535d88ec0a2a00e88680d6b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 26 Dec 2022 17:28:40 -0600 Subject: [PATCH 282/491] build(deps): bump cc from 1.0.77 to 1.0.78 (#5308) Bumps [cc](https://github.com/rust-lang/cc-rs) from 1.0.77 to 1.0.78. - [Release notes](https://github.com/rust-lang/cc-rs/releases) - [Commits](https://github.com/rust-lang/cc-rs/compare/1.0.77...1.0.78) --- updated-dependencies: - dependency-name: cc dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 3592e621ed0f..96c39fd5c81d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -155,9 +155,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.77" +version = "1.0.78" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9f73505338f7d905b19d18738976aae232eb46b8efc15554ffc56deb5d9ebe4" +checksum = "a20104e2335ce8a659d6dd92a51a767a0c062599c73b343fd152cb401e828c3d" [[package]] name = "cfg-if" From 1f4d277013783c9c537444299ba4e558b9047fe2 Mon Sep 17 00:00:00 2001 From: farwyler <1705805+farwyler@users.noreply.github.com> Date: Tue, 27 Dec 2022 15:57:09 +0100 Subject: [PATCH 283/491] Allow custom preprocessors for 'vue' injections (#5268) --- runtime/queries/vue/injections.scm | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/runtime/queries/vue/injections.scm b/runtime/queries/vue/injections.scm index 73df868b6926..1b053e748d3f 100644 --- a/runtime/queries/vue/injections.scm +++ b/runtime/queries/vue/injections.scm @@ -8,13 +8,37 @@ (raw_text) @injection.content) (#set! injection.language "javascript")) +;