From e85d6c37d43be645e4dcf926a23b7b5c551145fc Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 19 Sep 2022 18:25:22 -0500 Subject: [PATCH 001/556] build(deps): bump anyhow from 1.0.64 to 1.0.65 (#3907) 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 c8bf13bf..45ae315d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -22,9 +22,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.64" +version = "1.0.65" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9a8f622bcf6ff3df478e9deba3e03e4e04b300f8e6a139e192c05fa3490afc7" +checksum = "98161a4e3e2184da77bb14f02184cdd111e83bbbcc9979dfee3c44b9a85f5602" [[package]] name = "arc-swap" -- 2.38.5 From 3acdf9fdf910f1bc67262bb587596139272a9458 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 19 Sep 2022 18:26:18 -0500 Subject: [PATCH 002/556] build(deps): bump thiserror from 1.0.34 to 1.0.35 (#3905) 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 45ae315d..fdfc492a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1118,18 +1118,18 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.34" +version = "1.0.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c1b05ca9d106ba7d2e31a9dab4a64e7be2cce415321966ea3132c49a656e252" +checksum = "c53f98874615aea268107765aa1ed8f6116782501d18e53d08b471733bea6c85" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.34" +version = "1.0.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8f2591983642de85c921015f3f070c665a197ed69e417af436115e3a1407487" +checksum = "f8b463991b4eab2d801e724172285ec4195c650e8ec79b149e6c2a8e6dd3f783" dependencies = [ "proc-macro2", "quote", -- 2.38.5 From 24501669272b537302ea253c95abf487b0f21ead Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 19 Sep 2022 18:27:04 -0500 Subject: [PATCH 003/556] build(deps): bump tokio from 1.21.0 to 1.21.1 (#3904) 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 fdfc492a..144d63a6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1171,9 +1171,9 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" [[package]] name = "tokio" -version = "1.21.0" +version = "1.21.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89797afd69d206ccd11fb0ea560a44bbb87731d020670e79416d442919257d42" +checksum = "0020c875007ad96677dcc890298f4b942882c5d4eb7cc8f439fc3bf813dc9c95" dependencies = [ "autocfg", "bytes", -- 2.38.5 From 674bfec9845c9ea3406b19639151e7882f5310bd Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 19 Sep 2022 18:28:12 -0500 Subject: [PATCH 004/556] build(deps): bump unicode-width from 0.1.9 to 0.1.10 (#3902) 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 144d63a6..c232f080 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1284,9 +1284,9 @@ checksum = "7e8820f5d777f6224dc4be3632222971ac30164d4a258d595640799554ebfd99" [[package]] name = "unicode-width" -version = "0.1.9" +version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ed742d4ea2bd1176e236172c8429aaf54486e7ac098db29ffe6529e0ce50973" +checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" [[package]] name = "url" -- 2.38.5 From 26c3c993302f6acd2cc0ed47bc2807d3b7e5e028 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 19 Sep 2022 18:28:38 -0500 Subject: [PATCH 005/556] build(deps): bump unicode-segmentation from 1.9.0 to 1.10.0 (#3903) Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Cargo.lock | 4 ++-- helix-core/Cargo.toml | 2 +- helix-tui/Cargo.toml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c232f080..760efaff 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1278,9 +1278,9 @@ dependencies = [ [[package]] name = "unicode-segmentation" -version = "1.9.0" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e8820f5d777f6224dc4be3632222971ac30164d4a258d595640799554ebfd99" +checksum = "0fdbf052a0783de01e944a6ce7a8cb939e295b1e7be835a1112c3b9a7f047a5a" [[package]] name = "unicode-width" diff --git a/helix-core/Cargo.toml b/helix-core/Cargo.toml index 3ea7235d..c63059a2 100644 --- a/helix-core/Cargo.toml +++ b/helix-core/Cargo.toml @@ -20,7 +20,7 @@ helix-loader = { version = "0.6", path = "../helix-loader" } ropey = { version = "1.5", default-features = false, features = ["simd"] } smallvec = "1.9" smartstring = "1.0.1" -unicode-segmentation = "1.9" +unicode-segmentation = "1.10" unicode-width = "0.1" unicode-general-category = "0.5" # slab = "0.4.2" diff --git a/helix-tui/Cargo.toml b/helix-tui/Cargo.toml index effad198..b220c64f 100644 --- a/helix-tui/Cargo.toml +++ b/helix-tui/Cargo.toml @@ -18,7 +18,7 @@ default = ["crossterm"] [dependencies] bitflags = "1.3" cassowary = "0.3" -unicode-segmentation = "1.9" +unicode-segmentation = "1.10" crossterm = { version = "0.25", optional = true } serde = { version = "1", "optional" = true, features = ["derive"]} helix-view = { version = "0.6", path = "../helix-view", features = ["term"] } -- 2.38.5 From 947ff63e6d31d7926aff83ebb328e03a10deceb9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 19 Sep 2022 18:29:00 -0500 Subject: [PATCH 006/556] build(deps): bump textwrap from 0.15.0 to 0.15.1 (#3906) Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Cargo.lock | 4 ++-- helix-core/Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 760efaff..a26c92e4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1107,9 +1107,9 @@ dependencies = [ [[package]] name = "textwrap" -version = "0.15.0" +version = "0.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1141d4d61095b28419e22cb0bbf02755f5e54e0526f97f1e3d1d160e60885fb" +checksum = "949517c0cf1bf4ee812e2e07e08ab448e3ae0d23472aee8a06c985f0c8815b16" dependencies = [ "smawk", "unicode-linebreak", diff --git a/helix-core/Cargo.toml b/helix-core/Cargo.toml index c63059a2..0ec58af9 100644 --- a/helix-core/Cargo.toml +++ b/helix-core/Cargo.toml @@ -42,7 +42,7 @@ encoding_rs = "0.8" chrono = { version = "0.4", default-features = false, features = ["alloc", "std"] } etcetera = "0.4" -textwrap = "0.15.0" +textwrap = "0.15.1" [dev-dependencies] quickcheck = { version = "1", default-features = false } -- 2.38.5 From 8988c1ecc757bb4d1c2372d8b8a78bae6a1fd85e Mon Sep 17 00:00:00 2001 From: Michael Davis Date: Tue, 20 Sep 2022 02:08:58 -0500 Subject: [PATCH 007/556] Re-sort diagnostics after transaction transform (#3895) Applying document-change transactions to diagnostic ranges is not stable with respect to the ordering of diagnostics. This can cause diagnostics to become temporarily unordered with some edits to a document, which can eventually break some invariants/assumptions in syntax::merge. With this change, Document::diagnostics are always sorted. --- helix-view/src/document.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/helix-view/src/document.rs b/helix-view/src/document.rs index 8ebc9002..2ef99c6a 100644 --- a/helix-view/src/document.rs +++ b/helix-view/src/document.rs @@ -788,6 +788,8 @@ impl Document { diagnostic.range.end = changes.map_pos(diagnostic.range.end, Assoc::After); diagnostic.line = self.text.char_to_line(diagnostic.range.start); } + self.diagnostics + .sort_unstable_by_key(|diagnostic| diagnostic.range); // emit lsp notification if let Some(language_server) = self.language_server() { -- 2.38.5 From 130793dfd06306d1f9d25c150c2dc456cda3f9ed Mon Sep 17 00:00:00 2001 From: Tobias Hunger Date: Tue, 20 Sep 2022 09:11:30 +0200 Subject: [PATCH 008/556] Add command line parameter to specify log file (#3807) * Add command line parameter to specify log file I had the logs of my debug helix mixed in with the logs from the production helix. Add a `--log` command line argument to redirect any logs to other files, making my debugging easier :-) * Update completion files with `--log` argument --- contrib/completion/hx.bash | 2 +- contrib/completion/hx.elv | 8 +++++++- contrib/completion/hx.fish | 1 + contrib/completion/hx.zsh | 1 + helix-term/src/args.rs | 5 +++++ helix-term/src/main.rs | 2 ++ 6 files changed, 17 insertions(+), 2 deletions(-) diff --git a/contrib/completion/hx.bash b/contrib/completion/hx.bash index 8a2d9777..89f3283c 100644 --- a/contrib/completion/hx.bash +++ b/contrib/completion/hx.bash @@ -16,7 +16,7 @@ _hx() { COMPREPLY=($(compgen -W "$languages" -- $2)) ;; *) - COMPREPLY=($(compgen -fd -W "-h --help --tutor -V --version -v -vv -vvv --health -g --grammar --vsplit --hsplit -c --config" -- $2)) + COMPREPLY=($(compgen -fd -W "-h --help --tutor -V --version -v -vv -vvv --health -g --grammar --vsplit --hsplit -c --config --log" -- $2)) ;; esac } && complete -F _hx hx diff --git a/contrib/completion/hx.elv b/contrib/completion/hx.elv index d3d227bc..42c88585 100644 --- a/contrib/completion/hx.elv +++ b/contrib/completion/hx.elv @@ -36,6 +36,11 @@ set edit:completion:arg-completer[hx] = {|@args| edit:complete-filename $args[-1] | each { |v| put $v[stem] } return } + # When we have --log, we need a file + if (has-values "log" $args[-2]) { + edit:complete-filename $args[-1] | each { |v| put $v[stem] } + return + } } edit:complete-filename $args[-1] | each { |v| put $v[stem]} $candidate "--help" "(Prints help information)" @@ -46,4 +51,5 @@ set edit:completion:arg-completer[hx] = {|@args| $candidate "--vsplit" "(Splits all given files vertically)" $candidate "--hsplit" "(Splits all given files horizontally)" $candidate "--config" "(Specifies a file to use for configuration)" -} \ No newline at end of file + $candidate "--log" "(Specifies a file to write log data into)" +} diff --git a/contrib/completion/hx.fish b/contrib/completion/hx.fish index 65f248d4..71c74ab0 100644 --- a/contrib/completion/hx.fish +++ b/contrib/completion/hx.fish @@ -12,3 +12,4 @@ complete -c hx -s V -l version -d "Prints version information" complete -c hx -l vsplit -d "Splits all given files vertically into different windows" complete -c hx -l hsplit -d "Splits all given files horizontally into different windows" complete -c hx -s c -l config -d "Specifies a file to use for completion" +complete -c hx -s c -l log -d "Specifies a file to write log data into" diff --git a/contrib/completion/hx.zsh b/contrib/completion/hx.zsh index e3375656..aaad6f84 100644 --- a/contrib/completion/hx.zsh +++ b/contrib/completion/hx.zsh @@ -18,6 +18,7 @@ _hx() { "--hsplit[Splits all given files horizontally into different windows]" \ "-c[Specifies a file to use for configuration]" \ "--config[Specifies a file to use for configuration]" \ + "--log[Specifies a file to write log data into]" \ "*:file:_files" case "$state" in diff --git a/helix-term/src/args.rs b/helix-term/src/args.rs index d16d7dfd..48c86633 100644 --- a/helix-term/src/args.rs +++ b/helix-term/src/args.rs @@ -14,6 +14,7 @@ pub struct Args { pub build_grammars: bool, pub split: Option, pub verbosity: u64, + pub log_file: Option, pub config_file: Option, pub files: Vec<(PathBuf, Position)>, } @@ -48,6 +49,10 @@ impl Args { Some(path) => args.config_file = Some(path.into()), None => anyhow::bail!("--config must specify a path to read"), }, + "--log" => match argv.next().as_deref() { + Some(path) => args.log_file = Some(path.into()), + None => anyhow::bail!("--log must specify a path to write"), + }, arg if arg.starts_with("--") => { anyhow::bail!("unexpected double dash argument: {}", arg) } diff --git a/helix-term/src/main.rs b/helix-term/src/main.rs index d21d3e77..726bf9e3 100644 --- a/helix-term/src/main.rs +++ b/helix-term/src/main.rs @@ -67,6 +67,7 @@ FLAGS: -g, --grammar {{fetch|build}} Fetches or builds tree-sitter grammars listed in languages.toml -c, --config Specifies a file to use for configuration -v Increases logging verbosity each use for up to 3 times + --log Specifies a file to use for logging (default file: {}) -V, --version Prints version information --vsplit Splits all given files vertically into different windows @@ -114,6 +115,7 @@ FLAGS: return Ok(0); } + let logpath = args.log_file.as_ref().cloned().unwrap_or(logpath); setup_logging(logpath, args.verbosity).context("failed to initialize logging")?; let config_dir = helix_loader::config_dir(); -- 2.38.5 From 64b074541363c72534dc86d00053ecbd5511a9ca Mon Sep 17 00:00:00 2001 From: Luke Cycon Date: Tue, 20 Sep 2022 00:21:15 -0700 Subject: [PATCH 009/556] Track source and tags in diagnostics (#3898) --- helix-core/src/diagnostic.rs | 8 ++++++++ helix-lsp/src/lib.rs | 22 ++++++++++++++++++++-- helix-term/src/application.rs | 19 +++++++++++++++++-- 3 files changed, 45 insertions(+), 4 deletions(-) diff --git a/helix-core/src/diagnostic.rs b/helix-core/src/diagnostic.rs index 48a68dc0..da199ac9 100644 --- a/helix-core/src/diagnostic.rs +++ b/helix-core/src/diagnostic.rs @@ -29,6 +29,12 @@ pub enum NumberOrString { String(String), } +#[derive(Debug, Clone)] +pub enum DiagnosticTag { + Unnecessary, + Deprecated, +} + /// Corresponds to [`lsp_types::Diagnostic`](https://docs.rs/lsp-types/0.91.0/lsp_types/struct.Diagnostic.html) #[derive(Debug, Clone)] pub struct Diagnostic { @@ -37,4 +43,6 @@ pub struct Diagnostic { pub message: String, pub severity: Option, pub code: Option, + pub tags: Option>, + pub source: Option, } diff --git a/helix-lsp/src/lib.rs b/helix-lsp/src/lib.rs index a39325fa..8c76c4a8 100644 --- a/helix-lsp/src/lib.rs +++ b/helix-lsp/src/lib.rs @@ -84,15 +84,33 @@ pub mod util { None => None, }; + let tags = if let Some(ref tags) = diag.tags { + let new_tags = tags + .iter() + .map(|tag| match tag { + helix_core::diagnostic::DiagnosticTag::Unnecessary => { + lsp::DiagnosticTag::UNNECESSARY + } + helix_core::diagnostic::DiagnosticTag::Deprecated => { + lsp::DiagnosticTag::DEPRECATED + } + }) + .collect(); + + Some(new_tags) + } else { + None + }; + // TODO: add support for Diagnostic.data lsp::Diagnostic::new( range_to_lsp_range(doc, range, offset_encoding), severity, code, - None, + diag.source.clone(), diag.message.to_owned(), None, - None, + tags, ) } diff --git a/helix-term/src/application.rs b/helix-term/src/application.rs index 7ee5b7f1..496464f0 100644 --- a/helix-term/src/application.rs +++ b/helix-term/src/application.rs @@ -2,7 +2,7 @@ use arc_swap::{access::Map, ArcSwap}; use futures_util::Stream; use helix_core::{ config::{default_syntax_loader, user_syntax_loader}, - diagnostic::NumberOrString, + diagnostic::{DiagnosticTag, NumberOrString}, pos_at_coords, syntax, Selection, }; use helix_lsp::{lsp, util::lsp_pos_to_pos, LspProgressMap}; @@ -605,13 +605,28 @@ impl Application { None => None, }; + let tags = if let Some(ref tags) = diagnostic.tags { + let new_tags = tags.iter().filter_map(|tag| { + match *tag { + lsp::DiagnosticTag::DEPRECATED => Some(DiagnosticTag::Deprecated), + lsp::DiagnosticTag::UNNECESSARY => Some(DiagnosticTag::Unnecessary), + _ => None + } + }).collect(); + + Some(new_tags) + } else { + None + }; + Some(Diagnostic { range: Range { start, end }, line: diagnostic.range.start.line as usize, message: diagnostic.message.clone(), severity, code, - // source + tags, + source: diagnostic.source.clone() }) }) .collect(); -- 2.38.5 From 1df32c917c8a386947063403577098d1277380c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bla=C5=BE=20Hrastnik?= Date: Tue, 20 Sep 2022 16:28:00 +0900 Subject: [PATCH 010/556] diagnostics: Use Vec instead of Option> --- helix-core/src/diagnostic.rs | 2 +- helix-lsp/src/lib.rs | 23 +++++++++++------------ helix-term/src/application.rs | 4 ++-- 3 files changed, 14 insertions(+), 15 deletions(-) diff --git a/helix-core/src/diagnostic.rs b/helix-core/src/diagnostic.rs index da199ac9..db1f2da9 100644 --- a/helix-core/src/diagnostic.rs +++ b/helix-core/src/diagnostic.rs @@ -43,6 +43,6 @@ pub struct Diagnostic { pub message: String, pub severity: Option, pub code: Option, - pub tags: Option>, + pub tags: Vec, pub source: Option, } diff --git a/helix-lsp/src/lib.rs b/helix-lsp/src/lib.rs index 8c76c4a8..8d43410a 100644 --- a/helix-lsp/src/lib.rs +++ b/helix-lsp/src/lib.rs @@ -84,19 +84,18 @@ pub mod util { None => None, }; - let tags = if let Some(ref tags) = diag.tags { - let new_tags = tags - .iter() - .map(|tag| match tag { - helix_core::diagnostic::DiagnosticTag::Unnecessary => { - lsp::DiagnosticTag::UNNECESSARY - } - helix_core::diagnostic::DiagnosticTag::Deprecated => { - lsp::DiagnosticTag::DEPRECATED - } - }) - .collect(); + let new_tags: Vec<_> = diag + .tags + .iter() + .map(|tag| match tag { + helix_core::diagnostic::DiagnosticTag::Unnecessary => { + lsp::DiagnosticTag::UNNECESSARY + } + helix_core::diagnostic::DiagnosticTag::Deprecated => lsp::DiagnosticTag::DEPRECATED, + }) + .collect(); + let tags = if !new_tags.is_empty() { Some(new_tags) } else { None diff --git a/helix-term/src/application.rs b/helix-term/src/application.rs index 496464f0..cd499f1c 100644 --- a/helix-term/src/application.rs +++ b/helix-term/src/application.rs @@ -614,9 +614,9 @@ impl Application { } }).collect(); - Some(new_tags) + new_tags } else { - None + Vec::new() }; Some(Diagnostic { -- 2.38.5 From aa00a470f31514b792e219513ffb3806a5e5b53e Mon Sep 17 00:00:00 2001 From: Joe Date: Tue, 20 Sep 2022 03:40:48 -0400 Subject: [PATCH 011/556] Fix preview bug (#3644) * Fix preview bug * Add comment to empty case --- helix-term/src/commands/typed.rs | 5 ++++- helix-term/src/ui/prompt.rs | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/helix-term/src/commands/typed.rs b/helix-term/src/commands/typed.rs index c22f8712..f49fff30 100644 --- a/helix-term/src/commands/typed.rs +++ b/helix-term/src/commands/typed.rs @@ -715,7 +715,10 @@ fn theme( cx.editor.unset_theme_preview(); } PromptEvent::Update => { - if let Some(theme_name) = args.first() { + if args.is_empty() { + // Ensures that a preview theme gets cleaned up if the user backspaces until the prompt is empty. + cx.editor.unset_theme_preview(); + } else if let Some(theme_name) = args.first() { if let Ok(theme) = cx.editor.theme_loader.load(theme_name) { if !(true_color || theme.is_16_color()) { bail!("Unsupported theme: theme requires true color support"); diff --git a/helix-term/src/ui/prompt.rs b/helix-term/src/ui/prompt.rs index d66e32be..db3bd62d 100644 --- a/helix-term/src/ui/prompt.rs +++ b/helix-term/src/ui/prompt.rs @@ -293,6 +293,7 @@ impl Prompt { register: char, direction: CompletionDirection, ) { + (self.callback_fn)(cx, &self.line, PromptEvent::Abort); let register = cx.editor.registers.get_mut(register).read(); if register.is_empty() { @@ -314,6 +315,7 @@ impl Prompt { self.history_pos = Some(index); self.move_end(); + (self.callback_fn)(cx, &self.line, PromptEvent::Update); self.recalculate_completion(cx.editor); } @@ -564,13 +566,11 @@ impl Component for Prompt { ctrl!('p') | key!(Up) => { if let Some(register) = self.history_register { self.change_history(cx, register, CompletionDirection::Backward); - (self.callback_fn)(cx, &self.line, PromptEvent::Update); } } ctrl!('n') | key!(Down) => { if let Some(register) = self.history_register { self.change_history(cx, register, CompletionDirection::Forward); - (self.callback_fn)(cx, &self.line, PromptEvent::Update); } } key!(Tab) => { -- 2.38.5 From 385ccdfc9c4f04cbe33c7cfdd668a1f694b6d870 Mon Sep 17 00:00:00 2001 From: Filipe Azevedo Date: Tue, 20 Sep 2022 08:44:36 +0100 Subject: [PATCH 012/556] add :lsp-restart command (#3435) --- book/src/generated/typable-cmd.md | 1 + helix-lsp/src/lib.rs | 118 ++++++++++++++++++++---------- helix-term/src/commands/typed.rs | 41 +++++++++++ 3 files changed, 123 insertions(+), 37 deletions(-) diff --git a/book/src/generated/typable-cmd.md b/book/src/generated/typable-cmd.md index 653acf60..4cbff306 100644 --- a/book/src/generated/typable-cmd.md +++ b/book/src/generated/typable-cmd.md @@ -44,6 +44,7 @@ | `:show-directory`, `:pwd` | Show the current working directory. | | `:encoding` | Set encoding. Based on `https://encoding.spec.whatwg.org`. | | `:reload` | Discard changes and reload from the source file. | +| `:lsp-restart` | Restarts the Language Server that is in use by the current doc | | `:tree-sitter-scopes` | Display tree sitter scopes, primarily for theming and development. | | `:debug-start`, `:dbg` | Start a debug session from a given template with given parameters. | | `:debug-remote`, `:dbg-tcp` | Connect to a debug adapter by TCP address and start a debugging session from a given template with given parameters. | diff --git a/helix-lsp/src/lib.rs b/helix-lsp/src/lib.rs index 8d43410a..cb234357 100644 --- a/helix-lsp/src/lib.rs +++ b/helix-lsp/src/lib.rs @@ -9,7 +9,8 @@ pub use lsp::{Position, Url}; pub use lsp_types as lsp; use futures_util::stream::select_all::SelectAll; -use helix_core::syntax::LanguageConfiguration; +use helix_core::syntax::{LanguageConfiguration, LanguageServerConfiguration}; +use tokio::sync::mpsc::UnboundedReceiver; use std::{ collections::{hash_map::Entry, HashMap}, @@ -335,6 +336,33 @@ impl Registry { .map(|(_, client)| client.as_ref()) } + pub fn restart( + &mut self, + language_config: &LanguageConfiguration, + ) -> Result>> { + let config = match &language_config.language_server { + Some(config) => config, + None => return Ok(None), + }; + + let scope = language_config.scope.clone(); + + match self.inner.entry(scope) { + Entry::Vacant(_) => Ok(None), + Entry::Occupied(mut entry) => { + // initialize a new client + let id = self.counter.fetch_add(1, Ordering::Relaxed); + + let NewClientResult(client, incoming) = start_client(id, language_config, config)?; + self.incoming.push(UnboundedReceiverStream::new(incoming)); + + entry.insert((id, client.clone())); + + Ok(Some(client)) + } + } + } + pub fn get(&mut self, language_config: &LanguageConfiguration) -> Result>> { let config = match &language_config.language_server { Some(config) => config, @@ -346,43 +374,9 @@ impl Registry { Entry::Vacant(entry) => { // initialize a new client let id = self.counter.fetch_add(1, Ordering::Relaxed); - let (client, incoming, initialize_notify) = Client::start( - &config.command, - &config.args, - language_config.config.clone(), - &language_config.roots, - id, - config.timeout, - )?; + + let NewClientResult(client, incoming) = start_client(id, language_config, config)?; self.incoming.push(UnboundedReceiverStream::new(incoming)); - let client = Arc::new(client); - - // Initialize the client asynchronously - let _client = client.clone(); - tokio::spawn(async move { - use futures_util::TryFutureExt; - let value = _client - .capabilities - .get_or_try_init(|| { - _client - .initialize() - .map_ok(|response| response.capabilities) - }) - .await; - - if let Err(e) = value { - log::error!("failed to initialize language server: {}", e); - return; - } - - // next up, notify - _client - .notify::(lsp::InitializedParams {}) - .await - .unwrap(); - - initialize_notify.notify_one(); - }); entry.insert((id, client.clone())); Ok(Some(client)) @@ -473,6 +467,56 @@ impl LspProgressMap { } } +struct NewClientResult(Arc, UnboundedReceiver<(usize, Call)>); + +/// start_client takes both a LanguageConfiguration and a LanguageServerConfiguration to ensure that +/// it is only called when it makes sense. +fn start_client( + id: usize, + config: &LanguageConfiguration, + ls_config: &LanguageServerConfiguration, +) -> Result { + let (client, incoming, initialize_notify) = Client::start( + &ls_config.command, + &ls_config.args, + config.config.clone(), + &config.roots, + id, + ls_config.timeout, + )?; + + let client = Arc::new(client); + + // Initialize the client asynchronously + let _client = client.clone(); + tokio::spawn(async move { + use futures_util::TryFutureExt; + let value = _client + .capabilities + .get_or_try_init(|| { + _client + .initialize() + .map_ok(|response| response.capabilities) + }) + .await; + + if let Err(e) = value { + log::error!("failed to initialize language server: {}", e); + return; + } + + // next up, notify + _client + .notify::(lsp::InitializedParams {}) + .await + .unwrap(); + + initialize_notify.notify_one(); + }); + + Ok(NewClientResult(client, incoming)) +} + #[cfg(test)] mod tests { use super::{lsp, util::*, OffsetEncoding}; diff --git a/helix-term/src/commands/typed.rs b/helix-term/src/commands/typed.rs index f49fff30..6d0ced65 100644 --- a/helix-term/src/commands/typed.rs +++ b/helix-term/src/commands/typed.rs @@ -985,6 +985,40 @@ fn reload( }) } +fn lsp_restart( + cx: &mut compositor::Context, + _args: &[Cow], + event: PromptEvent, +) -> anyhow::Result<()> { + if event != PromptEvent::Validate { + return Ok(()); + } + + let (_view, doc) = current!(cx.editor); + let config = doc + .language_config() + .context("LSP not defined for the current document")?; + + let scope = config.scope.clone(); + cx.editor.language_servers.restart(config)?; + + // This collect is needed because refresh_language_server would need to re-borrow editor. + let document_ids_to_refresh: Vec = cx + .editor + .documents() + .filter_map(|doc| match doc.language_config() { + Some(config) if config.scope.eq(&scope) => Some(doc.id()), + _ => None, + }) + .collect(); + + for document_id in document_ids_to_refresh { + cx.editor.refresh_language_server(document_id); + } + + Ok(()) +} + fn tree_sitter_scopes( cx: &mut compositor::Context, _args: &[Cow], @@ -1837,6 +1871,13 @@ pub const TYPABLE_COMMAND_LIST: &[TypableCommand] = &[ fun: reload, completer: None, }, + TypableCommand { + name: "lsp-restart", + aliases: &[], + doc: "Restarts the Language Server that is in use by the current doc", + fun: lsp_restart, + completer: None, + }, TypableCommand { name: "tree-sitter-scopes", aliases: &[], -- 2.38.5 From 5467c65f8224049405498d65f54c3e3f8e4ec6c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benedikt=20M=C3=BCller?= Date: Tue, 20 Sep 2022 14:35:00 +0200 Subject: [PATCH 013/556] fix fish completions for --config & --log (#3912) --- contrib/completion/hx.fish | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/contrib/completion/hx.fish b/contrib/completion/hx.fish index 71c74ab0..11977605 100644 --- a/contrib/completion/hx.fish +++ b/contrib/completion/hx.fish @@ -11,5 +11,5 @@ complete -c hx -s v -o vv -o vvv -d "Increases logging verbosity" complete -c hx -s V -l version -d "Prints version information" complete -c hx -l vsplit -d "Splits all given files vertically into different windows" complete -c hx -l hsplit -d "Splits all given files horizontally into different windows" -complete -c hx -s c -l config -d "Specifies a file to use for completion" -complete -c hx -s c -l log -d "Specifies a file to write log data into" +complete -c hx -s c -l config -r -d "Specifies a file to use for completion" +complete -c hx -l log -r -d "Specifies a file to write log data into" -- 2.38.5 From 75362dce8315c3fe20b9702d1ecdc0315112558e Mon Sep 17 00:00:00 2001 From: taupiqueur <93834534+taupiqueur@users.noreply.github.com> Date: Wed, 21 Sep 2022 20:51:48 +0200 Subject: [PATCH 014/556] =?UTF-8?q?Fix=20the=20picker=E2=80=99s=20keymap?= =?UTF-8?q?=20documentation=20(#3925)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- book/src/keymap.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/book/src/keymap.md b/book/src/keymap.md index 99b0f0ba..6d90d802 100644 --- a/book/src/keymap.md +++ b/book/src/keymap.md @@ -381,9 +381,9 @@ Keys to use within picker. Remapping currently not supported. | Key | Description | | ----- | ------------- | -| `Tab`, `Up`, `Ctrl-p` | Previous entry | +| `Shift-Tab`, `Up`, `Ctrl-p` | Previous entry | +| `Tab`, `Down`, `Ctrl-n` | Next entry | | `PageUp`, `Ctrl-u` | Page up | -| `Shift-tab`, `Down`, `Ctrl-n`| Next entry | | `PageDown`, `Ctrl-d` | Page down | | `Home` | Go to first entry | | `End` | Go to last entry | -- 2.38.5 From 1dd1476a9eea7f6cb7d66239782e032b3c8672aa Mon Sep 17 00:00:00 2001 From: gavincrawford <94875769+gavincrawford@users.noreply.github.com> Date: Wed, 21 Sep 2022 16:55:28 -0600 Subject: [PATCH 015/556] Fix highlighting on single-character Rust consts (#3927) Co-authored-by: Kirawi <67773714+kirawi@users.noreply.github.com> Co-authored-by: Gavin Crawford --- runtime/queries/rust/highlights.scm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/queries/rust/highlights.scm b/runtime/queries/rust/highlights.scm index 78a7abf0..7d0afcde 100644 --- a/runtime/queries/rust/highlights.scm +++ b/runtime/queries/rust/highlights.scm @@ -183,7 +183,7 @@ ; ------- ((identifier) @constant - (#match? @constant "^[A-Z][A-Z\\d_]+$")) + (#match? @constant "^[A-Z][A-Z\\d_]*$")) ; --- ; PascalCase identifiers in call_expressions (e.g. `Ok()`) -- 2.38.5 From 6e168b5099c31d0681e3486d177a14d04dde4c20 Mon Sep 17 00:00:00 2001 From: Michael Davis Date: Wed, 21 Sep 2022 20:30:42 -0500 Subject: [PATCH 016/556] Improve keymap errors from command typos (#3931) * Improve keymap errors from command typos Currently, opening helix with a config containing a bad command mapping fails with a cryptic error. For example, say we have a config (bad.toml) with a command name that doesn't exist: [keys.normal] b = "buffer_close" # should be ":buffer-close" When we `hx -c bad.toml`, we get... > Bad config: data did not match any variant of untagged enum KeyTrie for key `keys.normal` at line 1 column 1 > Press to continue with default config This is because of the way that Serde tries to deserialize untagged enums such as `helix_term::keymap::KeyTrie`. From the Serde docs[^1]: > Serde will try to match the data against each variant in order and the > first one that deserializes successfully is the one returned. `MappableCommand::deserialize` fails (returns an Err variant) when a command does not exist. Serde interprets this as the `KeyTrie::Leaf` variant failing to match and declares that the input data doesn't "match any variant of untagged enum KeyTrie." Luckily the variants of KeyTrie are orthogonal in structure: we can tell them apart by the type hints from a `serde::de::Visitor`. This change uses a custom Deserialize implementation along with a Visitor that discerns which variant of the KeyTrie applies. With this change, the above failure becomes: > Bad config: No command named 'buffer_close' for key `keys.normal.b` at line 2 column 5 > Press to continue with default config We also provide more explicit information about the expectations on the field. A config with an unexpected type produces a message with that information and the expectation: [keys.normal] b = 1 > Bad config: invalid type: integer `1`, expected a command, list of commands, or sub-keymap for key `keys.normal.b` at line 2 column 5 > Press to continue with default config [^1]: https://serde.rs/enum-representations.html#untagged * Update helix-term/src/keymap.rs Co-authored-by: Ivan Tham Co-authored-by: Ivan Tham --- helix-term/src/keymap.rs | 60 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 58 insertions(+), 2 deletions(-) diff --git a/helix-term/src/keymap.rs b/helix-term/src/keymap.rs index 59204889..088b3b6d 100644 --- a/helix-term/src/keymap.rs +++ b/helix-term/src/keymap.rs @@ -144,14 +144,70 @@ impl DerefMut for KeyTrieNode { } } -#[derive(Debug, Clone, PartialEq, Deserialize)] -#[serde(untagged)] +#[derive(Debug, Clone, PartialEq)] pub enum KeyTrie { Leaf(MappableCommand), Sequence(Vec), Node(KeyTrieNode), } +impl<'de> Deserialize<'de> for KeyTrie { + fn deserialize(deserializer: D) -> Result + where + D: serde::Deserializer<'de>, + { + deserializer.deserialize_any(KeyTrieVisitor) + } +} + +struct KeyTrieVisitor; + +impl<'de> serde::de::Visitor<'de> for KeyTrieVisitor { + type Value = KeyTrie; + + fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result { + write!(formatter, "a command, list of commands, or sub-keymap") + } + + fn visit_str(self, command: &str) -> Result + where + E: serde::de::Error, + { + command + .parse::() + .map(KeyTrie::Leaf) + .map_err(E::custom) + } + + fn visit_seq(self, mut seq: S) -> Result + where + S: serde::de::SeqAccess<'de>, + { + let mut commands = Vec::new(); + while let Some(command) = seq.next_element::<&str>()? { + commands.push( + command + .parse::() + .map_err(serde::de::Error::custom)?, + ) + } + Ok(KeyTrie::Sequence(commands)) + } + + fn visit_map(self, mut map: M) -> Result + where + M: serde::de::MapAccess<'de>, + { + let mut mapping = HashMap::new(); + let mut order = Vec::new(); + while let Some((key, value)) = map.next_entry::()? { + mapping.insert(key, value); + order.push(key); + } + Ok(KeyTrie::Node(KeyTrieNode::new("", mapping, order))) + } +} + impl KeyTrie { pub fn node(&self) -> Option<&KeyTrieNode> { match *self { -- 2.38.5 From e621848d075c1751ab2be6f3a82ac67490ec7909 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Tj=C3=A4der?= Date: Thu, 22 Sep 2022 14:28:05 +0200 Subject: [PATCH 017/556] Theme: Papercolor: Tune inactive statusline (#3938) --- runtime/themes/papercolor-dark.toml | 2 +- runtime/themes/papercolor-light.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/runtime/themes/papercolor-dark.toml b/runtime/themes/papercolor-dark.toml index 20950469..18a47292 100644 --- a/runtime/themes/papercolor-dark.toml +++ b/runtime/themes/papercolor-dark.toml @@ -10,7 +10,7 @@ "ui.statusline" = {bg="paper_bar_bg", fg="regular0"} "ui.statusline.select" = {bg="background", fg="bright7"} "ui.statusline.normal" = {bg="background", fg="bright3"} -"ui.statusline.inactive" = {bg="background", fg="bright0"} +"ui.statusline.inactive" = {bg="selection_foreground", fg="foreground"} "ui.virtual.whitespace" = { fg = "regular5" } "ui.virtual.ruler" = {bg="cursorline_background"} "ui.cursor.match" = {bg = "regular5", fg = "regular0"} diff --git a/runtime/themes/papercolor-light.toml b/runtime/themes/papercolor-light.toml index dc4d7df5..70b973d3 100644 --- a/runtime/themes/papercolor-light.toml +++ b/runtime/themes/papercolor-light.toml @@ -10,7 +10,7 @@ "ui.statusline" = {bg="paper_bar_bg", fg="regular0"} "ui.statusline.select" = {bg="background", fg="bright7"} "ui.statusline.normal" = {bg="background", fg="bright3"} -"ui.statusline.inactive" = {bg="background", fg="bright0"} +"ui.statusline.inactive" = {bg="bright0", fg="foreground"} "ui.virtual" = "indent" "ui.virtual.whitespace" = { fg = "regular5" } "ui.virtual.ruler" = {bg="cursorline_background"} -- 2.38.5 From eb6fd283dcf041ecf822fd8f2d4520abb2a26df9 Mon Sep 17 00:00:00 2001 From: A-Walrus <58790821+A-Walrus@users.noreply.github.com> Date: Thu, 22 Sep 2022 18:33:30 +0300 Subject: [PATCH 018/556] Deduplicate regexes in search_selection command (#3941) --- helix-term/src/commands.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index e869446e..a5203352 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -1760,6 +1760,8 @@ fn search_selection(cx: &mut Context) { .selection(view.id) .iter() .map(|selection| regex::escape(&selection.fragment(contents))) + .collect::>() // Collect into hashset to deduplicate identical regexes + .into_iter() .collect::>() .join("|"); -- 2.38.5 From 4133f1f424c6a9da71cab65dc9541e6d941ec603 Mon Sep 17 00:00:00 2001 From: Pascal Kuthe Date: Fri, 23 Sep 2022 08:58:00 +0200 Subject: [PATCH 019/556] Document MSRV policy (#3913) --- .github/workflows/msrv-rust-toolchain.toml | 2 +- Cargo.lock | 7 ------- docs/CONTRIBUTING.md | 6 ++++++ helix-term/Cargo.toml | 3 --- helix-term/src/ui/picker.rs | 4 ---- 5 files changed, 7 insertions(+), 15 deletions(-) diff --git a/.github/workflows/msrv-rust-toolchain.toml b/.github/workflows/msrv-rust-toolchain.toml index 7a3ec50b..b169d31e 100644 --- a/.github/workflows/msrv-rust-toolchain.toml +++ b/.github/workflows/msrv-rust-toolchain.toml @@ -1,3 +1,3 @@ [toolchain] -channel = "1.59.0" +channel = "1.61.0" components = ["rustfmt", "rust-src"] diff --git a/Cargo.lock b/Cargo.lock index a26c92e4..cc9e69b4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -485,7 +485,6 @@ dependencies = [ "log", "once_cell", "pulldown-cmark", - "retain_mut", "serde", "serde_json", "signal-hook", @@ -884,12 +883,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "retain_mut" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4389f1d5789befaf6029ebd9f7dac4af7f7e3d61b69d4f30e2ac02b57e7712b0" - [[package]] name = "ropey" version = "1.5.0" diff --git a/docs/CONTRIBUTING.md b/docs/CONTRIBUTING.md index e7b39b06..353cb4fd 100644 --- a/docs/CONTRIBUTING.md +++ b/docs/CONTRIBUTING.md @@ -37,6 +37,12 @@ contributors are strongly encouraged to write integration tests for their code. Existing tests can be used as examples. Helpers can be found in [helpers.rs][helpers.rs] +## Minimum Stable Rust Version (MSRV) Policy + +Helix follows the MSRV of Firefox. +The current MSRV and future changes to the MSRV are listed in the [Firefox documentation]. + +[Firefox documentation]: https://firefox-source-docs.mozilla.org/writing-rust-code/update-policy.html [good-first-issue]: https://github.com/helix-editor/helix/labels/E-easy [log-file]: https://github.com/helix-editor/helix/wiki/FAQ#access-the-log-file [architecture.md]: ./architecture.md diff --git a/helix-term/Cargo.toml b/helix-term/Cargo.toml index 0ebcb24f..b36063e4 100644 --- a/helix-term/Cargo.toml +++ b/helix-term/Cargo.toml @@ -67,9 +67,6 @@ serde = { version = "1.0", features = ["derive"] } grep-regex = "0.1.10" grep-searcher = "0.1.10" -# Remove once retain_mut lands in stable rust -retain_mut = "0.1.7" - [target.'cfg(not(windows))'.dependencies] # https://github.com/vorner/signal-hook/issues/100 signal-hook-tokio = { version = "0.3", features = ["futures-v0_3"] } diff --git a/helix-term/src/ui/picker.rs b/helix-term/src/ui/picker.rs index 24d3b288..d125a6aa 100644 --- a/helix-term/src/ui/picker.rs +++ b/helix-term/src/ui/picker.rs @@ -365,10 +365,6 @@ impl Picker { .map(|(index, _option)| (index, 0)), ); } else if pattern.starts_with(&self.previous_pattern) { - // TODO: remove when retain_mut is in stable rust - #[allow(unused_imports, deprecated)] - use retain_mut::RetainMut; - // optimization: if the pattern is a more specific version of the previous one // then we can score the filtered set. #[allow(unstable_name_collisions)] -- 2.38.5 From 888f4fef6f975412c8215c4b76871ffba6e1b41d Mon Sep 17 00:00:00 2001 From: Riccardo Binetti Date: Fri, 23 Sep 2022 10:04:07 +0200 Subject: [PATCH 020/556] Split helix_core::find_root and helix_loader::find_local_config_dirs (#3929) * Split helix_core::find_root and helix_loader::find_local_config_dirs The documentation of find_root described the following priority for detecting a project root: - Top-most folder containing a root marker in current git repository - Git repository root if no marker detected - Top-most folder containing a root marker if not git repository detected - Current working directory as fallback The commit contained in https://github.com/helix-editor/helix/pull/1249 extracted and changed the implementation of find_root in find_root_impl, actually reversing its result order (since that is the order that made sense for the local configuration merge, from innermost to outermost ancestors). Since the two uses of find_root_impl have different requirements (and it's not a matter of reversing the order of results since, e.g., the top repository dir should be used by find_root only if there's not marker in other dirs), this PR splits the two implementations in two different specialized functions. In doing so, find_root_impl is removed and the implementation is moved back in find_root, moving it closer to the documented behaviour thus making it easier to verify it's actually correct * helix-core: remove Option from find_root return type It always returns some result, so Option is not needed --- helix-core/src/lib.rs | 40 ++++++++++++++++++++++++++++++++++---- helix-loader/src/lib.rs | 26 +++++-------------------- helix-lsp/src/client.rs | 11 +++-------- helix-term/src/commands.rs | 5 +++-- 4 files changed, 47 insertions(+), 35 deletions(-) diff --git a/helix-core/src/lib.rs b/helix-core/src/lib.rs index 735a62c1..8f869e35 100644 --- a/helix-core/src/lib.rs +++ b/helix-core/src/lib.rs @@ -46,10 +46,42 @@ pub fn find_first_non_whitespace_char(line: RopeSlice) -> Option { /// * Git repository root if no marker detected /// * Top-most folder containing a root marker if not git repository detected /// * Current working directory as fallback -pub fn find_root(root: Option<&str>, root_markers: &[String]) -> Option { - helix_loader::find_root_impl(root, root_markers) - .first() - .cloned() +pub fn find_root(root: Option<&str>, root_markers: &[String]) -> std::path::PathBuf { + let current_dir = std::env::current_dir().expect("unable to determine current directory"); + + let root = match root { + Some(root) => { + let root = std::path::Path::new(root); + if root.is_absolute() { + root.to_path_buf() + } else { + current_dir.join(root) + } + } + None => current_dir.clone(), + }; + + let mut top_marker = None; + for ancestor in root.ancestors() { + if root_markers + .iter() + .any(|marker| ancestor.join(marker).exists()) + { + top_marker = Some(ancestor); + } + + if ancestor.join(".git").is_dir() { + // Top marker is repo root if not root marker was detected yet + if top_marker.is_none() { + top_marker = Some(ancestor); + } + // Don't go higher than repo if we're in one + break; + } + } + + // Return the found top marker or the current_dir as fallback + top_marker.map_or(current_dir, |a| a.to_path_buf()) } pub use ropey::{str_utils, Rope, RopeBuilder, RopeSlice}; diff --git a/helix-loader/src/lib.rs b/helix-loader/src/lib.rs index 3c9905f5..a02a59af 100644 --- a/helix-loader/src/lib.rs +++ b/helix-loader/src/lib.rs @@ -59,7 +59,7 @@ pub fn config_dir() -> PathBuf { } pub fn local_config_dirs() -> Vec { - let directories = find_root_impl(None, &[".helix".to_string()]) + let directories = find_local_config_dirs() .into_iter() .map(|path| path.join(".helix")) .collect(); @@ -90,32 +90,16 @@ pub fn log_file() -> PathBuf { cache_dir().join("helix.log") } -pub fn find_root_impl(root: Option<&str>, root_markers: &[String]) -> Vec { +pub fn find_local_config_dirs() -> Vec { let current_dir = std::env::current_dir().expect("unable to determine current directory"); let mut directories = Vec::new(); - let root = match root { - Some(root) => { - let root = std::path::Path::new(root); - if root.is_absolute() { - root.to_path_buf() - } else { - current_dir.join(root) - } - } - None => current_dir, - }; - - for ancestor in root.ancestors() { - // don't go higher than repo + for ancestor in current_dir.ancestors() { if ancestor.join(".git").is_dir() { - // Use workspace if detected from marker directories.push(ancestor.to_path_buf()); + // Don't go higher than repo if we're in one break; - } else if root_markers - .iter() - .any(|marker| ancestor.join(marker).exists()) - { + } else if ancestor.join(".helix").is_dir() { directories.push(ancestor.to_path_buf()); } } diff --git a/helix-lsp/src/client.rs b/helix-lsp/src/client.rs index 9ae8f20e..497ce80c 100644 --- a/helix-lsp/src/client.rs +++ b/helix-lsp/src/client.rs @@ -34,7 +34,7 @@ pub struct Client { pub(crate) capabilities: OnceCell, offset_encoding: OffsetEncoding, config: Option, - root_path: Option, + root_path: std::path::PathBuf, root_uri: Option, workspace_folders: Vec, req_timeout: u64, @@ -74,9 +74,7 @@ impl Client { let root_path = find_root(None, root_markers); - let root_uri = root_path - .clone() - .and_then(|root| lsp::Url::from_file_path(root).ok()); + let root_uri = lsp::Url::from_file_path(root_path.clone()).ok(); // TODO: support multiple workspace folders let workspace_folders = root_uri @@ -281,10 +279,7 @@ impl Client { workspace_folders: Some(self.workspace_folders.clone()), // root_path is obsolete, but some clients like pyright still use it so we specify both. // clients will prefer _uri if possible - root_path: self - .root_path - .clone() - .and_then(|path| path.to_str().map(|path| path.to_owned())), + root_path: self.root_path.to_str().map(|path| path.to_owned()), root_uri: self.root_uri.clone(), initialization_options: self.config.clone(), capabilities: lsp::ClientCapabilities { diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index a5203352..c87ad0ca 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -2225,8 +2225,9 @@ fn append_mode(cx: &mut Context) { } fn file_picker(cx: &mut Context) { - // We don't specify language markers, root will be the root of the current git repo - let root = find_root(None, &[]).unwrap_or_else(|| PathBuf::from("./")); + // We don't specify language markers, root will be the root of the current + // git repo or the current dir if we're not in a repo + let root = find_root(None, &[]); let picker = ui::file_picker(root, &cx.editor.config()); cx.push_layer(Box::new(overlayed(picker))); } -- 2.38.5 From 3a245fe7928befaf9636604ef72d058e63ab35fc Mon Sep 17 00:00:00 2001 From: Riccardo Binetti Date: Fri, 23 Sep 2022 18:40:16 +0200 Subject: [PATCH 021/556] Add mix.exs and mix.lock as Elixir root markers (#3917) --- languages.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/languages.toml b/languages.toml index 949dd372..133b87ae 100644 --- a/languages.toml +++ b/languages.toml @@ -99,7 +99,7 @@ scope = "source.elixir" injection-regex = "(elixir|ex)" file-types = ["ex", "exs", "mix.lock"] shebangs = ["elixir"] -roots = [] +roots = ["mix.exs", "mix.lock"] comment-token = "#" language-server = { command = "elixir-ls" } config = { elixirLS.dialyzerEnabled = false } -- 2.38.5 From 0d8d8a4ed60aac72e0d294717f71bec17a2a2f07 Mon Sep 17 00:00:00 2001 From: adrian5 Date: Fri, 23 Sep 2022 19:01:41 +0200 Subject: [PATCH 022/556] docs: Punctuation on tutor (#3888) --- runtime/tutor | 58 +++++++++++++++++++++++++-------------------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/runtime/tutor b/runtime/tutor index dc0a345a..313a14a1 100644 --- a/runtime/tutor +++ b/runtime/tutor @@ -70,7 +70,7 @@ _________________________________________________________________ Type the d key to delete the character under the cursor. - 1. Move the cursor to the line below marked -->. + 1. Move the cursor to the line marked '-->' below. 2. Move the cursor to each extra character, and type d to delete it. @@ -92,7 +92,7 @@ _________________________________________________________________ Type the i key to enter Insert mode. - 1. Move the cursor to the line below marked -->. + 1. Move the cursor to the line marked '-->' below. 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. @@ -166,7 +166,7 @@ _________________________________________________________________ I - Insert at the start of the line. A - Insert at the end of the line. - 1. Move to anywhere in the line below marked -->. + 1. Move to anywhere in the line marked '-->' below. 2. Type A ( + a), your cursor will move to the end of the line and you will be able to type. 3. Type the text necessary to match the line below. @@ -181,7 +181,7 @@ _________________________________________________________________ Type o to add a newline and insert below the cursor. Type O to add a newline and insert above the cursor. - 1. Move the cursor to the line below marked -->. + 1. Move the cursor to the line marked '-->' below. 2. Type o to open a line below and type your answer. --> What is the best editor? @@ -228,7 +228,7 @@ _________________________________________________________________ it deletes all selected text. Your cursor is like a single-character selection. - 1. Move the cursor to the line below marked -->. + 1. Move the cursor to the line marked '-->' below. 2. Move to the beginning of a word that needs to be deleted. 3. Type w to select until the beginning of the next word. 4. Type d to delete the selection. @@ -271,7 +271,7 @@ _________________________________________________________________ The change command deletes the current selection and enters Insert mode, so it is a very common shorthand for di. - 1. Move the cursor to the line below marked -->. + 1. Move the cursor to the line marked '-->' below. 2. Move to the start of an incorrect word and type w to select it. 3. Type c to delete the word and enter Insert mode. @@ -290,7 +290,7 @@ _________________________________________________________________ Type a number before a motion to repeat it that many times. - 1. Move the cursor to the line below marked -->. + 1. Move the cursor to the line marked '-->' below. 2. Type 2w to move 2 words forward. 3. Type 3e to move to the end of the third word forward. 4. Type 2b to move 2 words backwards @@ -315,7 +315,7 @@ _________________________________________________________________ In Select mode every movement will extend the selection, as opposed to replacing it. - 1. Move the cursor to the line below marked -->. + 1. Move the cursor to the line marked '-->' below. 2. Move to the F of FOO and type v2w to select the two words. 3. Type d to remove the two words. Notice d returns you to Normal mode. @@ -334,7 +334,7 @@ _________________________________________________________________ Type x to select a whole line. Type x again to select the next. - 1. Move the cursor to the second line below marked -->. + 1. Move the cursor to the second line marked '-->' below. 2. Type x to select the line, and d to delete it. 3. Move to the fourth line. 4. Type x twice or type 2x to select 2 lines, and d to delete. @@ -359,7 +359,7 @@ _________________________________________________________________ Sometimes, you want to deselect without having to move the cursor(s). This can be done using the ; key. - 1. Move the cursor to the line below marked -->. + 1. Move the cursor to the line marked '-->' below. 2. Use the motions you have learned to move around the line, and try using ; to deselect the text after it is selected by the motions. @@ -400,7 +400,7 @@ _________________________________________________________________ Type u to undo. Type U to redo. - 1. Move the cursor to the line below marked -->. + 1. Move the cursor to the line marked '-->' below. 2. Move to the first error, and type d to delete it. 3. Type u to undo your deletion. 4. Fix all the errors on the line. @@ -424,7 +424,7 @@ _________________________________________________________________ Type p to paste the yanked selection after the cursor. Type P to paste the yanked text before the cursor. - 1. Move the cursor to the line below marked -->. + 1. Move the cursor to the line marked '-->' below. Make sure your cursor is on the "b" of banana. 2. Type w to select "banana" and y to yank it. 3. Move to the space between "2" and "3" and type p to paste. @@ -488,7 +488,7 @@ _________________________________________________________________ Type C to duplicate the cursor to the next suitable line. - 1. Move the cursor to the first line below marked -->. + 1. Move the cursor to the first line marked '-->' below. 2. Type C to duplicate the cursor to the next suitable line. Notice how it skips the line in the middle. Keys you type will now affect both cursors. @@ -510,7 +510,7 @@ _________________________________________________________________ Type s to select matches in the selection. - 1. Move the cursor to the line below marked -->. + 1. Move the cursor to the line marked '-->' below. 2. Type x to select the line. 3. Type s. A prompt will appear. 4. Type 'apples' and type . Both occurrences of @@ -533,7 +533,7 @@ _________________________________________________________________ The select command selects regular expressions, not just exact matches, allowing you to target more complex patterns. - 1. Move the cursor to the line below marked -->. + 1. Move the cursor to the line marked '-->' below. 2. Select the line with x and then type s. 3. Enter ' +' to select any amount of consecutive spaces >1. 4. Type c and change the matches to single spaces. @@ -554,7 +554,7 @@ _________________________________________________________________ Type & to align the contents of the selections. - 1. Move the cursor to the first line below marked -->. Place + 1. Move the cursor to the first line marked '-->' below. Place the cursor on the whitespace just after the arrow. 2. Type C four times or 4C. 3. Type W to select the numbers and brackets. @@ -622,7 +622,7 @@ _________________________________________________________________ Type t to do the same, but not including (till) a character. Type uppercase F / T to do the same backwards. - 1. Move the cursor to the line below marked -->. Place the + 1. Move the cursor to the line marked '-->' below. Place the cursor on the first dash. 2. Type f[ to select to the square bracket. 3. Type d to delete your selection. @@ -633,7 +633,7 @@ _________________________________________________________________ --> -----[Free this sentence of its brackets!]----- --> ------Free this sentence of its dashes!------ - Note: Unlike Vim, Helix doesn't limit these commands to the + Note: Unlike Vim, Helix doesn't limit these commands to the current line. It searches for the character in the file. ================================================================= @@ -665,7 +665,7 @@ _________________________________________________________________ Type . to repeat the last insert command. Type A-. to repeat the last f / t selection. - 1. Move the cursor to the line below marked -->. + 1. Move the cursor to the line marked '-->' below. 2. Make a change, insertion or appendage and repeat it with . . 3. Try using A-. with f and t, to select multiple sentences for instance. @@ -708,7 +708,7 @@ _________________________________________________________________ Type R to replace the selection with previously yanked text. - 1. Move the cursor to the line below marked -->. + 1. Move the cursor to the line marked '-->' below. 2. Type w to select "watermelons" and then y to yank it. 3. Select "oranges" with w. 4. Type R to replace "oranges" with "watermelons" @@ -730,7 +730,7 @@ _________________________________________________________________ Type J to join together lines in selection. - 1. Move the cursor to the line below marked -->. + 1. Move the cursor to the line marked '-->' below. 2. Type x four times or 4x to select all four lines. 3. Type J to join the lines together. @@ -752,7 +752,7 @@ lines. Type > to indent a line and < to outdent it. - 1. Move the cursor to the line below marked -->. + 1. Move the cursor to the line marked '-->' below. 2. Move down to the second line and type > to indent it. 3. Move to the third line and type < to outdent it. @@ -775,7 +775,7 @@ lines. Type C-a to increment the number under selection. Type C-x to decrement the number under selection. - 1. Move the cursor to the third line below marked -->. + 1. Move the cursor to the third line marked '-->' below. 2. Type C-a to increment the second point marked 2. 3. Repeat for the point marked 3. 4. Move to the last point and type C-x to decrement the 6. @@ -823,7 +823,7 @@ lines. Type " to select register . - 1. Move the cursor to the line below marked -->. + 1. Move the cursor to the line marked '-->' below. 2. Type w to select "watermelons" and yank with y. 3. Type w to select "bananas". 4. Change to register b with "b and yank with y. @@ -844,7 +844,7 @@ lines. the bottom of your screen. Type Q again to stop recording. Type q to repeat the macro from register @ (the default). - 1. Move the cursor to the first line below marked -->. + 1. Move the cursor to the first line marked '-->' below. 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. @@ -889,7 +889,7 @@ lines. Type * to copy the primary selection into register /, setting the search term to the selection. - 1. Move the cursor to the line below marked -->. + 1. Move the cursor to the line marked '-->' below. 2. Select "horse" with e and type *. 3. Use n and N to jump between the instances of "horse". @@ -908,7 +908,7 @@ lines. of moving the selection to the next match, it adds a new selection on each match. - 1. Move the cursor to the line below marked -->. + 1. Move the cursor to the line marked '-->' below. 2. Select the first "bat" and type * to set it to search. 3. Type v to enter select mode. 4. Type n to select the other "bat". @@ -975,7 +975,7 @@ lines. Type A-, to remove the primary selection. - 1. Move the cursor to the line below marked -->. + 1. Move the cursor to the line marked '-->' below. 2. Select both lines with xx or 2x. 3. Type s to select, type "would" and enter. 4. Use ( and ) to cycle the primary selection and remove the @@ -996,7 +996,7 @@ lines. Type ` to set all selected letters to lowercase. Type Alt-` to set all selected letters to uppercase. - 1. Move the cursor to the first line below marked -->. + 1. Move the cursor to the first line marked '-->' below. 2. Select each wrongly capitalised or lowercase letter and type ~ over them. 3. Move to the second line marked -->. -- 2.38.5 From 42e30e7afaead4fc10a155802e168d2acc0afe81 Mon Sep 17 00:00:00 2001 From: Invader Zim <85027668+zim0369@users.noreply.github.com> Date: Sat, 24 Sep 2022 01:02:37 +0530 Subject: [PATCH 023/556] Add bufferline colors to 15 themes (#3881) Themes: * acme * ayu_dark * ayu_light * ayu_mirage * base16_default_dark * base16_default_light * bogster * catppuccin_frappe * catppuccin_latte * catppuccin_macchiato * catppuccin_mocha * darcula * dark_plus * doom_acario_dark * emacs --- runtime/themes/acme.toml | 2 ++ runtime/themes/ayu_dark.toml | 2 ++ runtime/themes/ayu_light.toml | 3 +++ runtime/themes/ayu_mirage.toml | 2 ++ runtime/themes/base16_default_dark.toml | 3 +++ runtime/themes/base16_default_light.toml | 3 +++ runtime/themes/bogster.toml | 2 ++ runtime/themes/catppuccin_frappe.toml | 5 ++++- runtime/themes/catppuccin_latte.toml | 6 +++++- runtime/themes/catppuccin_macchiato.toml | 5 ++++- runtime/themes/catppuccin_mocha.toml | 5 ++++- runtime/themes/darcula.toml | 2 ++ runtime/themes/dark_plus.toml | 4 ++++ runtime/themes/doom_acario_dark.toml | 3 +++ runtime/themes/emacs.toml | 3 +++ 15 files changed, 46 insertions(+), 4 deletions(-) diff --git a/runtime/themes/acme.toml b/runtime/themes/acme.toml index 3bd5987a..d3be695c 100644 --- a/runtime/themes/acme.toml +++ b/runtime/themes/acme.toml @@ -20,6 +20,8 @@ "diagnostic.error" = {bg="white", modifiers=["bold"]} "diagnostic.warning" = {bg="white", modifiers=["bold"]} "diagnostic.hint" = {bg="white", modifiers=["bold"]} +"ui.bufferline" = { fg = "indent", bg = "acme_bar_bg" } +"ui.bufferline.active" = { fg = "black", bg = "acme_bg" } [palette] white = "#ffffff" diff --git a/runtime/themes/ayu_dark.toml b/runtime/themes/ayu_dark.toml index f6dc1c81..43fffee8 100644 --- a/runtime/themes/ayu_dark.toml +++ b/runtime/themes/ayu_dark.toml @@ -59,6 +59,8 @@ "diagnostic.info"= { fg = "blue", modifiers = ["underlined"] } "diagnostic.warning"= { fg = "yellow", modifiers = ["underlined"] } "diagnostic.error"= { fg = "red", modifiers = ["underlined"] } +"ui.bufferline" = { fg = "gray", bg = "background" } +"ui.bufferline.active" = { fg = "foreground", bg = "dark_gray" } "special" = { fg = "orange" } diff --git a/runtime/themes/ayu_light.toml b/runtime/themes/ayu_light.toml index 3a543f5f..7ea4ef58 100644 --- a/runtime/themes/ayu_light.toml +++ b/runtime/themes/ayu_light.toml @@ -59,6 +59,8 @@ "diagnostic.info"= { fg = "blue", modifiers = ["underlined"] } "diagnostic.warning"= { fg = "yellow", modifiers = ["underlined"] } "diagnostic.error"= { fg = "red", modifiers = ["underlined"] } +"ui.bufferline" = { fg = "gray", bg = "dark_gray" } +"ui.bufferline.active" = { fg = "dark", bg = "background" } "special" = { fg = "orange" } @@ -76,3 +78,4 @@ magenta = "#a37acc" orange = "#fa8d3e" red = "#f07171" yellow = "#ffaa33" +dark = "#131721" diff --git a/runtime/themes/ayu_mirage.toml b/runtime/themes/ayu_mirage.toml index d6c9410d..f3b49d87 100644 --- a/runtime/themes/ayu_mirage.toml +++ b/runtime/themes/ayu_mirage.toml @@ -59,6 +59,8 @@ "diagnostic.info"= { fg = "blue", modifiers = ["underlined"] } "diagnostic.warning"= { fg = "yellow", modifiers = ["underlined"] } "diagnostic.error"= { fg = "red", modifiers = ["underlined"] } +"ui.bufferline" = { fg = "gray", bg = "black" } +"ui.bufferline.active" = { fg = "foreground", bg = "background" } "special" = { fg = "orange" } diff --git a/runtime/themes/base16_default_dark.toml b/runtime/themes/base16_default_dark.toml index 460e7363..74bbcd2e 100644 --- a/runtime/themes/base16_default_dark.toml +++ b/runtime/themes/base16_default_dark.toml @@ -54,6 +54,9 @@ "warning" = "base09" "error" = "base08" +"ui.bufferline" = { fg = "base04", bg = "base00" } +"ui.bufferline.active" = { fg = "base06", bg = "base01" } + [palette] base00 = "#181818" # Default Background base01 = "#282828" # Lighter Background (Used for status bars, line number and folding marks) diff --git a/runtime/themes/base16_default_light.toml b/runtime/themes/base16_default_light.toml index 6874c39e..3784670f 100644 --- a/runtime/themes/base16_default_light.toml +++ b/runtime/themes/base16_default_light.toml @@ -54,6 +54,9 @@ "warning" = "base09" "error" = "base08" +"ui.bufferline" = { fg = "base04", bg = "base01" } +"ui.bufferline.active" = { fg = "base07", bg = "base00" } + [palette] base00 = "#f8f8f8" # Default Background base01 = "#e8e8e8" # Lighter Background (Used for status bars, line number and folding marks) diff --git a/runtime/themes/bogster.toml b/runtime/themes/bogster.toml index 44bbaf92..c1902b9b 100644 --- a/runtime/themes/bogster.toml +++ b/runtime/themes/bogster.toml @@ -48,6 +48,8 @@ "ui.cursorline" = { bg = "#131920" } "ui.statusline" = { fg = "#e5ded6", bg = "#232d38" } "ui.statusline.inactive" = { fg = "#c6b8ad", bg = "#232d38" } +"ui.bufferline" = { fg = "#627d9d", bg = "#131920" } +"ui.bufferline.active" = { fg = "#e5ded6", bg = "#232d38" } "ui.popup" = { bg = "#232d38" } "ui.window" = { bg = "#232d38" } "ui.help" = { bg = "#232d38", fg = "#e5ded6" } diff --git a/runtime/themes/catppuccin_frappe.toml b/runtime/themes/catppuccin_frappe.toml index e7db8b16..89ae77c8 100644 --- a/runtime/themes/catppuccin_frappe.toml +++ b/runtime/themes/catppuccin_frappe.toml @@ -70,6 +70,9 @@ "ui.statusline.insert" = { fg = "surface0", bg = "green", modifiers = ["bold"] } "ui.statusline.select" = { fg = "surface0", bg = "flamingo", modifiers = ["bold"] } +"ui.bufferline" = { fg = "subtext1", bg = "mantle" } +"ui.bufferline.active" = { fg = "text", bg = "surface0", modifiers = ["bold"] } + "ui.popup" = { fg = "text", bg = "surface0" } "ui.window" = { fg = "crust" } "ui.help" = { fg = "overlay2", bg = "surface0" } @@ -134,4 +137,4 @@ crust = "#232634" # derived colors by blending existing palette colors cursorline = "#3b3f52" -secondary_cursor = "#b8a5a6" \ No newline at end of file +secondary_cursor = "#b8a5a6" diff --git a/runtime/themes/catppuccin_latte.toml b/runtime/themes/catppuccin_latte.toml index 4cd8b3c1..8e8780f9 100644 --- a/runtime/themes/catppuccin_latte.toml +++ b/runtime/themes/catppuccin_latte.toml @@ -70,6 +70,10 @@ "ui.statusline.insert" = { fg = "surface0", bg = "green", modifiers = ["bold"] } "ui.statusline.select" = { fg = "surface0", bg = "flamingo", modifiers = ["bold"] } +"ui.bufferline" = { fg = "overlay2", bg = "surface1", modifiers = ["italic"] } +"ui.bufferline.active" = { fg = "text", bg = "surface0", modifiers = ["bold"] } +"ui.bufferline.background" = { bg = "surface1" } + "ui.popup" = { fg = "text", bg = "surface0" } "ui.window" = { fg = "crust" } "ui.help" = { fg = "overlay2", bg = "surface0" } @@ -134,4 +138,4 @@ crust = "#dce0e8" # derived colors by blending existing palette colors cursorline = "#e9ebf1" -secondary_cursor = "#e2a99e" \ No newline at end of file +secondary_cursor = "#e2a99e" diff --git a/runtime/themes/catppuccin_macchiato.toml b/runtime/themes/catppuccin_macchiato.toml index da589101..c2fe3184 100644 --- a/runtime/themes/catppuccin_macchiato.toml +++ b/runtime/themes/catppuccin_macchiato.toml @@ -70,6 +70,9 @@ "ui.statusline.insert" = { fg = "surface0", bg = "green", modifiers = ["bold"] } "ui.statusline.select" = { fg = "surface0", bg = "flamingo", modifiers = ["bold"] } +"ui.bufferline.active" = { fg = "text", bg = "base", modifiers = ["bold"] } +"ui.bufferline" = { fg = "overlay1", bg = "mantle" } + "ui.popup" = { fg = "text", bg = "surface0" } "ui.window" = { fg = "crust" } "ui.help" = { fg = "overlay2", bg = "surface0" } @@ -134,4 +137,4 @@ crust = "#181926" # derived colors by blending existing palette colors cursorline = "#303347" -secondary_cursor = "#b6a5a7" \ No newline at end of file +secondary_cursor = "#b6a5a7" diff --git a/runtime/themes/catppuccin_mocha.toml b/runtime/themes/catppuccin_mocha.toml index 279859b2..c4750b28 100644 --- a/runtime/themes/catppuccin_mocha.toml +++ b/runtime/themes/catppuccin_mocha.toml @@ -70,6 +70,9 @@ "ui.statusline.insert" = { fg = "surface0", bg = "green", modifiers = ["bold"] } "ui.statusline.select" = { fg = "surface0", bg = "flamingo", modifiers = ["bold"] } +"ui.bufferline.active" = { fg = "text", bg = "base", modifiers = ["bold"] } +"ui.bufferline" = { fg = "overlay1", bg = "mantle" } + "ui.popup" = { fg = "text", bg = "surface0" } "ui.window" = { fg = "crust" } "ui.help" = { fg = "overlay2", bg = "surface0" } @@ -134,4 +137,4 @@ crust = "#11111b" # derived colors by blending existing palette colors cursorline = "#2a2b3c" -secondary_cursor = "#b5a6a8" \ No newline at end of file +secondary_cursor = "#b5a6a8" diff --git a/runtime/themes/darcula.toml b/runtime/themes/darcula.toml index 00176ff2..5e88438e 100644 --- a/runtime/themes/darcula.toml +++ b/runtime/themes/darcula.toml @@ -23,6 +23,8 @@ "ui.virtual.ruler" = { bg = "grey02" } "ui.virtual.indent-guide" = "grey02" "ui.virtual.whitespace" = "grey03" +"ui.bufferline" = { fg = "grey04", bg = "grey00" } +"ui.bufferline.active" = { fg = "grey07", bg = "grey02" } "operator" = "grey05" "variable" = "white" diff --git a/runtime/themes/dark_plus.toml b/runtime/themes/dark_plus.toml index 29a55281..f99da4fb 100644 --- a/runtime/themes/dark_plus.toml +++ b/runtime/themes/dark_plus.toml @@ -76,6 +76,10 @@ "ui.statusline" = { fg = "white", bg = "blue" } "ui.statusline.inactive" = { fg = "white", bg = "blue" } +"ui.bufferline" = { fg = "text", bg = "widget" } +"ui.bufferline.active" = { fg = "white", bg = "blue" } +"ui.bufferline.background" = { bg = "background" } + "ui.text" = { fg = "text" } "ui.text.focus" = { fg = "white" } diff --git a/runtime/themes/doom_acario_dark.toml b/runtime/themes/doom_acario_dark.toml index 4ff90476..c38c93ee 100644 --- a/runtime/themes/doom_acario_dark.toml +++ b/runtime/themes/doom_acario_dark.toml @@ -53,6 +53,9 @@ 'ui.statusline.normal' = { bg = 'base3' } 'ui.statusline.insert' = { bg = 'base3' } 'ui.statusline.select' = { bg = 'base3' } +'ui.bufferline' = { fg = 'gray', bg = 'base2' } +'ui.bufferline.active' = { fg = 'white', bg = 'base4' } +'ui.bufferline.background' = { bg = 'bg' } 'ui.popup' = { bg = 'bg-alt' } 'ui.window' = { fg = 'gray' } 'ui.help' = { fg = 'fg', bg = 'base2' } diff --git a/runtime/themes/emacs.toml b/runtime/themes/emacs.toml index 598020bd..cc725df8 100644 --- a/runtime/themes/emacs.toml +++ b/runtime/themes/emacs.toml @@ -54,6 +54,9 @@ "ui.linenr.selected" = { fg = "gray80" } "ui.statusline" = { fg = "black", bg = "gray75" } "ui.statusline.inactive" = { fg = "gray20", bg = "gray90" } +"ui.bufferline" = { fg = "gray36", bg = "gray90", modifiers = ["underlined"] } +"ui.bufferline.active" = { fg = "gray0", bg = "gray99" } +"ui.bufferline.background" = { bg = "gray75" } "ui.popup" = { fg = "black", bg = "gray97" } "ui.popup.info" = { fg = "black", bg = "gray97" } "ui.window" = { fg = "black" } -- 2.38.5 From 1a4a9b86d74eade2a8df4ae68d97433323f22fac Mon Sep 17 00:00:00 2001 From: Clay Date: Sat, 24 Sep 2022 23:51:25 -0700 Subject: [PATCH 024/556] heex: upgrade grammar, add roots matching elixir (#3959) --- languages.toml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/languages.toml b/languages.toml index 133b87ae..a7b8f93d 100644 --- a/languages.toml +++ b/languages.toml @@ -1287,7 +1287,7 @@ name = "eex" scope = "source.eex" injection-regex = "eex" file-types = ["eex"] -roots = [] +roots = ["mix.exs", "mix.lock"] indent = { tab-width = 2, unit = " " } [[grammar]] @@ -1299,12 +1299,12 @@ name = "heex" scope = "source.heex" injection-regex = "heex" file-types = ["heex"] -roots = [] +roots = ["mix.exs", "mix.lock"] indent = { tab-width = 2, unit = " " } [[grammar]] name = "heex" -source = { git = "https://github.com/phoenixframework/tree-sitter-heex", rev = "961bc4d2937cfd24ceb0a5a6b2da607809f8822e" } +source = { git = "https://github.com/phoenixframework/tree-sitter-heex", rev = "881f1c805f51485a26ecd7865d15c9ef8d606a78" } [[language]] name = "sql" -- 2.38.5 From e8f0886b21d279fedce53d85f53bb537c1ad808e Mon Sep 17 00:00:00 2001 From: Poliorcetics Date: Sun, 25 Sep 2022 15:12:33 +0200 Subject: [PATCH 025/556] chore: remove unneeded attribute after MSRV bump to 1.61 (#3961) --- helix-term/src/ui/picker.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/helix-term/src/ui/picker.rs b/helix-term/src/ui/picker.rs index d125a6aa..a56455d7 100644 --- a/helix-term/src/ui/picker.rs +++ b/helix-term/src/ui/picker.rs @@ -367,7 +367,6 @@ impl Picker { } else if pattern.starts_with(&self.previous_pattern) { // optimization: if the pattern is a more specific version of the previous one // then we can score the filtered set. - #[allow(unstable_name_collisions)] self.matches.retain_mut(|(index, score)| { let option = &self.options[*index]; let text = option.sort_text(&self.editor_data); -- 2.38.5 From c196a90684d8b798aa90c60c3777f316966757b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oskar=20K=C3=B6=C3=B6k?= Date: Mon, 26 Sep 2022 15:56:07 +0300 Subject: [PATCH 026/556] Add documentation for `max-line-length` (#3974) --- book/src/languages.md | 1 + 1 file changed, 1 insertion(+) diff --git a/book/src/languages.md b/book/src/languages.md index 841b1377..73c81213 100644 --- a/book/src/languages.md +++ b/book/src/languages.md @@ -61,6 +61,7 @@ These configuration keys are available: | `config` | Language Server configuration | | `grammar` | The tree-sitter grammar to use (defaults to the value of `name`) | | `formatter` | The formatter for the language, it will take precedence over the lsp when defined. The formatter must be able to take the original file as input from stdin and write the formatted file to stdout | +| `max-line-length` | Maximum line length. Used for the `:reflow` command | ### Language Server configuration -- 2.38.5 From 98dd9c4f2bf71e9afb72f61af9d45100fda0526e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oskar=20K=C3=B6=C3=B6k?= Date: Mon, 26 Sep 2022 20:04:32 +0300 Subject: [PATCH 027/556] Remove `do_block` from Ruby indents (#3976) `do_block` and `block` seem to conflict, causing double-indentation in some cases. Removing `do_block` does not seem to have any negative effect, while fixing the double-indentation issue. --- runtime/queries/ruby/indents.scm | 1 - 1 file changed, 1 deletion(-) diff --git a/runtime/queries/ruby/indents.scm b/runtime/queries/ruby/indents.scm index f5a6d19b..7fcf59f5 100644 --- a/runtime/queries/ruby/indents.scm +++ b/runtime/queries/ruby/indents.scm @@ -6,7 +6,6 @@ (call) (class) (case) - (do_block) (elsif) (if) (hash) -- 2.38.5 From fd4cdf0b1f32c5ef6d8725aac971a94bdfd41a30 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 26 Sep 2022 18:19:50 -0500 Subject: [PATCH 028/556] build(deps): bump once_cell from 1.14.0 to 1.15.0 (#3987) Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- 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 cc9e69b4..7715fabc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -730,9 +730,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.14.0" +version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f7254b99e31cad77da24b08ebf628882739a608578bb1bcdfc1f9c21260d7c0" +checksum = "e82dad04139b71a90c080c8463fe0dc7902db5192d939bd0950f074d014339e1" [[package]] name = "parking_lot" diff --git a/helix-core/Cargo.toml b/helix-core/Cargo.toml index 0ec58af9..0a4790a3 100644 --- a/helix-core/Cargo.toml +++ b/helix-core/Cargo.toml @@ -26,7 +26,7 @@ unicode-general-category = "0.5" # slab = "0.4.2" slotmap = "1.0" tree-sitter = "0.20" -once_cell = "1.14" +once_cell = "1.15" arc-swap = "1" regex = "1" diff --git a/helix-loader/Cargo.toml b/helix-loader/Cargo.toml index e23e0290..b4541de5 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.14" +once_cell = "1.15" log = "0.4" # TODO: these two should be on !wasm32 only diff --git a/helix-term/Cargo.toml b/helix-term/Cargo.toml index b36063e4..ac50b610 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.14" +once_cell = "1.15" which = "4.2" diff --git a/helix-view/Cargo.toml b/helix-view/Cargo.toml index 9182ce23..266a5732 100644 --- a/helix-view/Cargo.toml +++ b/helix-view/Cargo.toml @@ -22,7 +22,7 @@ helix-dap = { version = "0.6", path = "../helix-dap" } crossterm = { version = "0.25", optional = true } # Conversion traits -once_cell = "1.14" +once_cell = "1.15" url = "2" arc-swap = { version = "1.5.1" } -- 2.38.5 From d2bb7f5a09c8f46fbf963772e8a6d713d86229fe Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 26 Sep 2022 18:22:48 -0500 Subject: [PATCH 029/556] build(deps): bump tokio-stream from 0.1.9 to 0.1.10 (#3988) Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Cargo.lock | 4 ++-- helix-lsp/Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7715fabc..279577bb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1196,9 +1196,9 @@ dependencies = [ [[package]] name = "tokio-stream" -version = "0.1.9" +version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df54d54117d6fdc4e4fea40fe1e4e566b3505700e148a6827e59b34b0d2600d9" +checksum = "f6edf2d6bc038a43d31353570e27270603f4648d18f5ed10c0e179abe43255af" dependencies = [ "futures-core", "pin-project-lite", diff --git a/helix-lsp/Cargo.toml b/helix-lsp/Cargo.toml index 2e5b8139..536a6ba6 100644 --- a/helix-lsp/Cargo.toml +++ b/helix-lsp/Cargo.toml @@ -23,5 +23,5 @@ serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" thiserror = "1.0" tokio = { version = "1.21", features = ["rt", "rt-multi-thread", "io-util", "io-std", "time", "process", "macros", "fs", "parking_lot", "sync"] } -tokio-stream = "0.1.9" +tokio-stream = "0.1.10" which = "4.2" -- 2.38.5 From 90468ad6c592c9a93e30b0809b42552e3b24f1e7 Mon Sep 17 00:00:00 2001 From: Jacob Chandler Date: Mon, 26 Sep 2022 19:27:54 -0400 Subject: [PATCH 030/556] fix: Improve JSX and TSX tag highlighting (#3973) --- runtime/queries/jsx/highlights.scm | 16 +++++++++++++--- runtime/queries/tsx/highlights.scm | 2 +- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/runtime/queries/jsx/highlights.scm b/runtime/queries/jsx/highlights.scm index d7054336..a1eb2d0e 100644 --- a/runtime/queries/jsx/highlights.scm +++ b/runtime/queries/jsx/highlights.scm @@ -1,5 +1,3 @@ -; inherits: ecma - ; Highlight component names differently (jsx_opening_element ((identifier) @constructor (#match? @constructor "^[A-Z]"))) @@ -7,21 +5,33 @@ ; Handle the dot operator effectively - (jsx_opening_element ((nested_identifier (identifier) @tag (identifier) @constructor))) +; Highlight brackets differently +(jsx_opening_element ["<" ">"] @punctuation.bracket) + (jsx_closing_element ((identifier) @constructor (#match? @constructor "^[A-Z]"))) ; Handle the dot operator effectively - (jsx_closing_element ((nested_identifier (identifier) @tag (identifier) @constructor))) +; Highlight brackets differently +(jsx_closing_element ["<" "/" ">"] @punctuation.bracket) + (jsx_self_closing_element ((identifier) @constructor (#match? @constructor "^[A-Z]"))) ; Handle the dot operator effectively - (jsx_self_closing_element ((nested_identifier (identifier) @tag (identifier) @constructor))) -; TODO: also tag @punctuation.delimiter? +; Highlight brackets differently +(jsx_self_closing_element ["<" "/" ">"] @punctuation.bracket) + +; Handle attribute delimiter +(jsx_attribute "=" @punctuation.delimiter) (jsx_opening_element (identifier) @tag) (jsx_closing_element (identifier) @tag) (jsx_self_closing_element (identifier) @tag) (jsx_attribute (property_identifier) @variable.other.member) + +; inherits: ecma diff --git a/runtime/queries/tsx/highlights.scm b/runtime/queries/tsx/highlights.scm index 1b61e36d..100c7cc7 100644 --- a/runtime/queries/tsx/highlights.scm +++ b/runtime/queries/tsx/highlights.scm @@ -1 +1 @@ -; inherits: typescript +; inherits: jsx,typescript -- 2.38.5 From e3fbeeb7893b73508d2cb2fee5271403b1e227c7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 26 Sep 2022 18:36:40 -0500 Subject: [PATCH 031/556] build(deps): bump unicode-general-category from 0.5.1 to 0.6.0 (#3990) Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Cargo.lock | 4 ++-- helix-core/Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 279577bb..b829efd2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1241,9 +1241,9 @@ checksum = "099b7128301d285f79ddd55b9a83d5e6b9e97c92e0ea0daebee7263e932de992" [[package]] name = "unicode-general-category" -version = "0.5.1" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1218098468b8085b19a2824104c70d976491d247ce194bbd9dc77181150cdfd6" +checksum = "2281c8c1d221438e373249e065ca4989c4c36952c211ff21a0ee91c44a3869e7" [[package]] name = "unicode-ident" diff --git a/helix-core/Cargo.toml b/helix-core/Cargo.toml index 0a4790a3..ba6901ba 100644 --- a/helix-core/Cargo.toml +++ b/helix-core/Cargo.toml @@ -22,7 +22,7 @@ smallvec = "1.9" smartstring = "1.0.1" unicode-segmentation = "1.10" unicode-width = "0.1" -unicode-general-category = "0.5" +unicode-general-category = "0.6" # slab = "0.4.2" slotmap = "1.0" tree-sitter = "0.20" -- 2.38.5 From cc0018a7d307e67fe2151930ab395f8532639d18 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 26 Sep 2022 18:43:14 -0500 Subject: [PATCH 032/556] build(deps): bump thiserror from 1.0.35 to 1.0.36 (#3991) Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Cargo.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b829efd2..3a2dbc51 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1111,18 +1111,18 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.35" +version = "1.0.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c53f98874615aea268107765aa1ed8f6116782501d18e53d08b471733bea6c85" +checksum = "0a99cb8c4b9a8ef0e7907cd3b617cc8dc04d571c4e73c8ae403d80ac160bb122" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.35" +version = "1.0.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8b463991b4eab2d801e724172285ec4195c650e8ec79b149e6c2a8e6dd3f783" +checksum = "3a891860d3c8d66fec8e73ddb3765f90082374dbaaa833407b904a94f1a7eb43" dependencies = [ "proc-macro2", "quote", -- 2.38.5 From 8fc493137d159c4b1fbf964ed52dc6d53f6fcaf8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 26 Sep 2022 18:43:30 -0500 Subject: [PATCH 033/556] build(deps): bump serde from 1.0.144 to 1.0.145 (#3989) Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Cargo.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 3a2dbc51..e5edcaac 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -916,18 +916,18 @@ checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" [[package]] name = "serde" -version = "1.0.144" +version = "1.0.145" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f747710de3dcd43b88c9168773254e809d8ddbdf9653b84e2554ab219f17860" +checksum = "728eb6351430bccb993660dfffc5a72f91ccc1295abaa8ce19b27ebe4f75568b" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.144" +version = "1.0.145" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94ed3a816fb1d101812f83e789f888322c34e291f894f19590dc310963e87a00" +checksum = "81fa1584d3d1bcacd84c277a0dfe21f5b0f6accf4a23d04d4c6d61f1af522b4c" dependencies = [ "proc-macro2", "quote", -- 2.38.5 From bdc7b35214ec12a013941f7f6753331d47952bb2 Mon Sep 17 00:00:00 2001 From: Erin Kim <79354991+oati@users.noreply.github.com> Date: Tue, 27 Sep 2022 13:01:58 +0000 Subject: [PATCH 034/556] nix: replace `runCommandNoCC` with `runCommand` (#3992) --- grammars.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/grammars.nix b/grammars.nix index 066fa69d..9ca0cf3d 100644 --- a/grammars.nix +++ b/grammars.nix @@ -2,7 +2,7 @@ stdenv, lib, runCommandLocal, - runCommandNoCC, + runCommand, yj, includeGrammarIf ? _: true, ... @@ -115,7 +115,7 @@ builtins.map (grammar: "ln -s ${grammar.artifact}/${grammar.name}.so $out/${grammar.name}.so") builtGrammars; in - runCommandNoCC "consolidated-helix-grammars" {} '' + runCommand "consolidated-helix-grammars" {} '' mkdir -p $out ${builtins.concatStringsSep "\n" grammarLinks} '' -- 2.38.5 From 5dbca0fc089b3bfdd58162eabc4ee1c3fd2a52bd Mon Sep 17 00:00:00 2001 From: Sven-Hendrik Haase Date: Wed, 28 Sep 2022 16:50:53 +0200 Subject: [PATCH 035/556] Add gruvbox dark (#3948) * Add gruvbox dark * fixup! Add gruvbox dark --- runtime/themes/gruvbox_dark_hard.toml | 102 ++++++++++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 runtime/themes/gruvbox_dark_hard.toml diff --git a/runtime/themes/gruvbox_dark_hard.toml b/runtime/themes/gruvbox_dark_hard.toml new file mode 100644 index 00000000..708ca2b2 --- /dev/null +++ b/runtime/themes/gruvbox_dark_hard.toml @@ -0,0 +1,102 @@ +# Author : Sven-Hendrik Haase +# Author : Jakub Bartodziej +# The theme uses the gruvbox dark palette with hard contrast: github.com/morhetz/gruvbox + +"attribute" = "aqua1" +"keyword" = { fg = "red1" } +"keyword.directive" = "red0" +"namespace" = "aqua1" +"punctuation" = "orange1" +"punctuation.delimiter" = "orange1" +"operator" = "purple1" +"special" = "purple0" +"variable.other.member" = "blue1" +"variable" = "fg1" +"variable.builtin" = "orange1" +"variable.parameter" = "fg2" +"type" = "yellow1" +"type.builtin" = "yellow1" +"constructor" = { fg = "purple1", modifiers = ["bold"] } +"function" = { fg = "green1", modifiers = ["bold"] } +"function.macro" = "aqua1" +"function.builtin" = "yellow1" +"tag" = "red1" +"comment" = { fg = "gray1", modifiers = ["italic"] } +"constant" = { fg = "purple1" } +"constant.builtin" = { fg = "purple1", modifiers = ["bold"] } +"string" = "green1" +"constant.numeric" = "purple1" +"constant.character.escape" = { fg = "fg2", modifiers = ["bold"] } +"label" = "aqua1" +"module" = "aqua1" + +"diff.plus" = "green1" +"diff.delta" = "orange1" +"diff.minus" = "red1" + +"warning" = { fg = "orange1", bg = "bg1" } +"error" = { fg = "red1", bg = "bg1" } +"info" = { fg = "aqua1", bg = "bg1" } +"hint" = { fg = "blue1", bg = "bg1" } + +"ui.background" = { bg = "bg0" } +"ui.linenr" = { fg = "bg4" } +"ui.linenr.selected" = { fg = "yellow1" } +"ui.cursorline" = { bg = "bg1" } +"ui.statusline" = { fg = "fg1", bg = "bg2" } +"ui.statusline.normal" = { fg = "fg1", bg = "bg2" } +"ui.statusline.insert" = { fg = "fg1", bg = "blue0" } +"ui.statusline.select" = { fg = "fg1", bg = "orange0" } +"ui.statusline.inactive" = { fg = "fg4", bg = "bg1" } +"ui.popup" = { bg = "bg1" } +"ui.window" = { bg = "bg1" } +"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.menu" = { fg = "fg1", bg = "bg2" } +"ui.menu.selected" = { fg = "bg2", bg = "blue1", modifiers = ["bold"] } +"ui.virtual.whitespace" = "bg2" +"ui.virtual.ruler" = { bg = "bg1" } + +"diagnostic" = { modifiers = ["underlined"] } + +"markup.heading" = "aqua1" +"markup.bold" = { modifiers = ["bold"] } +"markup.italic" = { modifiers = ["italic"] } +"markup.link.url" = { fg = "green1", modifiers = ["underlined"] } +"markup.link.text" = "red1" +"markup.raw" = "red1" + +[palette] +bg0 = "#1d2021" # main background +bg1 = "#3c3836" +bg2 = "#504945" +bg3 = "#665c54" +bg4 = "#7c6f64" + +fg0 = "#fbf1c7" +fg1 = "#ebdbb2" # main foreground +fg2 = "#d5c4a1" +fg3 = "#bdae93" +fg4 = "#a89984" # gray0 + +gray0 = "#a89984" +gray1 = "#928374" + +red0 = "#cc241d" # neutral +red1 = "#fb4934" # bright +green0 = "#98971a" +green1 = "#b8bb26" +yellow0 = "#d79921" +yellow1 = "#fabd2f" +blue0 = "#458588" +blue1 = "#83a598" +purple0 = "#b16286" +purple1 = "#d3869b" +aqua0 = "#689d6a" +aqua1 = "#8ec07c" +orange0 = "#d65d0e" +orange1 = "#fe8019" -- 2.38.5 From 038ad6289f7d5e84d17da2dfb5723116641c62e1 Mon Sep 17 00:00:00 2001 From: Sora Date: Thu, 29 Sep 2022 01:50:24 +0200 Subject: [PATCH 036/556] Fix tutor typo `favourite` to `favorite` (#4007) --- runtime/tutor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/tutor b/runtime/tutor index 313a14a1..04ea8fcd 100644 --- a/runtime/tutor +++ b/runtime/tutor @@ -520,7 +520,7 @@ _________________________________________________________________ 6. Type , to remove the second cursor. --> I like to eat apples since my favorite fruit is apples. - I like to eat oranges since my favourite fruit is oranges. + I like to eat oranges since my favorite fruit is oranges. -- 2.38.5 From c4aec0a5c573bca755a49e3031c483422031874f Mon Sep 17 00:00:00 2001 From: joleaf <71190322+joleaf@users.noreply.github.com> Date: Thu, 29 Sep 2022 17:02:55 +0200 Subject: [PATCH 037/556] tutor: missing before removing the second cursor (#4027) This step was missing in section 5.2 of tutor. --- runtime/tutor | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/runtime/tutor b/runtime/tutor index 04ea8fcd..8eef33af 100644 --- a/runtime/tutor +++ b/runtime/tutor @@ -517,7 +517,8 @@ _________________________________________________________________ 'apples' in the line will be selected. 5. You can now type c and change 'apples' to something else, like 'oranges'. - 6. Type , to remove the second cursor. + 6. Type to exit Insert mode. + 7. Type , to remove the second cursor. --> I like to eat apples since my favorite fruit is apples. I like to eat oranges since my favorite fruit is oranges. @@ -525,7 +526,6 @@ _________________________________________________________________ - ================================================================= = 5.3 SELECTING VIA REGEX = ================================================================= -- 2.38.5 From 8a7a6e4cff1db3ef65a2c20e0e90c60b44516e27 Mon Sep 17 00:00:00 2001 From: Maximilian Muecke Date: Thu, 29 Sep 2022 20:11:45 +0200 Subject: [PATCH 038/556] Add comment injection for R (#4031) --- runtime/queries/r/injections.scm | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 runtime/queries/r/injections.scm diff --git a/runtime/queries/r/injections.scm b/runtime/queries/r/injections.scm new file mode 100644 index 00000000..321c90ad --- /dev/null +++ b/runtime/queries/r/injections.scm @@ -0,0 +1,2 @@ +((comment) @injection.content + (#set! injection.language "comment")) -- 2.38.5 From 60aa7d360777331753ae4735f8fd4ea96012d4fd Mon Sep 17 00:00:00 2001 From: Chickenkeeper Date: Fri, 30 Sep 2022 23:43:07 +0100 Subject: [PATCH 039/556] WGSL syntax highlighting fix (#3996) --- languages.toml | 2 +- runtime/queries/wgsl/highlights.scm | 62 +++++++++++++++++------------ 2 files changed, 38 insertions(+), 26 deletions(-) diff --git a/languages.toml b/languages.toml index a7b8f93d..ab204fcc 100644 --- a/languages.toml +++ b/languages.toml @@ -848,7 +848,7 @@ indent = { tab-width = 4, unit = " " } [[grammar]] name = "wgsl" -source = { git = "https://github.com/szebniok/tree-sitter-wgsl", rev = "f00ff52251edbd58f4d39c9c3204383253032c11" } +source = { git = "https://github.com/szebniok/tree-sitter-wgsl", rev = "272e89ef2aeac74178edb9db4a83c1ffef80a463" } [[language]] name = "llvm" diff --git a/runtime/queries/wgsl/highlights.scm b/runtime/queries/wgsl/highlights.scm index 7fbc87d8..baf9dd8f 100644 --- a/runtime/queries/wgsl/highlights.scm +++ b/runtime/queries/wgsl/highlights.scm @@ -1,23 +1,41 @@ -(const_literal) @constant.numeric +(int_literal) @constant.numeric.integer +(float_literal) @constant.numeric.float +(bool_literal) @constant.builtin.boolean -(type_declaration) @type +(global_constant_declaration) @variable +(global_variable_declaration) @variable +(compound_statement) @variable +(const_expression) @function + +(variable_identifier_declaration + (identifier) @variable + (type_declaration) @type) (function_declaration - (identifier) @function) + (identifier) @function + (function_return_type_declaration + (type_declaration) @type)) + +(parameter + (variable_identifier_declaration + (identifier) @variable.parameter + (type_declaration) @type)) (struct_declaration (identifier) @type) + +(struct_declaration + (struct_member + (variable_identifier_declaration + (identifier) @variable.other.member + (type_declaration) @type))) (type_constructor_or_function_call_expression (type_declaration) @function) -(parameter - (variable_identifier_declaration (identifier) @variable.parameter)) - [ "struct" "bitcast" - ; "block" "discard" "enable" "fallthrough" @@ -26,36 +44,28 @@ "private" "read" "read_write" - "return" "storage" "type" "uniform" "var" "workgroup" "write" + "override" (texel_format) -] @keyword ; TODO reserved keywords +] @keyword -[ - (true) - (false) -] @constant.builtin.boolean +"fn" @keyword.function -[ "," "." ":" ";" ] @punctuation.delimiter +"return" @keyword.control.return -;; brackets -[ - "(" - ")" - "[" - "]" - "{" - "}" -] @punctuation.bracket +["," "." ":" ";"] @punctuation.delimiter + +["(" ")" "[" "]" "{" "}"] @punctuation.bracket [ "loop" "for" + "while" "break" "continue" "continuing" @@ -64,7 +74,6 @@ [ "if" "else" - "elseif" "switch" "case" "default" @@ -92,10 +101,13 @@ "*" "~" "^" + "@" + "++" + "--" ] @operator (attribute - (identifier) @variable.other.member) + (identifier) @attribute) (comment) @comment -- 2.38.5 From 2113b1bb2fe4d69eada555d562cbcf723201998a Mon Sep 17 00:00:00 2001 From: nuid32 <91177333+nuid32@users.noreply.github.com> Date: Sat, 1 Oct 2022 19:11:15 +0500 Subject: [PATCH 040/556] themes: Add onedarker (#3980) --- runtime/themes/onedarker.toml | 97 +++++++++++++++++++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 runtime/themes/onedarker.toml diff --git a/runtime/themes/onedarker.toml b/runtime/themes/onedarker.toml new file mode 100644 index 00000000..1ad6f7c3 --- /dev/null +++ b/runtime/themes/onedarker.toml @@ -0,0 +1,97 @@ +# Author : nuid32 + +"attribute" = { fg = "yellow" } +"comment" = { fg = "light-gray", modifiers = ["italic"] } +"constant" = { fg = "green" } +"constant.numeric" = { fg = "gold" } +"constant.builtin" = { fg = "gold" } +"constant.character.escape" = { fg = "gold" } +"constructor" = { fg = "blue" } +"function" = { fg = "white" } +"function.builtin" = { fg = "blue" } +"function.macro" = { fg = "purple" } +"keyword" = { fg = "purple" } +"keyword.control" = { fg = "purple" } +"keyword.control.import" = { fg = "purple" } +"keyword.directive" = { fg = "purple" } +"label" = { fg = "purple" } +"namespace" = { fg = "purple" } +"operator" = { fg = "white" } +"keyword.operator" = { fg = "white" } +"special" = { fg = "blue" } +"string" = { fg = "green" } +"type" = { fg = "yellow" } +"variable" = { fg = "white" } +"variable.builtin" = { fg = "red" } +"variable.parameter" = { fg = "red" } +"variable.other.member" = { fg = "blue" } + +"markup.heading" = { fg = "red" } +"markup.raw.inline" = { fg = "green" } +"markup.raw.block" = { fg = "white" } +"markup.bold" = { fg = "gold", modifiers = ["bold"] } +"markup.italic" = { fg = "purple", modifiers = ["italic"] } +"markup.list" = { fg = "red" } +"markup.quote" = { fg = "yellow" } +"markup.link.url" = { fg = "blue", modifiers = ["underlined"]} +"markup.link.text" = { fg = "white" } +"markup.link.label" = { fg = "white" } + +"diff.plus" = "green" +"diff.delta" = "gold" +"diff.minus" = "red" + +diagnostic = { modifiers = ["underlined"] } +"info" = { fg = "blue", modifiers = ["bold"] } +"hint" = { fg = "green", modifiers = ["bold"] } +"warning" = { fg = "yellow", modifiers = ["bold"] } +"error" = { fg = "red", modifiers = ["bold"] } + +"ui.background" = { bg = "black" } +"ui.virtual" = { fg = "faint-gray" } +"ui.virtual.indent-guide" = { fg = "faint-gray" } +"ui.virtual.whitespace" = { fg = "light-gray" } +"ui.virtual.ruler" = { bg = "gray" } + +"ui.cursor" = { fg = "white", modifiers = ["reversed"] } +"ui.cursor.primary" = { fg = "white", modifiers = ["reversed"] } +"ui.cursor.match" = { fg = "blue", modifiers = ["underlined"]} + +"ui.selection" = { bg = "light-gray" } +"ui.selection.primary" = { bg = "gray" } +"ui.cursorline.primary" = { bg = "light-black" } + +"ui.linenr" = { fg = "linenr" } +"ui.linenr.selected" = { fg = "white" } + +"ui.statusline" = { fg = "white", bg = "light-black" } +"ui.statusline.inactive" = { fg = "light-gray", bg = "light-black" } +"ui.statusline.normal" = { fg = "light-black", bg = "purple" } +"ui.statusline.insert" = { fg = "light-black", bg = "green" } +"ui.statusline.select" = { fg = "light-black", bg = "cyan" } +"ui.text" = { fg = "purple" } +"ui.text.focus" = { fg = "white", bg = "light-black", modifiers = ["bold"] } + +"ui.help" = { fg = "white", bg = "gray" } +"ui.popup" = { bg = "gray" } +"ui.window" = { fg = "gray" } +"ui.menu" = { fg = "white", bg = "gray" } +"ui.menu.selected" = { fg = "black", bg = "blue" } +"ui.menu.scroll" = { fg = "white", bg = "light-gray" } + +[palette] + +yellow = "#D5B06B" +blue = "#519FDF" +red = "#D05C65" +purple = "#B668CD" +green = "#7DA869" +gold = "#D19A66" +cyan = "#46A6B2" +white = "#ABB2BF" +black = "#16181A" +light-black = "#2C323C" +gray = "#454D50" +faint-gray = "#ABB2BF" +light-gray = "#C8CCD4" +linenr = "#282C34" -- 2.38.5 From cc257e9bf9a7eee7e68e04d04523a8fae10807cd Mon Sep 17 00:00:00 2001 From: Roberto Vidal Date: Sat, 1 Oct 2022 16:13:52 +0200 Subject: [PATCH 041/556] Add support for webassembly text format (#4040) --- book/src/generated/lang-support.md | 2 ++ languages.toml | 22 ++++++++++++++++++++++ runtime/queries/wast/highlights.scm | 21 +++++++++++++++++++++ runtime/queries/wat/highlights.scm | 17 +++++++++++++++++ 4 files changed, 62 insertions(+) create mode 100644 runtime/queries/wast/highlights.scm create mode 100644 runtime/queries/wat/highlights.scm diff --git a/book/src/generated/lang-support.md b/book/src/generated/lang-support.md index 86c26042..5c64d097 100644 --- a/book/src/generated/lang-support.md +++ b/book/src/generated/lang-support.md @@ -119,6 +119,8 @@ | vala | ✓ | | | `vala-language-server` | | verilog | ✓ | ✓ | | `svlangserver` | | vue | ✓ | | | `vls` | +| wast | ✓ | | | | +| wat | ✓ | | | | | wgsl | ✓ | | | `wgsl_analyzer` | | xit | ✓ | | | | | yaml | ✓ | | ✓ | `yaml-language-server` | diff --git a/languages.toml b/languages.toml index ab204fcc..d7909b6d 100644 --- a/languages.toml +++ b/languages.toml @@ -1781,3 +1781,25 @@ language-server = { command = "bass", args = ["--lsp"] } [[grammar]] name = "bass" source = { git = "https://github.com/vito/tree-sitter-bass", rev = "501133e260d768ed4e1fd7374912ed5c86d6fd90" } + +[[language]] +name = "wat" +scope = "source.wat" +comment-token = ";;" +file-types = ["wat"] +roots = [] + +[[grammar]] +name = "wat" +source = { git = "https://github.com/wasm-lsp/tree-sitter-wasm", rev = "2ca28a9f9d709847bf7a3de0942a84e912f59088", subpath = "wat" } + +[[language]] +name = "wast" +scope = "source.wast" +comment-token = ";;" +file-types = ["wast"] +roots = [] + +[[grammar]] +name = "wast" +source = { git = "https://github.com/wasm-lsp/tree-sitter-wasm", rev = "2ca28a9f9d709847bf7a3de0942a84e912f59088", subpath = "wast" } diff --git a/runtime/queries/wast/highlights.scm b/runtime/queries/wast/highlights.scm new file mode 100644 index 00000000..ef5b547e --- /dev/null +++ b/runtime/queries/wast/highlights.scm @@ -0,0 +1,21 @@ +; inherits: wat + +[ + "assert_return" + "assert_trap" + "assert_exhaustion" + "assert_malformed" + "assert_invalid" + "assert_unlinkable" + "assert_trap" + + "invoke" + "get" + + "script" + "input" + "output" + + "binary" + "quote" +] @keyword diff --git a/runtime/queries/wat/highlights.scm b/runtime/queries/wat/highlights.scm new file mode 100644 index 00000000..007e3bbf --- /dev/null +++ b/runtime/queries/wat/highlights.scm @@ -0,0 +1,17 @@ +["module" "func" "param" "result" "type" "memory" "elem" "data" "table" "global"] @keyword + +["import" "export"] @keyword.control.import + +["local"] @keyword.storage.type + +[(name) (string)] @string + +(identifier) @function + +[(comment_block) (comment_line)] @comment + +[(nat) (float) (align_offset_value)] @constant.numeric.integer + +(value_type) @type + +["(" ")"] @punctuation.bracket -- 2.38.5 From c9584251f321a8540cf530561896b2f48f0b76a2 Mon Sep 17 00:00:00 2001 From: zensayyy <99101223+zensayyy@users.noreply.github.com> Date: Sat, 1 Oct 2022 16:32:09 +0200 Subject: [PATCH 042/556] Ensure cursor in view after format (#4047) Co-authored-by: Michael Davis --- helix-term/src/commands.rs | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index c87ad0ca..fb1a4b38 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -2504,18 +2504,23 @@ async fn make_format_callback( ) -> anyhow::Result { let format = format.await?; let call: job::Callback = Box::new(move |editor, _compositor| { - let view_id = view!(editor).id; - if let Some(doc) = editor.document_mut(doc_id) { - if doc.version() == doc_version { - doc.apply(&format, view_id); - doc.append_changes_to_history(view_id); - doc.detect_indent_and_line_ending(); - if let Modified::SetUnmodified = modified { - doc.reset_modified(); - } - } else { - log::info!("discarded formatting changes because the document changed"); + if !editor.documents.contains_key(&doc_id) { + return; + } + + let scrolloff = editor.config().scrolloff; + let doc = doc_mut!(editor, &doc_id); + let view = view_mut!(editor); + if doc.version() == doc_version { + doc.apply(&format, view.id); + doc.append_changes_to_history(view.id); + doc.detect_indent_and_line_ending(); + view.ensure_cursor_in_view(doc, scrolloff); + if let Modified::SetUnmodified = modified { + doc.reset_modified(); } + } else { + log::info!("discarded formatting changes because the document changed"); } }); Ok(call) -- 2.38.5 From 999b45b28c157418c20a9a8cd9219db6ce0beac7 Mon Sep 17 00:00:00 2001 From: Gokul Soumya Date: Sat, 9 Jul 2022 03:35:06 +0530 Subject: [PATCH 043/556] Support different kinds of underline rendering Adds four new modifiers that can be used in themes: - undercurled - underdashed - underdotted - double-underline --- helix-tui/src/backend/crossterm.rs | 14 +++++++++++- helix-view/src/graphics.rs | 34 +++++++++++++++++++++--------- runtime/themes/onedark.toml | 2 +- 3 files changed, 38 insertions(+), 12 deletions(-) diff --git a/helix-tui/src/backend/crossterm.rs b/helix-tui/src/backend/crossterm.rs index eff098b3..252036f3 100644 --- a/helix-tui/src/backend/crossterm.rs +++ b/helix-tui/src/backend/crossterm.rs @@ -153,7 +153,7 @@ impl ModifierDiff { if removed.contains(Modifier::ITALIC) { map_error(queue!(w, SetAttribute(CAttribute::NoItalic)))?; } - if removed.contains(Modifier::UNDERLINED) { + if removed.intersects(Modifier::ANY_UNDERLINE) { map_error(queue!(w, SetAttribute(CAttribute::NoUnderline)))?; } if removed.contains(Modifier::DIM) { @@ -179,6 +179,18 @@ impl ModifierDiff { if added.contains(Modifier::UNDERLINED) { map_error(queue!(w, SetAttribute(CAttribute::Underlined)))?; } + if added.contains(Modifier::UNDERCURLED) { + map_error(queue!(w, SetAttribute(CAttribute::Undercurled)))?; + } + if added.contains(Modifier::UNDERDOTTED) { + map_error(queue!(w, SetAttribute(CAttribute::Underdotted)))?; + } + if added.contains(Modifier::UNDERDASHED) { + map_error(queue!(w, SetAttribute(CAttribute::Underdashed)))?; + } + if added.contains(Modifier::DOUBLE_UNDERLINED) { + map_error(queue!(w, SetAttribute(CAttribute::DoubleUnderlined)))?; + } if added.contains(Modifier::DIM) { map_error(queue!(w, SetAttribute(CAttribute::Dim)))?; } diff --git a/helix-view/src/graphics.rs b/helix-view/src/graphics.rs index fb3c8b3f..15492119 100644 --- a/helix-view/src/graphics.rs +++ b/helix-view/src/graphics.rs @@ -327,17 +327,27 @@ bitflags! { /// /// let m = Modifier::BOLD | Modifier::ITALIC; /// ``` - #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] + #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize), serde(rename_all = "kebab-case"))] pub struct Modifier: u16 { - const BOLD = 0b0000_0000_0001; - const DIM = 0b0000_0000_0010; - const ITALIC = 0b0000_0000_0100; - const UNDERLINED = 0b0000_0000_1000; - const SLOW_BLINK = 0b0000_0001_0000; - const RAPID_BLINK = 0b0000_0010_0000; - const REVERSED = 0b0000_0100_0000; - const HIDDEN = 0b0000_1000_0000; - const CROSSED_OUT = 0b0001_0000_0000; + const BOLD = 0b0000_0000_0000_0001; + const DIM = 0b0000_0000_0000_0010; + const ITALIC = 0b0000_0000_0000_0100; + const UNDERLINED = 0b0000_0000_0000_1000; + const SLOW_BLINK = 0b0000_0000_0001_0000; + const RAPID_BLINK = 0b0000_0000_0010_0000; + const REVERSED = 0b0000_0000_0100_0000; + const HIDDEN = 0b0000_0000_1000_0000; + const CROSSED_OUT = 0b0000_0001_0000_0000; + const UNDERCURLED = 0b0000_0010_0000_0000; + const UNDERDOTTED = 0b0000_0100_0000_0000; + const UNDERDASHED = 0b0000_1000_0000_0000; + const DOUBLE_UNDERLINED = 0b0001_0000_0000_0000; + + const ANY_UNDERLINE = Self::UNDERLINED.bits + | Self::UNDERCURLED.bits + | Self::UNDERDOTTED.bits + | Self::UNDERDASHED.bits + | Self::DOUBLE_UNDERLINED.bits; } } @@ -355,6 +365,10 @@ impl FromStr for Modifier { "reversed" => Ok(Self::REVERSED), "hidden" => Ok(Self::HIDDEN), "crossed_out" => Ok(Self::CROSSED_OUT), + "undercurled" => Ok(Self::UNDERCURLED), + "underdotted" => Ok(Self::UNDERDOTTED), + "underdashed" => Ok(Self::UNDERDASHED), + "double_underlined" => Ok(Self::DOUBLE_UNDERLINED), _ => Err("Invalid modifier"), } } diff --git a/runtime/themes/onedark.toml b/runtime/themes/onedark.toml index 1e7d9af1..a4cc12eb 100644 --- a/runtime/themes/onedark.toml +++ b/runtime/themes/onedark.toml @@ -39,7 +39,7 @@ "diff.delta" = "gold" "diff.minus" = "red" -diagnostic = { modifiers = ["underlined"] } +diagnostic = { modifiers = ["undercurled"] } "info" = { fg = "blue", modifiers = ["bold"] } "hint" = { fg = "green", modifiers = ["bold"] } "warning" = { fg = "yellow", modifiers = ["bold"] } -- 2.38.5 From 3ad7d543ca17963f0839b1a6cd8abacdb5c60cf7 Mon Sep 17 00:00:00 2001 From: A-Walrus Date: Thu, 11 Aug 2022 14:10:29 +0300 Subject: [PATCH 044/556] Add separate color for underlines --- helix-tui/src/backend/crossterm.rs | 8 +++++++- helix-tui/src/buffer.rs | 7 +++++++ helix-view/src/graphics.rs | 19 +++++++++++++++++++ helix-view/src/theme.rs | 1 + runtime/themes/dark_plus.toml | 3 ++- 5 files changed, 36 insertions(+), 2 deletions(-) diff --git a/helix-tui/src/backend/crossterm.rs b/helix-tui/src/backend/crossterm.rs index 252036f3..fe9da919 100644 --- a/helix-tui/src/backend/crossterm.rs +++ b/helix-tui/src/backend/crossterm.rs @@ -4,7 +4,7 @@ use crossterm::{ execute, queue, style::{ Attribute as CAttribute, Color as CColor, Print, SetAttribute, SetBackgroundColor, - SetForegroundColor, + SetForegroundColor, SetUnderlineColor, }, terminal::{self, Clear, ClearType}, }; @@ -47,6 +47,7 @@ where { let mut fg = Color::Reset; let mut bg = Color::Reset; + let mut underline = Color::Reset; let mut modifier = Modifier::empty(); let mut last_pos: Option<(u16, u16)> = None; for (x, y, cell) in content { @@ -73,6 +74,11 @@ where map_error(queue!(self.buffer, SetBackgroundColor(color)))?; bg = cell.bg; } + if cell.underline != underline { + let color = CColor::from(cell.underline); + map_error(queue!(self.buffer, SetUnderlineColor(color)))?; + underline = cell.underline; + } map_error(queue!(self.buffer, Print(&cell.symbol)))?; } diff --git a/helix-tui/src/buffer.rs b/helix-tui/src/buffer.rs index 21c53aad..14f3ecaf 100644 --- a/helix-tui/src/buffer.rs +++ b/helix-tui/src/buffer.rs @@ -11,6 +11,7 @@ pub struct Cell { pub symbol: String, pub fg: Color, pub bg: Color, + pub underline: Color, pub modifier: Modifier, } @@ -44,6 +45,9 @@ impl Cell { if let Some(c) = style.bg { self.bg = c; } + if let Some(c) = style.underline { + self.underline = c; + } self.modifier.insert(style.add_modifier); self.modifier.remove(style.sub_modifier); self @@ -53,6 +57,7 @@ impl Cell { Style::default() .fg(self.fg) .bg(self.bg) + .underline(self.bg) .add_modifier(self.modifier) } @@ -61,6 +66,7 @@ impl Cell { self.symbol.push(' '); self.fg = Color::Reset; self.bg = Color::Reset; + self.underline = Color::Reset; self.modifier = Modifier::empty(); } } @@ -71,6 +77,7 @@ impl Default for Cell { symbol: " ".into(), fg: Color::Reset, bg: Color::Reset, + underline: Color::Reset, modifier: Modifier::empty(), } } diff --git a/helix-view/src/graphics.rs b/helix-view/src/graphics.rs index 15492119..c995f60c 100644 --- a/helix-view/src/graphics.rs +++ b/helix-view/src/graphics.rs @@ -440,6 +440,7 @@ impl FromStr for Modifier { pub struct Style { pub fg: Option, pub bg: Option, + pub underline: Option, pub add_modifier: Modifier, pub sub_modifier: Modifier, } @@ -449,6 +450,7 @@ impl Default for Style { Style { fg: None, bg: None, + underline: None, add_modifier: Modifier::empty(), sub_modifier: Modifier::empty(), } @@ -461,6 +463,7 @@ impl Style { Style { fg: Some(Color::Reset), bg: Some(Color::Reset), + underline: Some(Color::Reset), add_modifier: Modifier::empty(), sub_modifier: Modifier::all(), } @@ -496,6 +499,21 @@ impl Style { self } + /// Changes the underline color. + /// + /// ## Examples + /// + /// ```rust + /// # use helix_view::graphics::{Color, Style}; + /// let style = Style::default().underline(Color::Blue); + /// let diff = Style::default().underline(Color::Red); + /// assert_eq!(style.patch(diff), Style::default().underline(Color::Red)); + /// ``` + pub fn underline(mut self, color: Color) -> Style { + self.underline = Some(color); + self + } + /// Changes the text emphasis. /// /// When applied, it adds the given modifier to the `Style` modifiers. @@ -552,6 +570,7 @@ impl Style { pub fn patch(mut self, other: Style) -> Style { self.fg = other.fg.or(self.fg); self.bg = other.bg.or(self.bg); + self.underline = other.underline.or(self.underline); self.add_modifier.remove(other.sub_modifier); self.add_modifier.insert(other.add_modifier); diff --git a/helix-view/src/theme.rs b/helix-view/src/theme.rs index fa5fa702..5ce1b2c5 100644 --- a/helix-view/src/theme.rs +++ b/helix-view/src/theme.rs @@ -269,6 +269,7 @@ impl ThemePalette { match name.as_str() { "fg" => *style = style.fg(self.parse_color(value)?), "bg" => *style = style.bg(self.parse_color(value)?), + "underline" => *style = style.underline(self.parse_color(value)?), "modifiers" => { let modifiers = value .as_array() diff --git a/runtime/themes/dark_plus.toml b/runtime/themes/dark_plus.toml index f99da4fb..d1a5756e 100644 --- a/runtime/themes/dark_plus.toml +++ b/runtime/themes/dark_plus.toml @@ -92,7 +92,8 @@ "info" = { fg = "light_blue" } "hint" = { fg = "light_gray3" } -diagnostic = { modifiers = ["underlined"] } +"diagnostic.error" = {underline = "red", modifiers = ["undercurled"] } +"diagnostic" = {underline = "gold", modifiers = ["undercurled"] } [palette] white = "#ffffff" -- 2.38.5 From 79a39c1063eca995bf75694743dc5eb3c905fa9c Mon Sep 17 00:00:00 2001 From: A-Walrus Date: Sun, 4 Sep 2022 11:28:55 +0300 Subject: [PATCH 045/556] Fix failing tests Add underline field to doctests, and fix bugs --- helix-tui/src/buffer.rs | 5 +++-- helix-tui/src/text.rs | 4 ++++ helix-view/src/graphics.rs | 2 ++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/helix-tui/src/buffer.rs b/helix-tui/src/buffer.rs index 14f3ecaf..3036608d 100644 --- a/helix-tui/src/buffer.rs +++ b/helix-tui/src/buffer.rs @@ -57,7 +57,7 @@ impl Cell { Style::default() .fg(self.fg) .bg(self.bg) - .underline(self.bg) + .underline(self.underline) .add_modifier(self.modifier) } @@ -104,7 +104,8 @@ impl Default for Cell { /// symbol: String::from("r"), /// fg: Color::Red, /// bg: Color::White, -/// modifier: Modifier::empty() +/// underline: Color::Reset, +/// modifier: Modifier::empty(), /// }); /// buf[(5, 0)].set_char('x'); /// assert_eq!(buf[(5, 0)].symbol, "x"); diff --git a/helix-tui/src/text.rs b/helix-tui/src/text.rs index 602090e5..73d58803 100644 --- a/helix-tui/src/text.rs +++ b/helix-tui/src/text.rs @@ -134,6 +134,7 @@ impl<'a> Span<'a> { /// style: Style { /// fg: Some(Color::Yellow), /// bg: Some(Color::Black), + /// underline: None, /// add_modifier: Modifier::empty(), /// sub_modifier: Modifier::empty(), /// }, @@ -143,6 +144,7 @@ impl<'a> Span<'a> { /// style: Style { /// fg: Some(Color::Yellow), /// bg: Some(Color::Black), + /// underline: None, /// add_modifier: Modifier::empty(), /// sub_modifier: Modifier::empty(), /// }, @@ -152,6 +154,7 @@ impl<'a> Span<'a> { /// style: Style { /// fg: Some(Color::Yellow), /// bg: Some(Color::Black), + /// underline: None, /// add_modifier: Modifier::empty(), /// sub_modifier: Modifier::empty(), /// }, @@ -161,6 +164,7 @@ impl<'a> Span<'a> { /// style: Style { /// fg: Some(Color::Yellow), /// bg: Some(Color::Black), + /// underline: None, /// add_modifier: Modifier::empty(), /// sub_modifier: Modifier::empty(), /// }, diff --git a/helix-view/src/graphics.rs b/helix-view/src/graphics.rs index c995f60c..6c854fd0 100644 --- a/helix-view/src/graphics.rs +++ b/helix-view/src/graphics.rs @@ -405,6 +405,7 @@ impl FromStr for Modifier { /// fg: Some(Color::Yellow), /// bg: Some(Color::Red), /// add_modifier: Modifier::BOLD, +/// underline: Some(Color::Reset), /// sub_modifier: Modifier::empty(), /// }, /// buffer[(0, 0)].style(), @@ -429,6 +430,7 @@ impl FromStr for Modifier { /// Style { /// fg: Some(Color::Yellow), /// bg: Some(Color::Reset), +/// underline: Some(Color::Reset), /// add_modifier: Modifier::empty(), /// sub_modifier: Modifier::empty(), /// }, -- 2.38.5 From de72b9c04caf1fe12fd6076646657c456403c229 Mon Sep 17 00:00:00 2001 From: A-Walrus Date: Sun, 4 Sep 2022 17:57:14 +0300 Subject: [PATCH 046/556] Update theme documentation --- book/src/themes.md | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/book/src/themes.md b/book/src/themes.md index 9908456f..32ff2498 100644 --- a/book/src/themes.md +++ b/book/src/themes.md @@ -13,10 +13,10 @@ The default theme.toml can be found [here](https://github.com/helix-editor/helix Each line in the theme file is specified as below: ```toml -key = { fg = "#ffffff", bg = "#000000", modifiers = ["bold", "italic"] } +key = { fg = "#ffffff", bg = "#000000", underline = "#ff0000", modifiers = ["bold", "italic", "undercurled"] } ``` -where `key` represents what you want to style, `fg` specifies the foreground color, `bg` the background color, and `modifiers` is a list of style modifiers. `bg` and `modifiers` can be omitted to defer to the defaults. +where `key` represents what you want to style, `fg` specifies the foreground color, `bg` the background color, `underline` the underline color (only meaningful if an underline modifier is enabled), and `modifiers` is a list of style modifiers. `bg`, `underline` and `modifiers` can be omitted to defer to the defaults. To specify only the foreground color: @@ -77,17 +77,21 @@ The following values may be used as modifiers. Less common modifiers might not be supported by your terminal emulator. -| Modifier | -| --- | -| `bold` | -| `dim` | -| `italic` | -| `underlined` | -| `slow_blink` | -| `rapid_blink` | -| `reversed` | -| `hidden` | -| `crossed_out` | +| Modifier | +| --- | +| `bold` | +| `dim` | +| `italic` | +| `underlined` | +| `undercurled` | +| `underdashed` | +| `underdotted` | +| `double-underlined` | +| `slow_blink` | +| `rapid_blink` | +| `reversed` | +| `hidden` | +| `crossed_out` | ### Scopes -- 2.38.5 From 79d3d44c3db48365597eefd274e868bc1e15de57 Mon Sep 17 00:00:00 2001 From: Gokul Soumya Date: Wed, 7 Sep 2022 17:28:58 +0530 Subject: [PATCH 047/556] Detect extended underline support using terminfo The cxterminfo crate has been used over popular alternatives like `term` since it supports querying for extended capabilities and also for it's small codebase size (which will make it easy to inline it into helix in the future if required). --- Cargo.lock | 7 ++++ helix-tui/Cargo.toml | 1 + helix-tui/src/backend/crossterm.rs | 55 ++++++++++++++++++++++++++---- runtime/themes/onedark.toml | 5 ++- 4 files changed, 60 insertions(+), 8 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e5edcaac..f980c417 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -176,6 +176,12 @@ dependencies = [ "winapi", ] +[[package]] +name = "cxterminfo" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da92c5e3aaf2cc1fea346d9b3bac0c59c6ffc1d1d46f18d991d449912a3e6f07" + [[package]] name = "dirs-next" version = "2.0.0" @@ -504,6 +510,7 @@ dependencies = [ "bitflags", "cassowary", "crossterm", + "cxterminfo", "helix-core", "helix-view", "serde", diff --git a/helix-tui/Cargo.toml b/helix-tui/Cargo.toml index b220c64f..1c6a6a8d 100644 --- a/helix-tui/Cargo.toml +++ b/helix-tui/Cargo.toml @@ -20,6 +20,7 @@ bitflags = "1.3" cassowary = "0.3" unicode-segmentation = "1.10" crossterm = { version = "0.25", optional = true } +cxterminfo = "0.2" serde = { version = "1", "optional" = true, features = ["derive"]} helix-view = { version = "0.6", path = "../helix-view", features = ["term"] } helix-core = { version = "0.6", path = "../helix-core" } diff --git a/helix-tui/src/backend/crossterm.rs b/helix-tui/src/backend/crossterm.rs index fe9da919..3a50074e 100644 --- a/helix-tui/src/backend/crossterm.rs +++ b/helix-tui/src/backend/crossterm.rs @@ -11,8 +11,38 @@ use crossterm::{ use helix_view::graphics::{Color, CursorKind, Modifier, Rect}; use std::io::{self, Write}; +fn vte_version() -> Option { + std::env::var("VTE_VERSION").ok()?.parse().ok() +} + +/// Describes terminal capabilities like extended underline, truecolor, etc. +#[derive(Copy, Clone, Debug, Default)] +struct Capabilities { + /// Support for undercurled, underdashed, etc. + has_extended_underlines: bool, +} + +impl Capabilities { + /// Detect capabilities from the terminfo database located based + /// on the $TERM environment variable. If detection fails, returns + /// a default value where no capability is supported. + pub fn from_env_or_default() -> Self { + match cxterminfo::terminfo::TermInfo::from_env() { + Err(_) => Capabilities::default(), + Ok(t) => Capabilities { + // Smulx, VTE: https://unix.stackexchange.com/a/696253/246284 + // Su (used by kitty): https://sw.kovidgoyal.net/kitty/underlines + has_extended_underlines: t.get_ext_string("Smulx").is_some() + || *t.get_ext_bool("Su").unwrap_or(&false) + || vte_version() >= Some(5102), + }, + } + } +} + pub struct CrosstermBackend { buffer: W, + capabilities: Capabilities, } impl CrosstermBackend @@ -20,7 +50,10 @@ where W: Write, { pub fn new(buffer: W) -> CrosstermBackend { - CrosstermBackend { buffer } + CrosstermBackend { + buffer, + capabilities: Capabilities::from_env_or_default(), + } } } @@ -61,7 +94,7 @@ where from: modifier, to: cell.modifier, }; - diff.queue(&mut self.buffer)?; + diff.queue(&mut self.buffer, self.capabilities)?; modifier = cell.modifier; } if cell.fg != fg { @@ -141,7 +174,7 @@ struct ModifierDiff { } impl ModifierDiff { - fn queue(&self, mut w: W) -> io::Result<()> + fn queue(&self, mut w: W, caps: Capabilities) -> io::Result<()> where W: io::Write, { @@ -172,6 +205,14 @@ impl ModifierDiff { map_error(queue!(w, SetAttribute(CAttribute::NoBlink)))?; } + let queue_styled_underline = |styled_underline, w: &mut W| -> io::Result<()> { + let underline = match caps.has_extended_underlines { + true => styled_underline, + false => CAttribute::Underlined, + }; + map_error(queue!(w, SetAttribute(underline))) + }; + let added = self.to - self.from; if added.contains(Modifier::REVERSED) { map_error(queue!(w, SetAttribute(CAttribute::Reverse)))?; @@ -186,16 +227,16 @@ impl ModifierDiff { map_error(queue!(w, SetAttribute(CAttribute::Underlined)))?; } if added.contains(Modifier::UNDERCURLED) { - map_error(queue!(w, SetAttribute(CAttribute::Undercurled)))?; + queue_styled_underline(CAttribute::Undercurled, &mut w)?; } if added.contains(Modifier::UNDERDOTTED) { - map_error(queue!(w, SetAttribute(CAttribute::Underdotted)))?; + queue_styled_underline(CAttribute::Underdotted, &mut w)?; } if added.contains(Modifier::UNDERDASHED) { - map_error(queue!(w, SetAttribute(CAttribute::Underdashed)))?; + queue_styled_underline(CAttribute::Underdashed, &mut w)?; } if added.contains(Modifier::DOUBLE_UNDERLINED) { - map_error(queue!(w, SetAttribute(CAttribute::DoubleUnderlined)))?; + queue_styled_underline(CAttribute::DoubleUnderlined, &mut w)?; } if added.contains(Modifier::DIM) { map_error(queue!(w, SetAttribute(CAttribute::Dim)))?; diff --git a/runtime/themes/onedark.toml b/runtime/themes/onedark.toml index a4cc12eb..e2bc2c47 100644 --- a/runtime/themes/onedark.toml +++ b/runtime/themes/onedark.toml @@ -39,7 +39,10 @@ "diff.delta" = "gold" "diff.minus" = "red" -diagnostic = { modifiers = ["undercurled"] } +"diagnostic.info" = { underline = "blue", modifiers = ["undercurled"] } +"diagnostic.hint" = { underline = "green", modifiers = ["undercurled"] } +"diagnostic.warning" = { underline = "yellow", modifiers = ["undercurled"] } +"diagnostic.error" = { underline = "red", modifiers = ["undercurled"] } "info" = { fg = "blue", modifiers = ["bold"] } "hint" = { fg = "green", modifiers = ["bold"] } "warning" = { fg = "yellow", modifiers = ["bold"] } -- 2.38.5 From 5b5f1bd39ae46fdf68ba758b29bdb29200394c86 Mon Sep 17 00:00:00 2001 From: nuid32 <91177333+nuid32@users.noreply.github.com> Date: Sat, 1 Oct 2022 20:37:18 +0500 Subject: [PATCH 048/556] Adjust light-gray in onedarker theme (#4060) --- runtime/themes/onedarker.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/themes/onedarker.toml b/runtime/themes/onedarker.toml index 1ad6f7c3..1eb1a90c 100644 --- a/runtime/themes/onedarker.toml +++ b/runtime/themes/onedarker.toml @@ -93,5 +93,5 @@ black = "#16181A" light-black = "#2C323C" gray = "#454D50" faint-gray = "#ABB2BF" -light-gray = "#C8CCD4" +light-gray = "#636C6E" linenr = "#282C34" -- 2.38.5 From 71ee589bbc723e7a55585ddc2ca43c29ee93fabe Mon Sep 17 00:00:00 2001 From: Pascal Kuthe Date: Sat, 1 Oct 2022 02:15:25 +0200 Subject: [PATCH 049/556] make underline_style a seperate option Underline styles are mutally exclusive and overwrite each other. Therefore implementing as an modifier lead to incorrect behaviour when the underline style is overwritten. For backwards compatability the "underline" modified is retained (but deprecated). Instead the "underline_style" and "underline_color" optios should be used to style underlines. --- book/src/themes.md | 23 +++++-- helix-tui/src/backend/crossterm.rs | 56 +++++++--------- helix-tui/src/buffer.rs | 27 +++++--- helix-tui/src/text.rs | 12 ++-- helix-view/src/graphics.rs | 101 ++++++++++++++++++++--------- helix-view/src/gutter.rs | 4 +- helix-view/src/theme.rs | 23 ++++++- runtime/themes/dark_plus.toml | 4 +- runtime/themes/onedark.toml | 8 +-- 9 files changed, 167 insertions(+), 91 deletions(-) diff --git a/book/src/themes.md b/book/src/themes.md index 32ff2498..450b3364 100644 --- a/book/src/themes.md +++ b/book/src/themes.md @@ -13,10 +13,10 @@ The default theme.toml can be found [here](https://github.com/helix-editor/helix Each line in the theme file is specified as below: ```toml -key = { fg = "#ffffff", bg = "#000000", underline = "#ff0000", modifiers = ["bold", "italic", "undercurled"] } +key = { fg = "#ffffff", bg = "#000000", underline_color = "#ff0000", underline_style = "curl", modifiers = ["bold", "italic"] } ``` -where `key` represents what you want to style, `fg` specifies the foreground color, `bg` the background color, `underline` the underline color (only meaningful if an underline modifier is enabled), and `modifiers` is a list of style modifiers. `bg`, `underline` and `modifiers` can be omitted to defer to the defaults. +where `key` represents what you want to style, `fg` specifies the foreground color, `bg` the background color, `underline_style` the underline style, `underline_color` the underline color (only meaningful if an underline style is enabled), and `modifiers` is a list of style modifiers. `bg`, `underline` and `modifiers` can be omitted to defer to the defaults. To specify only the foreground color: @@ -83,16 +83,27 @@ Less common modifiers might not be supported by your terminal emulator. | `dim` | | `italic` | | `underlined` | -| `undercurled` | -| `underdashed` | -| `underdotted` | -| `double-underlined` | | `slow_blink` | | `rapid_blink` | | `reversed` | | `hidden` | | `crossed_out` | +### Underline Style + +One of the following values may be used as an `underline_styles`. + +Some styles might not be supported by your terminal emulator. + +| Modifier | +| --- | +| `line` | +| `curl` | +| `dashed` | +| `dot` | +| `double-line` | + + ### Scopes The following is a list of scopes available to use for styling. diff --git a/helix-tui/src/backend/crossterm.rs b/helix-tui/src/backend/crossterm.rs index 3a50074e..3e6dc5f5 100644 --- a/helix-tui/src/backend/crossterm.rs +++ b/helix-tui/src/backend/crossterm.rs @@ -8,7 +8,7 @@ use crossterm::{ }, terminal::{self, Clear, ClearType}, }; -use helix_view::graphics::{Color, CursorKind, Modifier, Rect}; +use helix_view::graphics::{Color, CursorKind, Modifier, Rect, UnderlineStyle}; use std::io::{self, Write}; fn vte_version() -> Option { @@ -80,7 +80,8 @@ where { let mut fg = Color::Reset; let mut bg = Color::Reset; - let mut underline = Color::Reset; + let mut underline_color = Color::Reset; + let mut underline_style = UnderlineStyle::Reset; let mut modifier = Modifier::empty(); let mut last_pos: Option<(u16, u16)> = None; for (x, y, cell) in content { @@ -94,7 +95,7 @@ where from: modifier, to: cell.modifier, }; - diff.queue(&mut self.buffer, self.capabilities)?; + diff.queue(&mut self.buffer)?; modifier = cell.modifier; } if cell.fg != fg { @@ -107,10 +108,24 @@ where map_error(queue!(self.buffer, SetBackgroundColor(color)))?; bg = cell.bg; } - if cell.underline != underline { - let color = CColor::from(cell.underline); + if cell.underline_color != underline_color { + let color = CColor::from(cell.underline_color); map_error(queue!(self.buffer, SetUnderlineColor(color)))?; - underline = cell.underline; + underline_color = cell.underline_color; + } + + let mut new_underline_style = cell.underline_style; + if !self.capabilities.has_extended_underlines { + match new_underline_style { + UnderlineStyle::Reset => (), + _ => new_underline_style = UnderlineStyle::Line, + } + } + + if new_underline_style != underline_style { + let attr = CAttribute::from(cell.underline_style); + map_error(queue!(self.buffer, SetAttribute(attr)))?; + underline_style = new_underline_style; } map_error(queue!(self.buffer, Print(&cell.symbol)))?; @@ -118,6 +133,7 @@ where map_error(queue!( self.buffer, + SetUnderlineColor(CColor::Reset), SetForegroundColor(CColor::Reset), SetBackgroundColor(CColor::Reset), SetAttribute(CAttribute::Reset) @@ -174,7 +190,7 @@ struct ModifierDiff { } impl ModifierDiff { - fn queue(&self, mut w: W, caps: Capabilities) -> io::Result<()> + fn queue(&self, mut w: W) -> io::Result<()> where W: io::Write, { @@ -192,9 +208,6 @@ impl ModifierDiff { if removed.contains(Modifier::ITALIC) { map_error(queue!(w, SetAttribute(CAttribute::NoItalic)))?; } - if removed.intersects(Modifier::ANY_UNDERLINE) { - map_error(queue!(w, SetAttribute(CAttribute::NoUnderline)))?; - } if removed.contains(Modifier::DIM) { map_error(queue!(w, SetAttribute(CAttribute::NormalIntensity)))?; } @@ -205,14 +218,6 @@ impl ModifierDiff { map_error(queue!(w, SetAttribute(CAttribute::NoBlink)))?; } - let queue_styled_underline = |styled_underline, w: &mut W| -> io::Result<()> { - let underline = match caps.has_extended_underlines { - true => styled_underline, - false => CAttribute::Underlined, - }; - map_error(queue!(w, SetAttribute(underline))) - }; - let added = self.to - self.from; if added.contains(Modifier::REVERSED) { map_error(queue!(w, SetAttribute(CAttribute::Reverse)))?; @@ -223,21 +228,6 @@ impl ModifierDiff { if added.contains(Modifier::ITALIC) { map_error(queue!(w, SetAttribute(CAttribute::Italic)))?; } - if added.contains(Modifier::UNDERLINED) { - map_error(queue!(w, SetAttribute(CAttribute::Underlined)))?; - } - if added.contains(Modifier::UNDERCURLED) { - queue_styled_underline(CAttribute::Undercurled, &mut w)?; - } - if added.contains(Modifier::UNDERDOTTED) { - queue_styled_underline(CAttribute::Underdotted, &mut w)?; - } - if added.contains(Modifier::UNDERDASHED) { - queue_styled_underline(CAttribute::Underdashed, &mut w)?; - } - if added.contains(Modifier::DOUBLE_UNDERLINED) { - queue_styled_underline(CAttribute::DoubleUnderlined, &mut w)?; - } if added.contains(Modifier::DIM) { map_error(queue!(w, SetAttribute(CAttribute::Dim)))?; } diff --git a/helix-tui/src/buffer.rs b/helix-tui/src/buffer.rs index 3036608d..424e6d32 100644 --- a/helix-tui/src/buffer.rs +++ b/helix-tui/src/buffer.rs @@ -3,7 +3,7 @@ use helix_core::unicode::width::UnicodeWidthStr; use std::cmp::min; use unicode_segmentation::UnicodeSegmentation; -use helix_view::graphics::{Color, Modifier, Rect, Style}; +use helix_view::graphics::{Color, Modifier, Rect, Style, UnderlineStyle}; /// A buffer cell #[derive(Debug, Clone, PartialEq)] @@ -11,7 +11,8 @@ pub struct Cell { pub symbol: String, pub fg: Color, pub bg: Color, - pub underline: Color, + pub underline_color: Color, + pub underline_style: UnderlineStyle, pub modifier: Modifier, } @@ -45,9 +46,13 @@ impl Cell { if let Some(c) = style.bg { self.bg = c; } - if let Some(c) = style.underline { - self.underline = c; + if let Some(c) = style.underline_color { + self.underline_color = c; } + if let Some(style) = style.underline_style { + self.underline_style = style; + } + self.modifier.insert(style.add_modifier); self.modifier.remove(style.sub_modifier); self @@ -57,7 +62,8 @@ impl Cell { Style::default() .fg(self.fg) .bg(self.bg) - .underline(self.underline) + .underline_color(self.underline_color) + .underline_style(self.underline_style) .add_modifier(self.modifier) } @@ -66,7 +72,8 @@ impl Cell { self.symbol.push(' '); self.fg = Color::Reset; self.bg = Color::Reset; - self.underline = Color::Reset; + self.underline_color = Color::Reset; + self.underline_style = UnderlineStyle::Reset; self.modifier = Modifier::empty(); } } @@ -77,7 +84,8 @@ impl Default for Cell { symbol: " ".into(), fg: Color::Reset, bg: Color::Reset, - underline: Color::Reset, + underline_color: Color::Reset, + underline_style: UnderlineStyle::Reset, modifier: Modifier::empty(), } } @@ -94,7 +102,7 @@ impl Default for Cell { /// /// ``` /// use helix_tui::buffer::{Buffer, Cell}; -/// use helix_view::graphics::{Rect, Color, Style, Modifier}; +/// use helix_view::graphics::{Rect, Color, UnderlineStyle, Style, Modifier}; /// /// let mut buf = Buffer::empty(Rect{x: 0, y: 0, width: 10, height: 5}); /// buf[(0, 2)].set_symbol("x"); @@ -104,7 +112,8 @@ impl Default for Cell { /// symbol: String::from("r"), /// fg: Color::Red, /// bg: Color::White, -/// underline: Color::Reset, +/// underline_color: Color::Reset, +/// underline_style: UnderlineStyle::Reset, /// modifier: Modifier::empty(), /// }); /// buf[(5, 0)].set_char('x'); diff --git a/helix-tui/src/text.rs b/helix-tui/src/text.rs index 73d58803..1bfe5ee1 100644 --- a/helix-tui/src/text.rs +++ b/helix-tui/src/text.rs @@ -134,7 +134,8 @@ impl<'a> Span<'a> { /// style: Style { /// fg: Some(Color::Yellow), /// bg: Some(Color::Black), - /// underline: None, + /// underline_color: None, + /// underline_style: None, /// add_modifier: Modifier::empty(), /// sub_modifier: Modifier::empty(), /// }, @@ -144,7 +145,8 @@ impl<'a> Span<'a> { /// style: Style { /// fg: Some(Color::Yellow), /// bg: Some(Color::Black), - /// underline: None, + /// underline_color: None, + /// underline_style: None, /// add_modifier: Modifier::empty(), /// sub_modifier: Modifier::empty(), /// }, @@ -154,7 +156,8 @@ impl<'a> Span<'a> { /// style: Style { /// fg: Some(Color::Yellow), /// bg: Some(Color::Black), - /// underline: None, + /// underline_color: None, + /// underline_style: None, /// add_modifier: Modifier::empty(), /// sub_modifier: Modifier::empty(), /// }, @@ -164,7 +167,8 @@ impl<'a> Span<'a> { /// style: Style { /// fg: Some(Color::Yellow), /// bg: Some(Color::Black), - /// underline: None, + /// underline_color: None, + /// underline_style: None, /// add_modifier: Modifier::empty(), /// sub_modifier: Modifier::empty(), /// }, diff --git a/helix-view/src/graphics.rs b/helix-view/src/graphics.rs index 6c854fd0..01344748 100644 --- a/helix-view/src/graphics.rs +++ b/helix-view/src/graphics.rs @@ -315,6 +315,44 @@ impl From for crossterm::style::Color { } } +#[derive(Debug, Clone, Copy, PartialEq)] +pub enum UnderlineStyle { + Reset, + Line, + Curl, + Dotted, + Dashed, + DoubleLine, +} + +impl FromStr for UnderlineStyle { + type Err = &'static str; + + fn from_str(modifier: &str) -> Result { + match modifier { + "line" => Ok(Self::Line), + "curl" => Ok(Self::Curl), + "dotted" => Ok(Self::Dotted), + "dashed" => Ok(Self::Dashed), + "double_line" => Ok(Self::DoubleLine), + _ => Err("Invalid underline style"), + } + } +} + +impl From for crossterm::style::Attribute { + fn from(style: UnderlineStyle) -> Self { + match style { + UnderlineStyle::Line => crossterm::style::Attribute::Underlined, + UnderlineStyle::Curl => crossterm::style::Attribute::Undercurled, + UnderlineStyle::Dotted => crossterm::style::Attribute::Underdotted, + UnderlineStyle::Dashed => crossterm::style::Attribute::Underdashed, + UnderlineStyle::DoubleLine => crossterm::style::Attribute::DoubleUnderlined, + UnderlineStyle::Reset => crossterm::style::Attribute::NoUnderline, + } + } +} + bitflags! { /// Modifier changes the way a piece of text is displayed. /// @@ -332,22 +370,11 @@ bitflags! { const BOLD = 0b0000_0000_0000_0001; const DIM = 0b0000_0000_0000_0010; const ITALIC = 0b0000_0000_0000_0100; - const UNDERLINED = 0b0000_0000_0000_1000; const SLOW_BLINK = 0b0000_0000_0001_0000; const RAPID_BLINK = 0b0000_0000_0010_0000; const REVERSED = 0b0000_0000_0100_0000; const HIDDEN = 0b0000_0000_1000_0000; const CROSSED_OUT = 0b0000_0001_0000_0000; - const UNDERCURLED = 0b0000_0010_0000_0000; - const UNDERDOTTED = 0b0000_0100_0000_0000; - const UNDERDASHED = 0b0000_1000_0000_0000; - const DOUBLE_UNDERLINED = 0b0001_0000_0000_0000; - - const ANY_UNDERLINE = Self::UNDERLINED.bits - | Self::UNDERCURLED.bits - | Self::UNDERDOTTED.bits - | Self::UNDERDASHED.bits - | Self::DOUBLE_UNDERLINED.bits; } } @@ -359,16 +386,11 @@ impl FromStr for Modifier { "bold" => Ok(Self::BOLD), "dim" => Ok(Self::DIM), "italic" => Ok(Self::ITALIC), - "underlined" => Ok(Self::UNDERLINED), "slow_blink" => Ok(Self::SLOW_BLINK), "rapid_blink" => Ok(Self::RAPID_BLINK), "reversed" => Ok(Self::REVERSED), "hidden" => Ok(Self::HIDDEN), "crossed_out" => Ok(Self::CROSSED_OUT), - "undercurled" => Ok(Self::UNDERCURLED), - "underdotted" => Ok(Self::UNDERDOTTED), - "underdashed" => Ok(Self::UNDERDASHED), - "double_underlined" => Ok(Self::DOUBLE_UNDERLINED), _ => Err("Invalid modifier"), } } @@ -389,7 +411,7 @@ impl FromStr for Modifier { /// just S3. /// /// ```rust -/// # use helix_view::graphics::{Rect, Color, Modifier, Style}; +/// # use helix_view::graphics::{Rect, Color, UnderlineStyle, Modifier, Style}; /// # use helix_tui::buffer::Buffer; /// let styles = [ /// Style::default().fg(Color::Blue).add_modifier(Modifier::BOLD | Modifier::ITALIC), @@ -405,7 +427,8 @@ impl FromStr for Modifier { /// fg: Some(Color::Yellow), /// bg: Some(Color::Red), /// add_modifier: Modifier::BOLD, -/// underline: Some(Color::Reset), +/// underline_color: Some(Color::Reset), +/// underline_style: Some(UnderlineStyle::Reset), /// sub_modifier: Modifier::empty(), /// }, /// buffer[(0, 0)].style(), @@ -416,7 +439,7 @@ impl FromStr for Modifier { /// reset all properties until that point use [`Style::reset`]. /// /// ``` -/// # use helix_view::graphics::{Rect, Color, Modifier, Style}; +/// # use helix_view::graphics::{Rect, Color, UnderlineStyle, Modifier, Style}; /// # use helix_tui::buffer::Buffer; /// let styles = [ /// Style::default().fg(Color::Blue).add_modifier(Modifier::BOLD | Modifier::ITALIC), @@ -430,7 +453,8 @@ impl FromStr for Modifier { /// Style { /// fg: Some(Color::Yellow), /// bg: Some(Color::Reset), -/// underline: Some(Color::Reset), +/// underline_color: Some(Color::Reset), +/// underline_style: Some(UnderlineStyle::Reset), /// add_modifier: Modifier::empty(), /// sub_modifier: Modifier::empty(), /// }, @@ -442,7 +466,8 @@ impl FromStr for Modifier { pub struct Style { pub fg: Option, pub bg: Option, - pub underline: Option, + pub underline_color: Option, + pub underline_style: Option, pub add_modifier: Modifier, pub sub_modifier: Modifier, } @@ -452,7 +477,8 @@ impl Default for Style { Style { fg: None, bg: None, - underline: None, + underline_color: None, + underline_style: None, add_modifier: Modifier::empty(), sub_modifier: Modifier::empty(), } @@ -465,7 +491,8 @@ impl Style { Style { fg: Some(Color::Reset), bg: Some(Color::Reset), - underline: Some(Color::Reset), + underline_color: None, + underline_style: None, add_modifier: Modifier::empty(), sub_modifier: Modifier::all(), } @@ -507,12 +534,27 @@ impl Style { /// /// ```rust /// # use helix_view::graphics::{Color, Style}; - /// let style = Style::default().underline(Color::Blue); - /// let diff = Style::default().underline(Color::Red); - /// assert_eq!(style.patch(diff), Style::default().underline(Color::Red)); + /// let style = Style::default().underline_color(Color::Blue); + /// let diff = Style::default().underline_color(Color::Red); + /// assert_eq!(style.patch(diff), Style::default().underline_color(Color::Red)); + /// ``` + pub fn underline_color(mut self, color: Color) -> Style { + self.underline_color = Some(color); + self + } + + /// Changes the underline style. + /// + /// ## Examples + /// + /// ```rust + /// # use helix_view::graphics::{UnderlineStyle, Style}; + /// let style = Style::default().underline_style(UnderlineStyle::Line); + /// let diff = Style::default().underline_style(UnderlineStyle::Curl); + /// assert_eq!(style.patch(diff), Style::default().underline_style(UnderlineStyle::Curl)); /// ``` - pub fn underline(mut self, color: Color) -> Style { - self.underline = Some(color); + pub fn underline_style(mut self, style: UnderlineStyle) -> Style { + self.underline_style = Some(style); self } @@ -572,7 +614,8 @@ impl Style { pub fn patch(mut self, other: Style) -> Style { self.fg = other.fg.or(self.fg); self.bg = other.bg.or(self.bg); - self.underline = other.underline.or(self.underline); + self.underline_color = other.underline_color.or(self.underline_color); + self.underline_style = other.underline_style.or(self.underline_style); self.add_modifier.remove(other.sub_modifier); self.add_modifier.insert(other.add_modifier); diff --git a/helix-view/src/gutter.rs b/helix-view/src/gutter.rs index ab0e2986..2c207d27 100644 --- a/helix-view/src/gutter.rs +++ b/helix-view/src/gutter.rs @@ -1,7 +1,7 @@ use std::fmt::Write; use crate::{ - graphics::{Color, Modifier, Style}, + graphics::{Color, Style, UnderlineStyle}, Document, Editor, Theme, View, }; @@ -147,7 +147,7 @@ pub fn breakpoints<'doc>( .find(|breakpoint| breakpoint.line == line)?; let mut style = if breakpoint.condition.is_some() && breakpoint.log_message.is_some() { - error.add_modifier(Modifier::UNDERLINED) + error.underline_style(UnderlineStyle::Line) } else if breakpoint.condition.is_some() { error } else if breakpoint.log_message.is_some() { diff --git a/helix-view/src/theme.rs b/helix-view/src/theme.rs index 5ce1b2c5..90185937 100644 --- a/helix-view/src/theme.rs +++ b/helix-view/src/theme.rs @@ -10,6 +10,7 @@ use once_cell::sync::Lazy; use serde::{Deserialize, Deserializer}; use toml::Value; +use crate::graphics::UnderlineStyle; pub use crate::graphics::{Color, Modifier, Style}; pub static DEFAULT_THEME: Lazy = Lazy::new(|| { @@ -263,20 +264,38 @@ impl ThemePalette { .ok_or(format!("Theme: invalid modifier: {}", value)) } + pub fn parse_underline_style(value: &Value) -> Result { + value + .as_str() + .and_then(|s| s.parse().ok()) + .ok_or(format!("Theme: invalid underline_style: {}", value)) + } + pub fn parse_style(&self, style: &mut Style, value: Value) -> Result<(), String> { if let Value::Table(entries) = value { for (name, value) in entries { match name.as_str() { "fg" => *style = style.fg(self.parse_color(value)?), "bg" => *style = style.bg(self.parse_color(value)?), - "underline" => *style = style.underline(self.parse_color(value)?), + "underline_color" => *style = style.underline_color(self.parse_color(value)?), + "underline_style" => { + warn!("found style"); + *style = style.underline_style(Self::parse_underline_style(&value)?) + } "modifiers" => { let modifiers = value .as_array() .ok_or("Theme: modifiers should be an array")?; for modifier in modifiers { - *style = style.add_modifier(Self::parse_modifier(modifier)?); + if modifier + .as_str() + .map_or(false, |modifier| modifier == "underlined") + { + *style = style.underline_style(UnderlineStyle::Line); + } else { + *style = style.add_modifier(Self::parse_modifier(modifier)?); + } } } _ => return Err(format!("Theme: invalid style attribute: {}", name)), diff --git a/runtime/themes/dark_plus.toml b/runtime/themes/dark_plus.toml index d1a5756e..fa6b34ab 100644 --- a/runtime/themes/dark_plus.toml +++ b/runtime/themes/dark_plus.toml @@ -92,8 +92,8 @@ "info" = { fg = "light_blue" } "hint" = { fg = "light_gray3" } -"diagnostic.error" = {underline = "red", modifiers = ["undercurled"] } -"diagnostic" = {underline = "gold", modifiers = ["undercurled"] } +"diagnostic.error" = {underline_color = "red", underline_style = "curl"} +"diagnostic" = {underline_color = "gold", underline_style = "curl" } [palette] white = "#ffffff" diff --git a/runtime/themes/onedark.toml b/runtime/themes/onedark.toml index e2bc2c47..5f337a8d 100644 --- a/runtime/themes/onedark.toml +++ b/runtime/themes/onedark.toml @@ -39,10 +39,10 @@ "diff.delta" = "gold" "diff.minus" = "red" -"diagnostic.info" = { underline = "blue", modifiers = ["undercurled"] } -"diagnostic.hint" = { underline = "green", modifiers = ["undercurled"] } -"diagnostic.warning" = { underline = "yellow", modifiers = ["undercurled"] } -"diagnostic.error" = { underline = "red", modifiers = ["undercurled"] } +"diagnostic.info" = { underline_color = "blue", underline_style = "curl" } +"diagnostic.hint" = { underline_color = "green", underline_style = "curl" } +"diagnostic.warning" = { underline_color = "yellow", underline_style = "curl" } +"diagnostic.error" = { underline_color = "red", underline_style = "curl" } "info" = { fg = "blue", modifiers = ["bold"] } "hint" = { fg = "green", modifiers = ["bold"] } "warning" = { fg = "yellow", modifiers = ["bold"] } -- 2.38.5 From 6caa7a7f566e67c50537014b3e97fa8e65a8b7b3 Mon Sep 17 00:00:00 2001 From: nuid32 <91177333+nuid32@users.noreply.github.com> Date: Sun, 2 Oct 2022 21:19:55 +0500 Subject: [PATCH 050/556] Onedarker theme: some improvements (#4069) --- runtime/themes/onedarker.toml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/runtime/themes/onedarker.toml b/runtime/themes/onedarker.toml index 1eb1a90c..665f10ed 100644 --- a/runtime/themes/onedarker.toml +++ b/runtime/themes/onedarker.toml @@ -2,7 +2,7 @@ "attribute" = { fg = "yellow" } "comment" = { fg = "light-gray", modifiers = ["italic"] } -"constant" = { fg = "green" } +"constant" = { fg = "gold" } "constant.numeric" = { fg = "gold" } "constant.builtin" = { fg = "gold" } "constant.character.escape" = { fg = "gold" } @@ -69,7 +69,7 @@ diagnostic = { modifiers = ["underlined"] } "ui.statusline.normal" = { fg = "light-black", bg = "purple" } "ui.statusline.insert" = { fg = "light-black", bg = "green" } "ui.statusline.select" = { fg = "light-black", bg = "cyan" } -"ui.text" = { fg = "purple" } +"ui.text" = { fg = "white" } "ui.text.focus" = { fg = "white", bg = "light-black", modifiers = ["bold"] } "ui.help" = { fg = "white", bg = "gray" } @@ -91,7 +91,7 @@ cyan = "#46A6B2" white = "#ABB2BF" black = "#16181A" light-black = "#2C323C" -gray = "#454D50" +gray = "#252D30" faint-gray = "#ABB2BF" light-gray = "#636C6E" linenr = "#282C34" -- 2.38.5 From 8c2cc4301742d9d759a8c2964ade0719d4b15645 Mon Sep 17 00:00:00 2001 From: Kirawi <67773714+kirawi@users.noreply.github.com> Date: Sun, 2 Oct 2022 15:23:23 -0400 Subject: [PATCH 051/556] diff full-doc LSP edits (#4041) Co-authored-by: Michael Davis --- helix-lsp/src/lib.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/helix-lsp/src/lib.rs b/helix-lsp/src/lib.rs index cb234357..0717fc04 100644 --- a/helix-lsp/src/lib.rs +++ b/helix-lsp/src/lib.rs @@ -204,6 +204,20 @@ pub mod util { // in reverse order. edits.sort_unstable_by_key(|edit| edit.range.start); + // Generate a diff if the edit is a full document replacement. + #[allow(clippy::collapsible_if)] + if edits.len() == 1 { + let is_document_replacement = edits.first().and_then(|edit| { + let start = lsp_pos_to_pos(doc, edit.range.start, offset_encoding)?; + let end = lsp_pos_to_pos(doc, edit.range.end, offset_encoding)?; + Some(start..end) + }) == Some(0..doc.len_chars()); + if is_document_replacement { + let new_text = Rope::from(edits.pop().unwrap().new_text); + return helix_core::diff::compare_ropes(doc, &new_text); + } + } + Transaction::change( doc, edits.into_iter().map(|edit| { -- 2.38.5 From 9d1793c45b22a6dce0a08937717887189b46c492 Mon Sep 17 00:00:00 2001 From: Matt Freitas-Stavola Date: Sun, 2 Oct 2022 12:32:30 -0700 Subject: [PATCH 052/556] Add pseudo_pending for t/T/f/F (#4062) --- helix-term/src/commands.rs | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index fb1a4b38..264ab5bb 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -1086,18 +1086,27 @@ fn extend_next_long_word_end(cx: &mut Context) { extend_word_impl(cx, movement::move_next_long_word_end) } -fn will_find_char(cx: &mut Context, search_fn: F, inclusive: bool, extend: bool) -where +fn will_find_char( + cx: &mut Context, + search_fn: F, + inclusive: bool, + extend: bool, + pseudo_pending: &str, +) where F: Fn(RopeSlice, char, usize, usize, bool) -> Option + 'static, { // TODO: count is reset to 1 before next key so we move it into the closure here. // Would be nice to carry over. let count = cx.count(); + cx.editor.pseudo_pending = Some(pseudo_pending.to_string()); + // need to wait for next key // TODO: should this be done by grapheme rather than char? For example, // we can't properly handle the line-ending CRLF case here in terms of char. cx.on_next_key(move |cx, event| { + cx.editor.pseudo_pending = None; + let ch = match event { KeyEvent { code: KeyCode::Enter, @@ -1200,35 +1209,35 @@ fn find_prev_char_impl( } fn find_till_char(cx: &mut Context) { - will_find_char(cx, find_next_char_impl, false, false) + will_find_char(cx, find_next_char_impl, false, false, "t") } fn find_next_char(cx: &mut Context) { - will_find_char(cx, find_next_char_impl, true, false) + will_find_char(cx, find_next_char_impl, true, false, "f") } fn extend_till_char(cx: &mut Context) { - will_find_char(cx, find_next_char_impl, false, true) + will_find_char(cx, find_next_char_impl, false, true, "t") } fn extend_next_char(cx: &mut Context) { - will_find_char(cx, find_next_char_impl, true, true) + will_find_char(cx, find_next_char_impl, true, true, "f") } fn till_prev_char(cx: &mut Context) { - will_find_char(cx, find_prev_char_impl, false, false) + will_find_char(cx, find_prev_char_impl, false, false, "T") } fn find_prev_char(cx: &mut Context) { - will_find_char(cx, find_prev_char_impl, true, false) + will_find_char(cx, find_prev_char_impl, true, false, "F") } fn extend_till_prev_char(cx: &mut Context) { - will_find_char(cx, find_prev_char_impl, false, true) + will_find_char(cx, find_prev_char_impl, false, true, "T") } fn extend_prev_char(cx: &mut Context) { - will_find_char(cx, find_prev_char_impl, true, true) + will_find_char(cx, find_prev_char_impl, true, true, "F") } fn repeat_last_motion(cx: &mut Context) { -- 2.38.5 From 18f6ec7a8eb9ff7d46d4ec1bba52f48364e9c9d7 Mon Sep 17 00:00:00 2001 From: David <12832280+David-Else@users.noreply.github.com> Date: Mon, 3 Oct 2022 15:14:16 +0100 Subject: [PATCH 053/556] Update treesitter markdown (#4078) * Update treesitter markdown * Update inline and add table injections --- languages.toml | 4 ++-- runtime/queries/markdown/injections.scm | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/languages.toml b/languages.toml index d7909b6d..def55182 100644 --- a/languages.toml +++ b/languages.toml @@ -911,7 +911,7 @@ indent = { tab-width = 2, unit = " " } [[grammar]] name = "markdown" -source = { git = "https://github.com/MDeiml/tree-sitter-markdown", rev = "142a5b4a1b092b64c9f5db8f11558f9dd4009a1b", subpath = "tree-sitter-markdown" } +source = { git = "https://github.com/MDeiml/tree-sitter-markdown", rev = "d5740f0fe4b8e4603f2229df107c5c9ef5eec389", subpath = "tree-sitter-markdown" } [[language]] name = "markdown.inline" @@ -923,7 +923,7 @@ grammar = "markdown_inline" [[grammar]] name = "markdown_inline" -source = { git = "https://github.com/MDeiml/tree-sitter-markdown", rev = "142a5b4a1b092b64c9f5db8f11558f9dd4009a1b", subpath = "tree-sitter-markdown-inline" } +source = { git = "https://github.com/MDeiml/tree-sitter-markdown", rev = "d5740f0fe4b8e4603f2229df107c5c9ef5eec389", subpath = "tree-sitter-markdown-inline" } [[language]] name = "dart" diff --git a/runtime/queries/markdown/injections.scm b/runtime/queries/markdown/injections.scm index f94b9f98..e184db15 100644 --- a/runtime/queries/markdown/injections.scm +++ b/runtime/queries/markdown/injections.scm @@ -7,6 +7,8 @@ ((html_block) @injection.content (#set! injection.language "html") (#set! injection.include-unnamed-children)) +((pipe_table_cell) @injection.content (#set! injection.language "markdown.inline") (#set! injection.include-unnamed-children)) + ((minus_metadata) @injection.content (#set! injection.language "yaml") (#set! injection.include-unnamed-children)) ((plus_metadata) @injection.content (#set! injection.language "toml") (#set! injection.include-unnamed-children)) -- 2.38.5 From bcba5d67f9b8650936c391f6c113945291941f51 Mon Sep 17 00:00:00 2001 From: Joe Date: Mon, 3 Oct 2022 10:33:20 -0400 Subject: [PATCH 054/556] Add goto preview (#2982) --- helix-term/src/commands/typed.rs | 39 +++++++++++++++++++++++++------- helix-view/src/editor.rs | 3 ++- 2 files changed, 33 insertions(+), 9 deletions(-) diff --git a/helix-term/src/commands/typed.rs b/helix-term/src/commands/typed.rs index 6d0ced65..d5a368a2 100644 --- a/helix-term/src/commands/typed.rs +++ b/helix-term/src/commands/typed.rs @@ -1196,18 +1196,41 @@ pub(super) fn goto_line_number( args: &[Cow], event: PromptEvent, ) -> anyhow::Result<()> { - if event != PromptEvent::Validate { - return Ok(()); + match event { + PromptEvent::Abort => { + if let Some(line_number) = cx.editor.last_line_number { + goto_line_impl(cx.editor, NonZeroUsize::new(line_number)); + let (view, doc) = current!(cx.editor); + view.ensure_cursor_in_view(doc, line_number); + cx.editor.last_line_number = None; + } + return Ok(()); + } + PromptEvent::Validate => { + ensure!(!args.is_empty(), "Line number required"); + cx.editor.last_line_number = None; + } + PromptEvent::Update => { + if args.is_empty() { + if let Some(line_number) = cx.editor.last_line_number { + // When a user hits backspace and there are no numbers left, + // we can bring them back to their original line + goto_line_impl(cx.editor, NonZeroUsize::new(line_number)); + let (view, doc) = current!(cx.editor); + view.ensure_cursor_in_view(doc, line_number); + cx.editor.last_line_number = None; + } + return Ok(()); + } + let (view, doc) = current!(cx.editor); + let text = doc.text().slice(..); + let line = doc.selection(view.id).primary().cursor_line(text); + cx.editor.last_line_number.get_or_insert(line + 1); + } } - - ensure!(!args.is_empty(), "Line number required"); - let line = args[0].parse::()?; - goto_line_impl(cx.editor, NonZeroUsize::new(line)); - let (view, doc) = current!(cx.editor); - view.ensure_cursor_in_view(doc, line); Ok(()) } diff --git a/helix-view/src/editor.rs b/helix-view/src/editor.rs index 5eff9983..e804a864 100644 --- a/helix-view/src/editor.rs +++ b/helix-view/src/editor.rs @@ -643,7 +643,7 @@ pub struct Editor { /// The currently applied editor theme. While previewing a theme, the previewed theme /// is set here. pub theme: Theme, - + pub last_line_number: Option, pub status_msg: Option<(Cow<'static, str>, Severity)>, pub autoinfo: Option, @@ -717,6 +717,7 @@ impl Editor { syn_loader, theme_loader, last_theme: None, + last_line_number: None, registers: Registers::default(), clipboard_provider: get_clipboard_provider(), status_msg: None, -- 2.38.5 From 57dc5fbe3aab5807e5895e37e609310b684e2c15 Mon Sep 17 00:00:00 2001 From: A-Walrus <58790821+A-Walrus@users.noreply.github.com> Date: Mon, 3 Oct 2022 17:33:48 +0300 Subject: [PATCH 055/556] Show "Invalid regex" message on enter (Validate) (#3049) * Show "Invalid regex" message on enter (Validate) * Reset selection on invalid regex * Add popup for invalid regex * Replace set_position with position * Make popup auto close --- helix-term/src/ui/mod.rs | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/helix-term/src/ui/mod.rs b/helix-term/src/ui/mod.rs index 60ad3b24..ba809d9b 100644 --- a/helix-term/src/ui/mod.rs +++ b/helix-term/src/ui/mod.rs @@ -12,6 +12,8 @@ mod spinner; mod statusline; mod text; +use crate::compositor::{Component, Compositor}; +use crate::job; pub use completion::Completion; pub use editor::EditorView; pub use markdown::Markdown; @@ -110,7 +112,37 @@ pub fn regex_prompt( view.ensure_cursor_in_view(doc, config.scrolloff); } - Err(_err) => (), // TODO: mark command line as error + Err(err) => { + let (view, doc) = current!(cx.editor); + doc.set_selection(view.id, snapshot.clone()); + view.offset = offset_snapshot; + + if event == PromptEvent::Validate { + let callback = async move { + let call: job::Callback = Box::new( + move |_editor: &mut Editor, compositor: &mut Compositor| { + let contents = Text::new(format!("{}", err)); + let size = compositor.size(); + let mut popup = Popup::new("invalid-regex", contents) + .position(Some(helix_core::Position::new( + size.height as usize - 2, // 2 = statusline + commandline + 0, + ))) + .auto_close(true); + popup.required_size((size.width, size.height)); + + compositor.replace_or_push("invalid-regex", popup); + }, + ); + Ok(call) + }; + + cx.jobs.callback(callback); + } else { + // Update + // TODO: mark command line as error + } + } } } } -- 2.38.5 From 2fac9e24e565e976a8af8d82a4b6f2755a82a074 Mon Sep 17 00:00:00 2001 From: Christoph Schmidler Date: Mon, 3 Oct 2022 16:34:29 +0200 Subject: [PATCH 056/556] Inherit theme (#3067) * Add RawTheme to handle inheritance with theme palette * Add a intermediate step in theme loading it uses RawTheme struct to load the original ThemePalette, so we can merge it with the inherited one. * Load default themes via RawThemes, remove Theme deserialization * Allow naming custom theme same as inherited one * Remove RawTheme and use toml::Value directly * Resolve all review changes resulting in a cleaner code * Simplify return for Loader::load * Add implementation to avoid extra step for loading of base themes --- Cargo.lock | 1 + helix-view/Cargo.toml | 1 + helix-view/src/theme.rs | 192 +++++++++++++++++++++++++++++++--------- 3 files changed, 152 insertions(+), 42 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e5edcaac..6537543a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -523,6 +523,7 @@ dependencies = [ "futures-util", "helix-core", "helix-dap", + "helix-loader", "helix-lsp", "helix-tui", "log", diff --git a/helix-view/Cargo.toml b/helix-view/Cargo.toml index 266a5732..b96a537d 100644 --- a/helix-view/Cargo.toml +++ b/helix-view/Cargo.toml @@ -17,6 +17,7 @@ term = ["crossterm"] bitflags = "1.3" anyhow = "1" helix-core = { version = "0.6", path = "../helix-core" } +helix-loader = { version = "0.6", path = "../helix-loader" } helix-lsp = { version = "0.6", path = "../helix-lsp" } helix-dap = { version = "0.6", path = "../helix-dap" } crossterm = { version = "0.25", optional = true } diff --git a/helix-view/src/theme.rs b/helix-view/src/theme.rs index fa5fa702..85f5cc13 100644 --- a/helix-view/src/theme.rs +++ b/helix-view/src/theme.rs @@ -3,19 +3,28 @@ use std::{ path::{Path, PathBuf}, }; -use anyhow::Context; +use anyhow::{anyhow, Context, Result}; use helix_core::hashmap; +use helix_loader::merge_toml_values; use log::warn; use once_cell::sync::Lazy; use serde::{Deserialize, Deserializer}; -use toml::Value; +use toml::{map::Map, Value}; pub use crate::graphics::{Color, Modifier, Style}; pub static DEFAULT_THEME: Lazy = Lazy::new(|| { + // let raw_theme: Value = toml::from_slice(include_bytes!("../../theme.toml")) + // .expect("Failed to parse default theme"); + // Theme::from(raw_theme) + toml::from_slice(include_bytes!("../../theme.toml")).expect("Failed to parse default theme") }); pub static BASE16_DEFAULT_THEME: Lazy = Lazy::new(|| { + // let raw_theme: Value = toml::from_slice(include_bytes!("../../base16_theme.toml")) + // .expect("Failed to parse base 16 default theme"); + // Theme::from(raw_theme) + toml::from_slice(include_bytes!("../../base16_theme.toml")) .expect("Failed to parse base 16 default theme") }); @@ -35,24 +44,51 @@ impl Loader { } /// Loads a theme first looking in the `user_dir` then in `default_dir` - pub fn load(&self, name: &str) -> Result { + pub fn load(&self, name: &str) -> Result { if name == "default" { return Ok(self.default()); } if name == "base16_default" { return Ok(self.base16_default()); } - let filename = format!("{}.toml", name); - let user_path = self.user_dir.join(&filename); - let path = if user_path.exists() { - user_path + self.load_theme(name, name, false).map(Theme::from) + } + + // load the theme and its parent recursively and merge them + // `base_theme_name` is the theme from the config.toml, + // used to prevent some circular loading scenarios + fn load_theme( + &self, + name: &str, + base_them_name: &str, + only_default_dir: bool, + ) -> Result { + let path = self.path(name, only_default_dir); + let theme_toml = self.load_toml(path)?; + + let inherits = theme_toml.get("inherits"); + + let theme_toml = if let Some(parent_theme_name) = inherits { + let parent_theme_name = parent_theme_name.as_str().ok_or_else(|| { + anyhow!( + "Theme: expected 'inherits' to be a string: {}", + parent_theme_name + ) + })?; + + let parent_theme_toml = self.load_theme( + parent_theme_name, + base_them_name, + base_them_name == parent_theme_name, + )?; + + self.merge_themes(parent_theme_toml, theme_toml) } else { - self.default_dir.join(filename) + theme_toml }; - let data = std::fs::read(&path)?; - toml::from_slice(data.as_slice()).context("Failed to deserialize theme") + Ok(theme_toml) } pub fn read_names(path: &Path) -> Vec { @@ -70,6 +106,53 @@ impl Loader { .unwrap_or_default() } + // merge one theme into the parent theme + fn merge_themes(&self, parent_theme_toml: Value, theme_toml: Value) -> Value { + let parent_palette = parent_theme_toml.get("palette"); + let palette = theme_toml.get("palette"); + + // handle the table seperately since it needs a `merge_depth` of 2 + // this would conflict with the rest of the theme merge strategy + let palette_values = match (parent_palette, palette) { + (Some(parent_palette), Some(palette)) => { + merge_toml_values(parent_palette.clone(), palette.clone(), 2) + } + (Some(parent_palette), None) => parent_palette.clone(), + (None, Some(palette)) => palette.clone(), + (None, None) => Map::new().into(), + }; + + // add the palette correctly as nested table + let mut palette = Map::new(); + palette.insert(String::from("palette"), palette_values); + + // merge the theme into the parent theme + let theme = merge_toml_values(parent_theme_toml, theme_toml, 1); + // merge the before specially handled palette into the theme + merge_toml_values(theme, palette.into(), 1) + } + + // 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)?; + + toml::from_slice(data.as_slice()).context("Failed to deserialize theme") + } + + // Returns the path to the theme with the name + // With `only_default_dir` as false the path will first search for the user path + // disabled it ignores the user path and returns only the default path + fn path(&self, name: &str, only_default_dir: bool) -> PathBuf { + let filename = format!("{}.toml", name); + + let user_path = self.user_dir.join(&filename); + if !only_default_dir && user_path.exists() { + user_path + } else { + self.default_dir.join(filename) + } + } + /// Lists all theme names available in default and user directory pub fn names(&self) -> Vec { let mut names = Self::read_names(&self.user_dir); @@ -105,52 +188,77 @@ pub struct Theme { highlights: Vec - - - + \ No newline at end of file -- 2.38.5 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 455/556] 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 118764d9..c0d17a87 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, -- 2.38.5 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 456/556] 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 4eb8a4da..9664d93a 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 8bfc7c3f..f72ec9e8 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) -- 2.38.5 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 457/556] 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 131cab19..c4cbbce0 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] -- 2.38.5 From b677c6a019f893c7ed8b9b84d136c50e5445315a Mon Sep 17 00:00:00 2001 From: Pascal Kuthe Date: Sat, 3 Dec 2022 03:05:15 +0100 Subject: [PATCH 458/556] 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 3555b539..b06e8222 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 00000000..f6e94f1b --- /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 00000000..cdd5ddb8 --- /dev/null +++ b/logo_light.svg @@ -0,0 +1,115 @@ + + -- 2.38.5 From 224a024d3997035d04bf7b2f7424a472ff9936b8 Mon Sep 17 00:00:00 2001 From: Anton Romanov Date: Fri, 2 Dec 2022 18:26:01 -0800 Subject: [PATCH 459/556] 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 affb9f56..63f4ac72 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"} -- 2.38.5 From dc00291b4888f7ffad43fd544259227d0dbbf6fb Mon Sep 17 00:00:00 2001 From: Luna Date: Sat, 3 Dec 2022 03:26:10 +0100 Subject: [PATCH 460/556] 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 c38c93ee..95dc78e0 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' } -- 2.38.5 From bcdb475b71b0fbabce57344ac8d2575c23b1bbe0 Mon Sep 17 00:00:00 2001 From: Michael Davis Date: Fri, 2 Dec 2022 21:09:08 -0600 Subject: [PATCH 461/556] 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 b99e969f..1aac38d9 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 a34a24b7..96ced21a 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(()) } -- 2.38.5 From 2123e91e56caccf60b9285f30bc2f2f12952520a Mon Sep 17 00:00:00 2001 From: Aleksey Kuznetsov Date: Sat, 3 Dec 2022 19:24:43 +0500 Subject: [PATCH 462/556] 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 9664d93a..d214a082 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]] -- 2.38.5 From 326a0dab069b65463db90e2647287c1e5b6b66aa Mon Sep 17 00:00:00 2001 From: Jens Getreu Date: Sun, 4 Dec 2022 03:03:42 +0100 Subject: [PATCH 463/556] 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 b13aeef2..fe80261a 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 2f398dc9..d01f5356 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 -- 2.38.5 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 464/556] 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 00000000..974c486c --- /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 06e91d01..7a2183f8 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 3cd878be..33bfa6e5 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" -- 2.38.5 From c13c6d56b6eb0e117cb92ba4011155b519befde6 Mon Sep 17 00:00:00 2001 From: Michael Davis Date: Sat, 3 Dec 2022 20:07:17 -0600 Subject: [PATCH 465/556] 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 466/556] 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 89cce494..8ba00a88 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 321c90ad..350ea9e7 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")) -- 2.38.5 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 467/556] 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 d214a082..325a39df 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 00000000..e11eb788 --- /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 00000000..e11eb788 --- /dev/null +++ b/runtime/queries/common-lisp/injections.scm @@ -0,0 +1 @@ +; inherits: scheme -- 2.38.5 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 468/556] 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 b1fde001..ccfd18c0 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` | -- 2.38.5 From 1e31bc3f77040d4a3663b8b6bf72d8d3a632b88a Mon Sep 17 00:00:00 2001 From: Pascal Kuthe Date: Mon, 5 Dec 2022 14:18:42 +0100 Subject: [PATCH 469/556] 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 b8659c9b..f4bb4dbf 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(); }); -- 2.38.5 From b0f20f13e3a606cba35cc70144f045a22b5b38bc Mon Sep 17 00:00:00 2001 From: Pascal Kuthe Date: Mon, 5 Dec 2022 14:46:59 +0100 Subject: [PATCH 470/556] 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 82b2b558..432159b6 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) } } -- 2.38.5 From f712d316e5d210e95f9d297651f1d753646c26d2 Mon Sep 17 00:00:00 2001 From: two-six Date: Mon, 5 Dec 2022 14:48:20 +0100 Subject: [PATCH 471/556] 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 d3be695c..696a4a9b 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 5270fe34..eb947d03 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" -- 2.38.5 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 472/556] 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 4ff8675b..927bd95b 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 -- 2.38.5 From 5691ada822a7c6e27f8890ee25f52a9262caddd2 Mon Sep 17 00:00:00 2001 From: VuiMuich Date: Mon, 5 Dec 2022 23:28:20 +0100 Subject: [PATCH 473/556] 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 88e4cf6d..2b4000ac 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 a00274bb..ad830d92 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" -- 2.38.5 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 474/556] 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 6523b09f..c3c09f4c 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 4cd27119..31a2f582 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 c0d17a87..b6d9ea10 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, }, -- 2.38.5 From 2077f5e26a4cdaadde4b505fc64eadb9e6849c0d Mon Sep 17 00:00:00 2001 From: Michael Davis Date: Mon, 5 Dec 2022 19:29:40 -0600 Subject: [PATCH 475/556] 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 abc930f8..f714395f 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 ebb4fb46..c54990e8 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, -- 2.38.5 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 476/556] 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 2e021197..a3746f56 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 c114666d..e54cf828 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" -- 2.38.5 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 477/556] 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 a3746f56..014834e4 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", -- 2.38.5 From 453a75a3739338348024b6c676231aef9ef6cb7b Mon Sep 17 00:00:00 2001 From: Narazaki Shuji Date: Tue, 6 Dec 2022 11:16:08 +0900 Subject: [PATCH 478/556] 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 31a2f582..26389026 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 ecc8e8be..c09d502d 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() } -- 2.38.5 From af532147c97987d6170dc06a52aa3434ebf1b9d4 Mon Sep 17 00:00:00 2001 From: Pascal Kuthe Date: Tue, 6 Dec 2022 15:18:33 +0100 Subject: [PATCH 479/556] 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 c3c09f4c..139e8fdd 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 646bf926..a6eb9ec1 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 26389026..1843e7a2 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 b6d9ea10..ebcd125a 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 b1acd1f2..9c6a362f 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 + } + } + } + } } -- 2.38.5 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 480/556] 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 159daf87..f885e4eb 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" -- 2.38.5 From d3f670c0e2d8800bfeacb76a5b96753ac6529170 Mon Sep 17 00:00:00 2001 From: Jonathan LEI Date: Wed, 7 Dec 2022 10:11:45 +0800 Subject: [PATCH 481/556] 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 19fade69..4f83fb4d 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()) -- 2.38.5 From 96ff64a84a4948b0aa85a453276cb0091fb9c792 Mon Sep 17 00:00:00 2001 From: Michael Davis Date: Tue, 6 Dec 2022 20:54:50 -0600 Subject: [PATCH 482/556] 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 56d85751..dc91c9ff 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 b9ed4c22..e70b3aeb 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -22.08.1 \ No newline at end of file +22.12 \ No newline at end of file -- 2.38.5 From 9d4236941d581a1a9ed017db294fd3413a670b84 Mon Sep 17 00:00:00 2001 From: Alexander Brevig Date: Wed, 7 Dec 2022 12:29:56 +0100 Subject: [PATCH 483/556] 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 ad830d92..99d4b7f1 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" } -- 2.38.5 From a4de86e7afc0da3d847d467a21ff4fb67a51d620 Mon Sep 17 00:00:00 2001 From: Alexander Brevig Date: Wed, 7 Dec 2022 12:30:46 +0100 Subject: [PATCH 484/556] 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 d4c837b6..2fdc66d0 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" -- 2.38.5 From f8b75a245a390fc3772d59cafe04ccaaa53c9ca9 Mon Sep 17 00:00:00 2001 From: Jens Getreu Date: Thu, 8 Dec 2022 02:48:01 +0100 Subject: [PATCH 485/556] 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 fe80261a..501675da 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 d01f5356..c26cc777 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 -- 2.38.5 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 486/556] 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 d977e078..418c4195 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. -- 2.38.5 From d91464208958b6f44b431d244e0f369d7907ba59 Mon Sep 17 00:00:00 2001 From: cor Date: Fri, 9 Dec 2022 04:48:56 +0100 Subject: [PATCH 487/556] 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 708ca2b2..27d9ab9b 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"] } -- 2.38.5 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 488/556] 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 c54990e8..11d7886a 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 -- 2.38.5 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 489/556] 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 014834e4..b204214f 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 e0ebd1c4..c4b89e6b 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 a02a59af..29a9f2e7 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 41884e73..05c5467e 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 2c2c7c88..90fd2f21 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 719113ff..b47dae8e 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 96b695c6..aac5c537 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); } -- 2.38.5 From 2ea20a23e26a771e095972bdda673d491b4aacc5 Mon Sep 17 00:00:00 2001 From: Jummit Date: Fri, 9 Dec 2022 05:02:34 +0100 Subject: [PATCH 490/556] 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 1843e7a2..2bac5be0 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); -- 2.38.5 From 16e13b9789359282cb6c2681262f46fb1b70134b Mon Sep 17 00:00:00 2001 From: TotalKrill Date: Fri, 9 Dec 2022 05:09:23 +0100 Subject: [PATCH 491/556] 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 133e6447..e45ef910 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 8dc34a3e..41ab23e1 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 90fd2f21..dd2581c6 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 f714395f..8418896c 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, -- 2.38.5 From 37e7dd1df598312727aadb5c74919fd196fecffc Mon Sep 17 00:00:00 2001 From: two-six Date: Fri, 9 Dec 2022 05:11:25 +0100 Subject: [PATCH 492/556] 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 696a4a9b..e1785f4a 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" -- 2.38.5 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 493/556] 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 ccfd18c0..28dafd7a 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 325a39df..96d92ce8 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 00000000..db1ab70c --- /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 00000000..e69de29b diff --git a/runtime/queries/bibtex/tags.scm b/runtime/queries/bibtex/tags.scm new file mode 100644 index 00000000..e69de29b -- 2.38.5 From f323ffabcc5846f647e3ba1d3d2ff5dec95257bd Mon Sep 17 00:00:00 2001 From: Danilo Spinella Date: Sat, 10 Dec 2022 01:40:27 +0100 Subject: [PATCH 494/556] 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 96d92ce8..06af52bd 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 = " " } -- 2.38.5 From 0e8ea13696206aa8ad289d539a5df62f34a73dec Mon Sep 17 00:00:00 2001 From: Ollie Charles Date: Sat, 10 Dec 2022 20:03:18 +0000 Subject: [PATCH 495/556] 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 28dafd7a..4dca8104 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 00000000..9870dc4a --- /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) -- 2.38.5 From 70d78123b94d93c801171ac3dd29e2a493feee20 Mon Sep 17 00:00:00 2001 From: Pascal Kuthe Date: Sun, 11 Dec 2022 11:20:34 +0100 Subject: [PATCH 496/556] 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 0e76ebbb..ee174e69 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 833616e0..2aa92475 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 29a9f2e7..80d44a82 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 f61c4c45..107e48dd 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; -- 2.38.5 From cdc54f50a2ceb62c9f1c38b939ca988ff0e96855 Mon Sep 17 00:00:00 2001 From: Michael Davis Date: Sun, 11 Dec 2022 09:04:08 -0600 Subject: [PATCH 497/556] 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 2bac5be0..1310417e 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 973cf82e..c13a6673 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); + } } -- 2.38.5 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 498/556] 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 392b5f8c..322caea5 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 0c6d924f..f8ee0890 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 c65750f4..1c911eb5 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" -- 2.38.5 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 499/556] 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 06af52bd..dae675df 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" -- 2.38.5 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 500/556] 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 2277a0bd..9835145c 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" -- 2.38.5 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 501/556] 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 6390ef85..66e6ac03 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 03fcaa55..2119a48d 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"], -- 2.38.5 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 502/556] 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 dae675df..e6bc344c 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 5606e93d..d3c29270 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 3b7a4275..46819374 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 -- 2.38.5 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 503/556] 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 b204214f..040a039c 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", -- 2.38.5 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 504/556] 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 040a039c..6ae0a71f 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 05c5467e..d04edcd5 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" -- 2.38.5 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 505/556] 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 deeff80e..3a4896f1 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 c242f089..8c105bfc 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 -- 2.38.5 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 506/556] 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 8c105bfc..9518a537 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 -- 2.38.5 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 507/556] 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 3a4896f1..0d6fcb3e 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 -- 2.38.5 From 436296b76c671446aab8863b467155ff9e94d4fc Mon Sep 17 00:00:00 2001 From: Erasin Date: Wed, 14 Dec 2022 21:51:00 +0800 Subject: [PATCH 508/556] 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 4dca8104..fa7b6edd 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 e6bc344c..e28476d3 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 00000000..b546d39f --- /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 -- 2.38.5 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 509/556] 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 fa7b6edd..1400fa87 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 00000000..f2077037 --- /dev/null +++ b/runtime/queries/bash/indents.scm @@ -0,0 +1,11 @@ +[ + (function_definition) + (if_statement) + (for_statement) + (case_statement) + (pipeline) +] @indent + +[ + "}" +] @outdent -- 2.38.5 From db939801ebf299f11a6a52bdff7a3c9bfb87fc34 Mon Sep 17 00:00:00 2001 From: Michael Davis Date: Thu, 15 Dec 2022 02:49:49 -0600 Subject: [PATCH 510/556] 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 2119a48d..cb387fcb 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 f1219ec5..b2c8a79f 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 -- 2.38.5 From c64debc7412c0769db8186694bd89f85ea057b1b Mon Sep 17 00:00:00 2001 From: Gokul Soumya Date: Tue, 19 Jul 2022 21:28:14 +0530 Subject: [PATCH 511/556] 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 5e9ca3d8..8b5d20ec 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(); -- 2.38.5 From 914d2944997e11cf76eeabfe43f9031aeb2b1721 Mon Sep 17 00:00:00 2001 From: Gokul Soumya Date: Tue, 19 Jul 2022 21:49:02 +0530 Subject: [PATCH 512/556] 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 107e48dd..5b5924bf 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 0b8a93ae..5b2bc806 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 8b5d20ec..821a282c 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) + } +} -- 2.38.5 From d1f717eb8d02205ce224292f157bfe1bddd1f6db Mon Sep 17 00:00:00 2001 From: Gokul Soumya Date: Tue, 19 Jul 2022 22:15:03 +0530 Subject: [PATCH 513/556] 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 810e3adf..8052dcac 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))) }, ) } -- 2.38.5 From a7daa02346789e43af51db2b944b0dc516354a29 Mon Sep 17 00:00:00 2001 From: Michael Davis Date: Wed, 7 Dec 2022 16:27:31 -0600 Subject: [PATCH 514/556] 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 821a282c..35597843 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 { -- 2.38.5 From 35cf972ce459eda6ceffb7a7c256a4bc9f4e6e39 Mon Sep 17 00:00:00 2001 From: Michael Davis Date: Wed, 7 Dec 2022 16:24:32 -0600 Subject: [PATCH 515/556] 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 35597843..2d471aae 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) }); -- 2.38.5 From 2a60de74f9ccc935fa65031cfe30c62cf07bbbaf Mon Sep 17 00:00:00 2001 From: Michael Davis Date: Thu, 8 Dec 2022 19:54:15 -0600 Subject: [PATCH 516/556] 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 8052dcac..86b0c5fa 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() }; -- 2.38.5 From 42ad1a9e043e2e0fb148924ff79b9abbe06907ae Mon Sep 17 00:00:00 2001 From: Michael Davis Date: Thu, 15 Dec 2022 02:57:31 -0600 Subject: [PATCH 517/556] 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 1310417e..0f04ecba 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) { -- 2.38.5 From f916915b53fa6fedd3f9106bcf58163083cc052e Mon Sep 17 00:00:00 2001 From: Roberto Vidal Date: Thu, 15 Dec 2022 09:59:34 +0100 Subject: [PATCH 518/556] 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 66e6ac03..269d63e3 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 cb387fcb..90dde7e1 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 9dad3620..18620b7b 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 -- 2.38.5 From 5c4a9cba9a14ca10437e979c884d2ccba78ef1e7 Mon Sep 17 00:00:00 2001 From: Sebastian Zivota Date: Thu, 15 Dec 2022 14:20:26 +0100 Subject: [PATCH 519/556] 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 0f04ecba..6cf49464 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() { -- 2.38.5 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 520/556] 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 269d63e3..66e6ac03 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 90dde7e1..cb387fcb 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 18620b7b..9dad3620 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 -- 2.38.5 From 3e6887648c386372839e29028a3459d4674ce68b Mon Sep 17 00:00:00 2001 From: alice Date: Fri, 16 Dec 2022 15:43:58 +0100 Subject: [PATCH 521/556] 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 e28476d3..d03726e7 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" } -- 2.38.5 From 9c9c775a27f23b2fa5c8c856af0b15671916efd6 Mon Sep 17 00:00:00 2001 From: Ifiok Jr Date: Sat, 17 Dec 2022 15:09:14 +0000 Subject: [PATCH 522/556] 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 139e8fdd..15329400 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` | -- 2.38.5 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 523/556] 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 e8fbb84d..6558fe19 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)?; } -- 2.38.5 From e6a2df8c798537a7dc5aff264eeccc773525aa6c Mon Sep 17 00:00:00 2001 From: Alex Kladov Date: Sat, 17 Dec 2022 19:30:43 +0000 Subject: [PATCH 524/556] 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 5b5924bf..ade1d8cf 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 2d471aae..aad3f81c 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(); } -- 2.38.5 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 525/556] 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 1400fa87..73e0bfcd 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 d03726e7..42495e5c 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 00000000..33a53e7f --- /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 + -- 2.38.5 From 042d03269ecbe68e0461548bcf6918324c967bbb Mon Sep 17 00:00:00 2001 From: g-s-k Date: Sat, 17 Dec 2022 20:44:08 +0100 Subject: [PATCH 526/556] 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 73e0bfcd..1a3aed79 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 42495e5c..8972a6e9 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 00000000..c0e23e91 --- /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 -- 2.38.5 From 24cd7f6adf7a46b8386583b17f01839eb592a2eb Mon Sep 17 00:00:00 2001 From: Jonathan LEI Date: Sat, 10 Dec 2022 09:56:12 +0000 Subject: [PATCH 527/556] 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 322caea5..0f94828e 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 b19b9a9f..5fb6745a 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 + }, ); } } -- 2.38.5 From ba3c24aa0268735ac57321442d458ab6a1ac662c Mon Sep 17 00:00:00 2001 From: Jonathan LEI Date: Sat, 10 Dec 2022 09:56:37 +0000 Subject: [PATCH 528/556] 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 63fc2f79..268a38df 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 05409319..c7b5dc84 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" } -- 2.38.5 From 99b346a9238b9e7c5b9b93abdf787213c4d67f92 Mon Sep 17 00:00:00 2001 From: Lukas Werling Date: Mon, 19 Dec 2022 18:00:47 +0100 Subject: [PATCH 529/556] 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 418c4195..885ea0bf 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 = -- 2.38.5 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 530/556] 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 6ae0a71f..52ed478f 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" -- 2.38.5 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 531/556] 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 52ed478f..3f4b081c 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", ] -- 2.38.5 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 532/556] 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 3f4b081c..7e98a0f7 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", -- 2.38.5 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 533/556] 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 7e98a0f7..1b4572bb 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 30bfc7ea..9f2e5188 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" -- 2.38.5 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 534/556] 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 1b4572bb..e00e1f63 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", -- 2.38.5 From 03baec8a2d83de59d7e8ada655022e4f81d1fa68 Mon Sep 17 00:00:00 2001 From: Yusuf Bera Ertan Date: Tue, 20 Dec 2022 02:36:56 +0300 Subject: [PATCH 535/556] build(nix): update inputs (#5219) --- flake.lock | 70 ++++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 55 insertions(+), 15 deletions(-) diff --git a/flake.lock b/flake.lock index f097519e..4cf1018c 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": { -- 2.38.5 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 536/556] 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 82d79cc7..a1a0ebb8 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)) -- 2.38.5 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 537/556] 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 e00e1f63..a6ca9495 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", -- 2.38.5 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 538/556] 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 90bdb446..0f459311 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" -- 2.38.5 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 539/556] 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 89575e3a..f5787ca8 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" -- 2.38.5 From c4263d6a56c6490b34a43c7d393fce321514b6ef Mon Sep 17 00:00:00 2001 From: Chickenkeeper Date: Wed, 21 Dec 2022 23:10:45 +0000 Subject: [PATCH 540/556] 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 d3c29270..66058034 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 ; ------- -- 2.38.5 From 7905086b55eac2a817c16fe3a9ab987e718324c8 Mon Sep 17 00:00:00 2001 From: Michael Davis Date: Thu, 22 Dec 2022 19:21:02 -0600 Subject: [PATCH 541/556] 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 e184db15..e8839351 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)) -- 2.38.5 From 7a1fa0c74fb2c3b7b1c9aea9aa77c5c612e0bd12 Mon Sep 17 00:00:00 2001 From: Gioele De Vitti Date: Fri, 23 Dec 2022 02:12:49 +0000 Subject: [PATCH 542/556] 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 885ea0bf..1fc5605e 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. - ================================================================= = = ================================================================= -- 2.38.5 From 1b89d3e5350f83b2ffb86a86326bd2714308ee53 Mon Sep 17 00:00:00 2001 From: Jack Allison Date: Thu, 22 Dec 2022 21:23:34 -0500 Subject: [PATCH 543/556] 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 cb387fcb..c3a7c9fa 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(()) } -- 2.38.5 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 544/556] 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 15329400..272c758b 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 1f28ecef..ffba46ab 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 6cf49464..437e11b5 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 ebcd125a..ef93dee0 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, -- 2.38.5 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 545/556] 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 fc201853..35cf77ab 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) } -- 2.38.5 From b1ca7ddf89c048a8da0d6cfe507ac3344e6f625f Mon Sep 17 00:00:00 2001 From: cor Date: Fri, 23 Dec 2022 15:03:54 +0100 Subject: [PATCH 546/556] 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 14e240dd..8558db3a 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"] } -- 2.38.5 From 24c3b00d10858a02c6c1c351a7509e204c2bc647 Mon Sep 17 00:00:00 2001 From: Nick Date: Fri, 23 Dec 2022 19:43:05 +0530 Subject: [PATCH 547/556] 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 7a50e007..5f013b9a 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); -- 2.38.5 From f0c6e6c9eeb1f2772571bcefe02bd344fa70d62f Mon Sep 17 00:00:00 2001 From: Erasin Date: Sat, 24 Dec 2022 19:30:44 +0800 Subject: [PATCH 548/556] 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 8972a6e9..53f65be7 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]] -- 2.38.5 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 549/556] 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 c3a7c9fa..c2ca1a47 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| { -- 2.38.5 From 1af76b738dd5bdae14b025d07d3001c4ad23e071 Mon Sep 17 00:00:00 2001 From: Alex Kladov Date: Sat, 24 Dec 2022 21:55:16 +0000 Subject: [PATCH 550/556] 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 1fc5605e..baf32c27 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. -- 2.38.5 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 551/556] 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 baf32c27..408f7451 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. -- 2.38.5 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 552/556] 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 a6ca9495..1243bc51 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 e54cf828..8e713638 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" -- 2.38.5 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 553/556] 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 1243bc51..3592e621 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", -- 2.38.5 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 554/556] 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 3592e621..96c39fd5 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" -- 2.38.5 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 555/556] 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 73df868b..1b053e74 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")) +;