From 19c91dfb80218bd8e47ec7fac773e2d3c08abf4d Mon Sep 17 00:00:00 2001 From: RoloEdits Date: Sat, 28 Dec 2024 05:44:16 -0800 Subject: [PATCH 01/17] fix: string literals with format args not in `format!` (#12354) --- helix-term/src/commands/dap.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/helix-term/src/commands/dap.rs b/helix-term/src/commands/dap.rs index 0b754bc2..83dd936c 100644 --- a/helix-term/src/commands/dap.rs +++ b/helix-term/src/commands/dap.rs @@ -518,15 +518,16 @@ pub fn dap_variables(cx: &mut Context) { Some(thread_frame) => thread_frame, None => { cx.editor - .set_error("Failed to get stack frame for thread: {thread_id}"); + .set_error(format!("Failed to get stack frame for thread: {thread_id}")); return; } }; let stack_frame = match thread_frame.get(frame) { Some(stack_frame) => stack_frame, None => { - cx.editor - .set_error("Failed to get stack frame for thread {thread_id} and frame {frame}."); + cx.editor.set_error(format!( + "Failed to get stack frame for thread {thread_id} and frame {frame}." + )); return; } }; From 4b288e4de73a28fca53748b49b2912e97e7a5532 Mon Sep 17 00:00:00 2001 From: {{david|odenwald}} Date: Sat, 28 Dec 2024 14:44:41 +0100 Subject: [PATCH 02/17] languages: add block comment tokens for jinja and nunjucks (#12348) Co-authored-by: David Odenwald --- languages.toml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/languages.toml b/languages.toml index f415fb61..645443d1 100644 --- a/languages.toml +++ b/languages.toml @@ -3303,6 +3303,7 @@ injection-regex = "nunjucks" file-types = ["njk"] indent = { tab-width = 2, unit = " " } grammar = "jinja2" +block-comment-tokens = { start = "{#", end = "#}" } [[language]] name = "jinja" @@ -3311,6 +3312,7 @@ injection-regex = "jinja" file-types = ["jinja", "jinja2", "j2"] indent = { tab-width = 2, unit = " " } grammar = "jinja2" +block-comment-tokens = { start = "{#", end = "#}" } [[grammar]] name = "jinja2" From 127567df8e88cfa71feb66619a6016988d984256 Mon Sep 17 00:00:00 2001 From: Michael Davis Date: Sat, 28 Dec 2024 09:05:46 -0500 Subject: [PATCH 03/17] docs: Fix dead links to tree-sitter docs tree-sitter now uses mdbook for their docs and the switch adds a chapter number to each section, so each link to the website needs an update. --- book/src/guides/adding_languages.md | 2 +- book/src/guides/injection.md | 2 +- book/src/guides/textobject.md | 4 ++-- book/src/languages.md | 2 +- book/src/themes.md | 2 +- runtime/queries/ada/highlights.scm | 6 ------ runtime/queries/ada/locals.scm | 3 --- runtime/queries/awk/highlights.scm | 2 -- runtime/queries/tact/locals.scm | 2 -- 9 files changed, 6 insertions(+), 19 deletions(-) diff --git a/book/src/guides/adding_languages.md b/book/src/guides/adding_languages.md index aa4bf0c5..cb7e0eb6 100644 --- a/book/src/guides/adding_languages.md +++ b/book/src/guides/adding_languages.md @@ -34,7 +34,7 @@ below. 2. Create a new directory for the language with the path `runtime/queries//`. 3. Refer to the - [tree-sitter website](https://tree-sitter.github.io/tree-sitter/syntax-highlighting#queries) + [tree-sitter website](https://tree-sitter.github.io/tree-sitter/3-syntax-highlighting.html#highlights) for more information on writing queries. 4. A list of highlight captures can be found [on the themes page](https://docs.helix-editor.com/themes.html#scopes). diff --git a/book/src/guides/injection.md b/book/src/guides/injection.md index c0f75094..729a2c99 100644 --- a/book/src/guides/injection.md +++ b/book/src/guides/injection.md @@ -57,4 +57,4 @@ second argument (a string). - `#any-of?` (standard): The first argument (a capture) must be one of the other arguments (strings). -[upstream-docs]: http://tree-sitter.github.io/tree-sitter/syntax-highlighting#language-injection +[upstream-docs]: https://tree-sitter.github.io/tree-sitter/3-syntax-highlighting.html#language-injection diff --git a/book/src/guides/textobject.md b/book/src/guides/textobject.md index 4d33ab67..2cf3d3be 100644 --- a/book/src/guides/textobject.md +++ b/book/src/guides/textobject.md @@ -44,6 +44,6 @@ in its `textobjects.scm` file, function navigation should also work automaticall `function.movement` should be defined only if the node captured by `function.around` doesn't make sense in a navigation context. -[tree-sitter-queries]: https://tree-sitter.github.io/tree-sitter/using-parsers#query-syntax -[tree-sitter-captures]: https://tree-sitter.github.io/tree-sitter/using-parsers#capturing-nodes +[tree-sitter-queries]: https://tree-sitter.github.io/tree-sitter/using-parsers/queries/1-syntax.html +[tree-sitter-captures]: https://tree-sitter.github.io/tree-sitter/using-parsers/queries/2-operators.html#capturing-nodes [textobject-examples]: https://github.com/search?q=repo%3Ahelix-editor%2Fhelix+path%3A%2A%2A/textobjects.scm&type=Code&ref=advsearch&l=&l= diff --git a/book/src/languages.md b/book/src/languages.md index 0190bb44..d98b1fcb 100644 --- a/book/src/languages.md +++ b/book/src/languages.md @@ -241,4 +241,4 @@ use-grammars = { except = [ "yaml", "json" ] } When omitted, all grammars are fetched and built. -[treesitter-language-injection]: https://tree-sitter.github.io/tree-sitter/syntax-highlighting#language-injection +[treesitter-language-injection]: https://tree-sitter.github.io/tree-sitter/3-syntax-highlighting.html#language-injection diff --git a/book/src/themes.md b/book/src/themes.md index 1d0ba151..62279356 100644 --- a/book/src/themes.md +++ b/book/src/themes.md @@ -136,7 +136,7 @@ The following is a list of scopes available to use for styling: #### Syntax highlighting -These keys match [tree-sitter scopes](https://tree-sitter.github.io/tree-sitter/syntax-highlighting#theme). +These keys match [tree-sitter scopes](https://tree-sitter.github.io/tree-sitter/3-syntax-highlighting.html#highlights). When determining styling for a highlight, the longest matching theme key will be used. For example, if the highlight is `function.builtin.static`, the key `function.builtin` will be used instead of `function`. diff --git a/runtime/queries/ada/highlights.scm b/runtime/queries/ada/highlights.scm index 643fbd66..38e67d82 100644 --- a/runtime/queries/ada/highlights.scm +++ b/runtime/queries/ada/highlights.scm @@ -1,9 +1,3 @@ -;; highlight queries. -;; See the syntax at https://tree-sitter.github.io/tree-sitter/using-parsers#pattern-matching-with-queries -;; See also https://github.com/nvim-treesitter/nvim-treesitter/blob/master/CONTRIBUTING.md#parser-configurations -;; for a list of recommended @ tags, though not all of them have matching -;; highlights in neovim. - [ "abort" "abs" diff --git a/runtime/queries/ada/locals.scm b/runtime/queries/ada/locals.scm index e532a2f1..83d62a43 100644 --- a/runtime/queries/ada/locals.scm +++ b/runtime/queries/ada/locals.scm @@ -1,6 +1,3 @@ -;; Better highlighting by referencing to the definition, for variable references. -;; See https://tree-sitter.github.io/tree-sitter/syntax-highlighting#local-variables - (compilation) @local.scope (package_declaration) @local.scope (package_body) @local.scope diff --git a/runtime/queries/awk/highlights.scm b/runtime/queries/awk/highlights.scm index 34d660ad..f8c903f2 100644 --- a/runtime/queries/awk/highlights.scm +++ b/runtime/queries/awk/highlights.scm @@ -1,7 +1,5 @@ ; tree-sitter-awk v0.5.1 -; https://tree-sitter.github.io/tree-sitter/using-parsers#pattern-matching-with-queries - ; Order matters [ diff --git a/runtime/queries/tact/locals.scm b/runtime/queries/tact/locals.scm index f1b3e8de..f7a4115a 100644 --- a/runtime/queries/tact/locals.scm +++ b/runtime/queries/tact/locals.scm @@ -1,5 +1,3 @@ -; See: https://tree-sitter.github.io/tree-sitter/syntax-highlighting#local-variables - ; Scopes @local.scope ; ------------------------- From 073efe48f946e6c890aa449628b28b169fca0023 Mon Sep 17 00:00:00 2001 From: Michael Davis Date: Sat, 28 Dec 2024 21:40:57 -0500 Subject: [PATCH 04/17] minor: Setup default keymap directly in xtask docgen Instantiating EditorView is a lot of machinery which is unnecessary: the default keymap is exposed through the `default` function in the keymap module. --- helix-term/src/ui/editor.rs | 6 ------ xtask/src/docgen.rs | 3 +-- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/helix-term/src/ui/editor.rs b/helix-term/src/ui/editor.rs index 5ac401bf..5d028415 100644 --- a/helix-term/src/ui/editor.rs +++ b/helix-term/src/ui/editor.rs @@ -57,12 +57,6 @@ pub enum InsertEvent { RequestCompletion, } -impl Default for EditorView { - fn default() -> Self { - Self::new(Keymaps::default()) - } -} - impl EditorView { pub fn new(keymaps: Keymaps) -> Self { Self { diff --git a/xtask/src/docgen.rs b/xtask/src/docgen.rs index 6b9ebfa3..2b58e732 100644 --- a/xtask/src/docgen.rs +++ b/xtask/src/docgen.rs @@ -5,7 +5,6 @@ use crate::DynError; use helix_term::commands::MappableCommand; use helix_term::commands::TYPABLE_COMMAND_LIST; use helix_term::health::TsFeature; -use helix_term::ui::EditorView; use helix_view::document::Mode; use std::collections::HashSet; @@ -56,7 +55,7 @@ pub fn typable_commands() -> Result { pub fn static_commands() -> Result { let mut md = String::new(); - let keymap = EditorView::default().keymaps.map(); + let keymap = helix_term::keymap::default(); let keymaps = [ ("normal", keymap[&Mode::Normal].reverse_map()), ("select", keymap[&Mode::Select].reverse_map()), From 6d07ae4f07c220e50200c3dddde098a746c23a85 Mon Sep 17 00:00:00 2001 From: Karim Abou Zeid <7303830+kabouzeid@users.noreply.github.com> Date: Sun, 29 Dec 2024 03:44:26 +0100 Subject: [PATCH 05/17] add `uv` shebang for python (#12360) --- languages.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/languages.toml b/languages.toml index 645443d1..cab9e8c6 100644 --- a/languages.toml +++ b/languages.toml @@ -882,7 +882,7 @@ name = "python" scope = "source.python" injection-regex = "py(thon)?" file-types = ["py", "pyi", "py3", "pyw", "ptl", "rpy", "cpy", "ipy", "pyt", { glob = ".python_history" }, { glob = ".pythonstartup" }, { glob = ".pythonrc" }, { glob = "SConstruct" }, { glob = "SConscript" }] -shebangs = ["python"] +shebangs = ["python", "uv"] roots = ["pyproject.toml", "setup.py", "poetry.lock", "pyrightconfig.json"] comment-token = "#" language-servers = ["ruff", "jedi", "pylsp"] From 9cc056e755273156b01cedf47a8cdfdf82d84252 Mon Sep 17 00:00:00 2001 From: Jean Abou Samra Date: Sun, 29 Dec 2024 17:38:28 +0100 Subject: [PATCH 06/17] fix (hx --health): Don't print headers in white (#12355) --- helix-term/src/health.rs | 47 ++++++++++++++++++---------------------- 1 file changed, 21 insertions(+), 26 deletions(-) diff --git a/helix-term/src/health.rs b/helix-term/src/health.rs index 88e7b27b..faf632d8 100644 --- a/helix-term/src/health.rs +++ b/helix-term/src/health.rs @@ -1,6 +1,6 @@ use crate::config::{Config, ConfigLoadError}; use crossterm::{ - style::{Color, Print, Stylize}, + style::{Color, StyledContent, Stylize}, tty::IsTty, }; use helix_core::config::{default_lang_config, user_lang_config}; @@ -164,25 +164,20 @@ pub fn languages_all() -> std::io::Result<()> { let column_width = terminal_cols as usize / headings.len(); let is_terminal = std::io::stdout().is_tty(); - let column = |item: &str, color: Color| { - let mut data = format!( - "{:width$}", - item.get(..column_width - 2) + let fit = |s: &str| -> StyledContent { + format!( + "{:column_width$}", + s.get(..column_width - 2) .map(|s| format!("{}…", s)) - .unwrap_or_else(|| item.to_string()), - width = column_width, - ); - if is_terminal { - data = data.stylize().with(color).to_string(); - } - - // We can't directly use println!() because of - // https://github.com/crossterm-rs/crossterm/issues/589 - let _ = crossterm::execute!(std::io::stdout(), Print(data)); + .unwrap_or_else(|| s.to_string()) + ) + .stylize() }; + let color = |s: StyledContent, c: Color| if is_terminal { s.with(c) } else { s }; + let bold = |s: StyledContent| if is_terminal { s.bold() } else { s }; for heading in headings { - column(heading, Color::White); + write!(stdout, "{}", bold(fit(heading)))?; } writeln!(stdout)?; @@ -192,14 +187,14 @@ pub fn languages_all() -> std::io::Result<()> { let check_binary = |cmd: Option<&str>| match cmd { Some(cmd) => match helix_stdx::env::which(cmd) { - Ok(_) => column(&format!("✓ {}", cmd), Color::Green), - Err(_) => column(&format!("✘ {}", cmd), Color::Red), + Ok(_) => color(fit(&format!("✓ {}", cmd)), Color::Green), + Err(_) => color(fit(&format!("✘ {}", cmd)), Color::Red), }, - None => column("None", Color::Yellow), + None => color(fit("None"), Color::Yellow), }; for lang in &syn_loader_conf.language { - column(&lang.language_id, Color::Reset); + write!(stdout, "{}", fit(&lang.language_id))?; let mut cmds = lang.language_servers.iter().filter_map(|ls| { syn_loader_conf @@ -207,28 +202,28 @@ pub fn languages_all() -> std::io::Result<()> { .get(&ls.name) .map(|config| config.command.as_str()) }); - check_binary(cmds.next()); + write!(stdout, "{}", check_binary(cmds.next()))?; let dap = lang.debugger.as_ref().map(|dap| dap.command.as_str()); - check_binary(dap); + write!(stdout, "{}", check_binary(dap))?; let formatter = lang .formatter .as_ref() .map(|formatter| formatter.command.as_str()); - check_binary(formatter); + write!(stdout, "{}", check_binary(formatter))?; for ts_feat in TsFeature::all() { match load_runtime_file(&lang.language_id, ts_feat.runtime_filename()).is_ok() { - true => column("✓", Color::Green), - false => column("✘", Color::Red), + true => write!(stdout, "{}", color(fit("✓"), Color::Green))?, + false => write!(stdout, "{}", color(fit("✘"), Color::Red))?, } } writeln!(stdout)?; for cmd in cmds { - column("", Color::Reset); + write!(stdout, "{}", fit(""))?; check_binary(Some(cmd)); writeln!(stdout)?; } From bbeb99dc406b6ee822dfa2bbff9a0b8918ee5a90 Mon Sep 17 00:00:00 2001 From: Matthew Taylor Date: Mon, 30 Dec 2024 15:58:16 -0500 Subject: [PATCH 07/17] fix: Bump `vento` grammar revision (#12368) --- languages.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/languages.toml b/languages.toml index cab9e8c6..23bd5fc9 100644 --- a/languages.toml +++ b/languages.toml @@ -4013,7 +4013,7 @@ indent = { tab-width = 4, unit = " " } [[grammar]] name = "vento" -source = { git = "https://github.com/ventojs/tree-sitter-vento", rev = "3321077d7446c1b3b017c294fd56ce028ed817fe" } +source = { git = "https://github.com/ventojs/tree-sitter-vento", rev = "3b32474bc29584ea214e4e84b47102408263fe0e" } [[language]] name = "nginx" From 41763b4851752120082a0a12807f51ceacaaac6f Mon Sep 17 00:00:00 2001 From: Egor Afanasin <69684823+pithecantrope@users.noreply.github.com> Date: Tue, 31 Dec 2024 18:11:33 +0300 Subject: [PATCH 08/17] Sunset theme: add ui.text.directory (#12372) --- runtime/themes/sunset.toml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/runtime/themes/sunset.toml b/runtime/themes/sunset.toml index 2683f0a8..ec3aca8f 100644 --- a/runtime/themes/sunset.toml +++ b/runtime/themes/sunset.toml @@ -109,9 +109,10 @@ special = "sky" "ui.help" = { fg = "text", bg = "block" } "ui.text" = { fg = "text", bg = "base" } -"ui.text.focus" = "sun" -"ui.text.inactive" = { fg = "cmnt", modifiers = ["italic"] } -"ui.text.info" = { bg = "block" } +"ui.text.directory" = "sky" +"ui.text.focus" = "sun" +"ui.text.inactive" = { fg = "cmnt", modifiers = ["italic"] } +"ui.text.info" = { bg = "block" } "ui.virtual" = { fg = "block" } "ui.virtual.ruler" = { bg = "block" } From 2b4a77b9bfb17e1c4721aa7098fa683b27b99995 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 31 Dec 2024 09:12:48 -0600 Subject: [PATCH 09/17] build(deps): bump the rust-dependencies group with 2 updates (#12371) Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Cargo.lock | 12 ++++++------ helix-lsp-types/Cargo.toml | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4f2ba254..8bdb0c64 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -136,9 +136,9 @@ checksum = "df8670b8c7b9dae1793364eafadf7239c40d669904660c5960d74cfd80b46a53" [[package]] name = "cc" -version = "1.2.5" +version = "1.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c31a0499c1dc64f458ad13872de75c0eb7e3fdb0e67964610c914b034fc5956e" +checksum = "8d6dbb628b8f8555f86d0323c2eb39e3ec81901f4b83e091db8a6a76d316a333" dependencies = [ "shlex", ] @@ -2247,18 +2247,18 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "serde" -version = "1.0.216" +version = "1.0.217" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b9781016e935a97e8beecf0c933758c97a5520d32930e460142b4cd80c6338e" +checksum = "02fc4265df13d6fa1d00ecff087228cc0a2b5f3c0e87e258d8b94a156e984c70" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.216" +version = "1.0.217" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46f859dbbf73865c6627ed570e78961cd3ac92407a2d117204c49232485da55e" +checksum = "5a9bf7cf98d04a2b28aead066b7496853d4779c9cc183c440dbac457641e19a0" dependencies = [ "proc-macro2", "quote", diff --git a/helix-lsp-types/Cargo.toml b/helix-lsp-types/Cargo.toml index 36ca6ac7..fa3f3aba 100644 --- a/helix-lsp-types/Cargo.toml +++ b/helix-lsp-types/Cargo.toml @@ -22,7 +22,7 @@ license = "MIT" [dependencies] bitflags = "2.6.0" -serde = { version = "1.0.216", features = ["derive"] } +serde = { version = "1.0.217", features = ["derive"] } serde_json = "1.0.134" serde_repr = "0.1" url = {version = "2.5.4", features = ["serde"]} From 4a59f68a0dd1385771abd585b2512ec7095f51a4 Mon Sep 17 00:00:00 2001 From: Samuel Selleck <121394688+samuelselleck@users.noreply.github.com> Date: Tue, 31 Dec 2024 19:45:47 +0100 Subject: [PATCH 10/17] LSP Client: Accept floats with trailing zeros as valid JSONRPC IDs (#12376) --- helix-lsp/src/jsonrpc.rs | 45 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) diff --git a/helix-lsp/src/jsonrpc.rs b/helix-lsp/src/jsonrpc.rs index 9ff57cde..0a5b2b4c 100644 --- a/helix-lsp/src/jsonrpc.rs +++ b/helix-lsp/src/jsonrpc.rs @@ -104,10 +104,37 @@ impl std::error::Error for Error {} #[serde(untagged)] pub enum Id { Null, - Num(u64), + Num(#[serde(deserialize_with = "deserialize_jsonrpc_id_num")] u64), Str(String), } +fn deserialize_jsonrpc_id_num<'de, D>(deserializer: D) -> Result +where + D: serde::Deserializer<'de>, +{ + let num = serde_json::Number::deserialize(deserializer)?; + + if let Some(val) = num.as_u64() { + return Ok(val); + }; + + // Accept floats as long as they represent positive whole numbers. + // The JSONRPC spec says "Numbers SHOULD NOT contain fractional parts" so we should try to + // accept them if possible. The JavaScript type system lumps integers and floats together so + // some languages may serialize integer IDs as floats with a zeroed fractional part. + // See . + if let Some(val) = num + .as_f64() + .filter(|f| f.is_sign_positive() && f.fract() == 0.0) + { + return Ok(val as u64); + } + + Err(de::Error::custom( + "number must be integer or float representing a whole number in valid u64 range", + )) +} + impl std::fmt::Display for Id { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match self { @@ -375,6 +402,22 @@ fn serialize_skip_none_params() { assert_eq!(serialized, r#"{"jsonrpc":"2.0","method":"exit"}"#); } +#[test] +fn id_deserialize() { + use serde_json; + + let id = r#"8"#; + let deserialized: Id = serde_json::from_str(id).unwrap(); + assert_eq!(deserialized, Id::Num(8)); + + let id = r#"4.0"#; + let deserialized: Id = serde_json::from_str(id).unwrap(); + assert_eq!(deserialized, Id::Num(4)); + + let id = r#"0.01"#; + assert!(serde_json::from_str::(id).is_err()); +} + #[test] fn success_output_deserialize() { use serde_json; From b1759f998d527b7014b6be1eb26a518e1b5927c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20D=C3=B6rner?= Date: Tue, 31 Dec 2024 20:41:53 +0100 Subject: [PATCH 11/17] Migrate to an improved proto grammar (#12225) --- languages.toml | 7 ++-- runtime/queries/protobuf/highlights.scm | 46 ++++++++++++------------ runtime/queries/protobuf/indents.scm | 12 +++---- runtime/queries/protobuf/textobjects.scm | 10 +++--- 4 files changed, 37 insertions(+), 38 deletions(-) diff --git a/languages.toml b/languages.toml index 23bd5fc9..81ca7e77 100644 --- a/languages.toml +++ b/languages.toml @@ -340,16 +340,17 @@ source = { git = "https://github.com/Beaglefoot/tree-sitter-awk", rev = "a799bc5 [[language]] name = "protobuf" scope = "source.proto" -injection-regex = "protobuf" +injection-regex = "proto" file-types = ["proto"] language-servers = [ "bufls", "pbkit" ] comment-token = "//" block-comment-tokens = { start = "/*", end = "*/" } indent = { tab-width = 2, unit = " " } +grammar = "proto" [[grammar]] -name = "protobuf" -source = { git = "https://github.com/yusdacra/tree-sitter-protobuf", rev = "19c211a01434d9f03efff99f85e19f967591b175"} +name = "proto" +source = { git = "https://github.com/sdoerner/tree-sitter-proto", rev = "778ab6ed18a7fcf82c83805a87d63376c51e80bc"} [[language]] name = "textproto" diff --git a/runtime/queries/protobuf/highlights.scm b/runtime/queries/protobuf/highlights.scm index 6deee7df..15dd7bb3 100644 --- a/runtime/queries/protobuf/highlights.scm +++ b/runtime/queries/protobuf/highlights.scm @@ -1,5 +1,6 @@ [ "syntax" + "edition" "package" "option" "import" @@ -7,44 +8,45 @@ "rpc" "returns" "message" + "map" "enum" "oneof" "repeated" + "optional" + "required" "reserved" "to" "stream" "extend" - "optional" ] @keyword [ - (keyType) + (key_type) (type) + (message_or_enum_type) ] @type.builtin [ - (mapName) - (enumName) - (messageName) - (extendName) - (serviceName) - (rpcName) + (enum_name) + (message_name) + (service_name) + (rpc_name) ] @type [ - (fieldName) - (optionName) + (field_name) + (option_name) ] @variable.other.member -(enumVariantName) @type.enum.variant +(enum_variant_name) @type.enum.variant -(fullIdent) @namespace +(full_ident) @namespace -(intLit) @constant.numeric.integer -(floatLit) @constant.numeric.float -(boolLit) @constant.builtin.boolean -(strLit) @string +(int_lit) @constant.numeric.integer +(float_lit) @constant.numeric.float +(bool) @constant.builtin.boolean +(string) @string -(constant) @constant +(block_lit) @constant (comment) @comment @@ -55,12 +57,8 @@ "]" "{" "}" -] @punctuation.bracket +] @punctuation.bracket -[ - "=" -] @operator +"=" @operator -[ - ";" -] @punctuation.delimiter +";" @punctuation.delimiter diff --git a/runtime/queries/protobuf/indents.scm b/runtime/queries/protobuf/indents.scm index d457d75f..d55e81b2 100644 --- a/runtime/queries/protobuf/indents.scm +++ b/runtime/queries/protobuf/indents.scm @@ -1,10 +1,10 @@ [ - (messageBody) - (enumBody) - (oneofBody) - (serviceBody) - (rpcBody) - (msgLit) + (message_body) + (enum_body) + (oneof_body) + (service_body) + (rpc_body) + (block_lit) ] @indent "}" @outdent diff --git a/runtime/queries/protobuf/textobjects.scm b/runtime/queries/protobuf/textobjects.scm index 6f06b134..7b0cfb19 100644 --- a/runtime/queries/protobuf/textobjects.scm +++ b/runtime/queries/protobuf/textobjects.scm @@ -1,9 +1,9 @@ -(message (messageBody) @class.inside) @class.around -(enum (enumBody) @class.inside) @class.around -(service (serviceBody) @class.inside) @class.around +(message (message_body) @class.inside) @class.around +(enum (enum_body) @class.inside) @class.around +(service (service_body) @class.inside) @class.around -(rpc (enumMessageType) @parameter.inside) @function.inside -(rpc (enumMessageType) @parameter.around) @function.around +(rpc (message_or_enum_type) @parameter.inside) @function.inside +(rpc (message_or_enum_type) @parameter.around) @function.around (comment) @comment.inside (comment)+ @comment.around From c9cc14728fb781f5e7d39799d6579e4d784811d9 Mon Sep 17 00:00:00 2001 From: Darshan Kumawat <104432537+darshanCommits@users.noreply.github.com> Date: Thu, 2 Jan 2025 20:09:02 +0530 Subject: [PATCH 12/17] Update hyprland langugauge file type. (#12384) --- languages.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/languages.toml b/languages.toml index 81ca7e77..9d85e86f 100644 --- a/languages.toml +++ b/languages.toml @@ -3610,7 +3610,7 @@ source = { git = "https://github.com/mtoohey31/tree-sitter-ld", rev = "0e9695ae0 name = "hyprlang" scope = "source.hyprlang" roots = ["hyprland.conf"] -file-types = [ { glob = "hyprland.conf" }, { glob = "hyprpaper.conf" }, { glob = "hypridle.conf" }, { glob = "hyprlock.conf" } ] +file-types = [ { glob = "hypr/*.conf" }] comment-token = "#" grammar = "hyprlang" language-servers = ["hyprls"] From 38e8382b01e1b3ddcc8e55b5705deeebf4644e79 Mon Sep 17 00:00:00 2001 From: Michael Davis Date: Thu, 2 Jan 2025 15:33:48 -0500 Subject: [PATCH 13/17] Escape double quotes for anonymous nodes in :tree-sitter-subtree If the anonymous node contained a double quote it would throw off the highlighting. --- helix-core/src/syntax.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/helix-core/src/syntax.rs b/helix-core/src/syntax.rs index 6ddf433c..58b6de34 100644 --- a/helix-core/src/syntax.rs +++ b/helix-core/src/syntax.rs @@ -2666,12 +2666,20 @@ fn node_is_visible(node: &Node) -> bool { node.is_missing() || (node.is_named() && node.language().node_kind_is_visible(node.kind_id())) } +fn format_anonymous_node_kind(kind: &str) -> Cow { + if kind.contains('"') { + Cow::Owned(kind.replace('"', "\\\"")) + } else { + Cow::Borrowed(kind) + } +} + pub fn pretty_print_tree(fmt: &mut W, node: Node) -> fmt::Result { if node.child_count() == 0 { if node_is_visible(&node) { write!(fmt, "({})", node.kind()) } else { - write!(fmt, "\"{}\"", node.kind()) + write!(fmt, "\"{}\"", format_anonymous_node_kind(node.kind())) } } else { pretty_print_tree_impl(fmt, &mut node.walk(), 0) @@ -2696,7 +2704,7 @@ fn pretty_print_tree_impl( write!(fmt, "({}", node.kind())?; } else { - write!(fmt, " \"{}\"", node.kind())?; + write!(fmt, " \"{}\"", format_anonymous_node_kind(node.kind()))?; } // Handle children. From e0bccd2c58a54b6a2ab4435cd1c019efa08eff40 Mon Sep 17 00:00:00 2001 From: Michael Davis Date: Thu, 2 Jan 2025 15:37:18 -0500 Subject: [PATCH 14/17] tsq: Tune highlights to more closely match 24.07 release The changes in #12148 were a bit radical - this restores some customizations we had like using "label" for captures and not highlighting the '#' or '?'/'!' parts differently. Also the highlighting for predicates we do (not) support has been restored. --- runtime/queries/tsq/highlights.scm | 23 ++++++++--------------- runtime/queries/tsq/injections.scm | 2 +- 2 files changed, 9 insertions(+), 16 deletions(-) diff --git a/runtime/queries/tsq/highlights.scm b/runtime/queries/tsq/highlights.scm index 67d22744..856a1da6 100644 --- a/runtime/queries/tsq/highlights.scm +++ b/runtime/queries/tsq/highlights.scm @@ -11,11 +11,6 @@ "_" @constant -[ - "@" - "#" -] @punctuation.special - ":" @punctuation.delimiter [ @@ -27,8 +22,6 @@ "." @operator -(predicate_type) @punctuation.special - (quantifier) @operator (comment) @comment @@ -41,16 +34,16 @@ name: (identifier) @variable.other.member) (named_node - name: (identifier) @variable) + name: (identifier) @tag) -(predicate - name: (identifier) @function) +((predicate + "#" @function.builtin + name: (identifier) @function.builtin @_name + type: (predicate_type) @function.builtin) + (#any-of? @_name "eq" "match" "any-of" "not-any-of" "is" "is-not" "not-same-line" "not-kind-eq" "set" "select-adjacent" "strip")) +(predicate name: (identifier) @error) -(anonymous_node - (string) @string) - -(capture - (identifier) @type) +(capture) @label (escape_sequence) @constant.character.escape diff --git a/runtime/queries/tsq/injections.scm b/runtime/queries/tsq/injections.scm index 253a9bdb..9178ea5f 100644 --- a/runtime/queries/tsq/injections.scm +++ b/runtime/queries/tsq/injections.scm @@ -5,6 +5,6 @@ name: (identifier) @_name parameters: (parameters - (string) @injection.content)) + (string (string_content) @injection.content))) (#any-of? @_name "match" "not-match") (#set! injection.language "regex")) From 4817bfa003163150c9a4553757b4e209e470ecbf Mon Sep 17 00:00:00 2001 From: Michael Davis Date: Thu, 2 Jan 2025 15:43:51 -0500 Subject: [PATCH 15/17] minor: fix syntax tree pretty print test This case needs to be adjusted for the escaping added in 38e8382b --- helix-core/src/syntax.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/helix-core/src/syntax.rs b/helix-core/src/syntax.rs index 58b6de34..375846b0 100644 --- a/helix-core/src/syntax.rs +++ b/helix-core/src/syntax.rs @@ -2981,8 +2981,8 @@ mod test { " (macro_invocation\n", " macro: (identifier) \"!\"\n", " (token_tree \"(\"\n", - " (string_literal \"\"\"\n", - " (string_content) \"\"\") \")\")) \";\") \"}\"))", + " (string_literal \"\\\"\"\n", + " (string_content) \"\\\"\") \")\")) \";\") \"}\"))", ), 0, source.len(), From eaa7c8e9f6b2b2307cd20af9f6e472341c87a158 Mon Sep 17 00:00:00 2001 From: David Crespo Date: Fri, 3 Jan 2025 09:11:37 -0500 Subject: [PATCH 16/17] docs: fix typo in usage.md (#12390) --- book/src/usage.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/book/src/usage.md b/book/src/usage.md index a22a1849..b0d77613 100644 --- a/book/src/usage.md +++ b/book/src/usage.md @@ -25,7 +25,7 @@ Inspired by [Kakoune](http://kakoune.org/), Helix follows the `selection → act ## Multiple selections -Also inspired by Kakoune, multiple selections are a core mode of interaction in Helix. For example, the standard way of replacing multiple instance of a word is to first select all instances (so there is one selection per instance) and then use the change action (`c`) to edit them all at the same time. +Also inspired by Kakoune, multiple selections are a core mode of interaction in Helix. For example, the standard way of replacing multiple instances of a word is to first select all instances (so there is one selection per instance) and then use the change action (`c`) to edit them all at the same time. ## Motions From 9dcc1f06b007ef8d0dd456a653396280477b9776 Mon Sep 17 00:00:00 2001 From: Niza Toshpulatov Date: Fri, 3 Jan 2025 15:13:44 +0100 Subject: [PATCH 17/17] Add dim modifier to diagnostic.unnecessary in catppuccin_mocha.toml (#12391) --- runtime/themes/catppuccin_mocha.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/runtime/themes/catppuccin_mocha.toml b/runtime/themes/catppuccin_mocha.toml index c8138fc4..1f88e7e9 100644 --- a/runtime/themes/catppuccin_mocha.toml +++ b/runtime/themes/catppuccin_mocha.toml @@ -115,6 +115,7 @@ "ui.menu" = { fg = "overlay2", bg = "surface0" } "ui.menu.selected" = { fg = "text", bg = "surface1", modifiers = ["bold"] } +"diagnostic.unnecessary" = { modifiers = ["dim"] } "diagnostic.error" = { underline = { color = "red", style = "curl" } } "diagnostic.warning" = { underline = { color = "yellow", style = "curl" } } "diagnostic.info" = { underline = { color = "sky", style = "curl" } }