From 62655e97f18a78190a87102586dbdc5ac9cbd732 Mon Sep 17 00:00:00 2001 From: Sebastian Poeplau Date: Wed, 12 Jun 2024 16:44:47 +0200 Subject: [PATCH 1/5] Optional history for rename_symbol (#10932) Fix #10560 by accepting an optional history register for the rename_symbol command. --- helix-term/src/commands/lsp.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/helix-term/src/commands/lsp.rs b/helix-term/src/commands/lsp.rs index e7ba9f0fc..d585e1bed 100644 --- a/helix-term/src/commands/lsp.rs +++ b/helix-term/src/commands/lsp.rs @@ -1029,11 +1029,12 @@ pub fn rename_symbol(cx: &mut Context) { fn create_rename_prompt( editor: &Editor, prefill: String, + history_register: Option, language_server_id: Option, ) -> Box { let prompt = ui::Prompt::new( "rename-to:".into(), - None, + history_register, ui::completers::none, move |cx: &mut compositor::Context, input: &str, event: PromptEvent| { if event != PromptEvent::Validate { @@ -1070,6 +1071,7 @@ pub fn rename_symbol(cx: &mut Context) { } let (view, doc) = current_ref!(cx.editor); + let history_register = cx.register; if doc .language_servers_with_feature(LanguageServerFeature::RenameSymbol) @@ -1112,14 +1114,14 @@ pub fn rename_symbol(cx: &mut Context) { } }; - let prompt = create_rename_prompt(editor, prefill, Some(ls_id)); + let prompt = create_rename_prompt(editor, prefill, history_register, Some(ls_id)); compositor.push(prompt); }, ); } else { let prefill = get_prefill_from_word_boundary(cx.editor); - let prompt = create_rename_prompt(cx.editor, prefill, None); + let prompt = create_rename_prompt(cx.editor, prefill, history_register, None); cx.push_layer(prompt); } } From 9c479e6d2de3bca9dec304f9182cee2b1c0ad766 Mon Sep 17 00:00:00 2001 From: RoloEdits Date: Wed, 12 Jun 2024 18:24:24 -0700 Subject: [PATCH 2/5] fix(editor): prevent overflow in count modifier (#10930) --- helix-term/src/ui/editor.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/helix-term/src/ui/editor.rs b/helix-term/src/ui/editor.rs index d584afbb0..a071bfaa8 100644 --- a/helix-term/src/ui/editor.rs +++ b/helix-term/src/ui/editor.rs @@ -938,7 +938,11 @@ impl EditorView { // If the count is already started and the input is a number, always continue the count. (key!(i @ '0'..='9'), Some(count)) => { let i = i.to_digit(10).unwrap() as usize; - cxt.editor.count = NonZeroUsize::new(count.get() * 10 + i); + let count = count.get() * 10 + i; + if count > 100_000_000 { + return; + } + cxt.editor.count = NonZeroUsize::new(count); } // A non-zero digit will start the count if that number isn't used by a keymap. (key!(i @ '1'..='9'), None) if !self.keymaps.contains_key(mode, event) => { From 8eda96de6d8df2165c73484c15f35d0fc4ae8767 Mon Sep 17 00:00:00 2001 From: Michael Davis Date: Fri, 14 Jun 2024 20:58:14 -0500 Subject: [PATCH 3/5] Downgrade unicode-width to 0.1.12 (#10963) unicode-width 0.1.13 contains some fixes that change the widths of line endings, which breaks some assumptions in helix-tui, causing some rendering artifacts. We can downgrade to remove the rendering errors for now. --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c9f89cf4f..8c8e97481 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2698,9 +2698,9 @@ checksum = "d4c87d22b6e3f4a18d4d40ef354e97c90fcb14dd91d7dc0aa9d8a1172ebf7202" [[package]] name = "unicode-width" -version = "0.1.13" +version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0336d538f7abc86d282a4189614dfaa90810dfc2c6f6427eaf88e16311dd225d" +checksum = "68f5e5f3158ecfd4b8ff6fe086db7c8467a2dfdac97fe420f2b7c4aa97af66d6" [[package]] name = "url" From 43cc30d2256b04c821704a85ea237beefe402758 Mon Sep 17 00:00:00 2001 From: uncenter <47499684+uncenter@users.noreply.github.com> Date: Fri, 14 Jun 2024 22:34:33 -0400 Subject: [PATCH 4/5] Sync latest Catppuccin themes changes (#10954) --- runtime/themes/catppuccin_frappe.toml | 6 +---- runtime/themes/catppuccin_latte.toml | 12 +++------ runtime/themes/catppuccin_macchiato.toml | 10 +++----- runtime/themes/catppuccin_mocha.toml | 32 ++++++++++-------------- 4 files changed, 21 insertions(+), 39 deletions(-) diff --git a/runtime/themes/catppuccin_frappe.toml b/runtime/themes/catppuccin_frappe.toml index b63e5270e..2ac76ee7c 100644 --- a/runtime/themes/catppuccin_frappe.toml +++ b/runtime/themes/catppuccin_frappe.toml @@ -1,7 +1,6 @@ inherits = "catppuccin_mocha" [palette] -# catppuccin palette colors rosewater = "#f2d5cf" flamingo = "#eebebe" pink = "#f4b8e4" @@ -16,7 +15,6 @@ sky = "#99d1db" sapphire = "#85c1dc" blue = "#8caaee" lavender = "#babbf1" - text = "#c6d0f5" subtext1 = "#b5bfe2" subtext0 = "#a5adce" @@ -26,13 +24,11 @@ overlay0 = "#737994" surface2 = "#626880" surface1 = "#51576d" surface0 = "#414559" - base = "#303446" mantle = "#292c3c" crust = "#232634" -# derived colors by blending existing palette colors cursorline = "#3b3f52" secondary_cursor = "#b8a5a6" -secondary_cursor_normal = "#9193be" +secondary_cursor_normal = "#9192be" secondary_cursor_insert = "#83a275" diff --git a/runtime/themes/catppuccin_latte.toml b/runtime/themes/catppuccin_latte.toml index 7a015168e..1686f576d 100644 --- a/runtime/themes/catppuccin_latte.toml +++ b/runtime/themes/catppuccin_latte.toml @@ -1,7 +1,6 @@ inherits = "catppuccin_mocha" [palette] -# catppuccin palette colors rosewater = "#dc8a78" flamingo = "#dd7878" pink = "#ea76cb" @@ -16,7 +15,6 @@ sky = "#04a5e5" sapphire = "#209fb5" blue = "#1e66f5" lavender = "#7287fd" - text = "#4c4f69" subtext1 = "#5c5f77" subtext0 = "#6c6f85" @@ -26,13 +24,11 @@ overlay0 = "#9ca0b0" surface2 = "#acb0be" surface1 = "#bcc0cc" surface0 = "#ccd0da" - base = "#eff1f5" mantle = "#e6e9ef" crust = "#dce0e8" -# derived colors by blending existing palette colors -cursorline = "#e9ebf1" -secondary_cursor = "#e2a99e" -secondary_cursor_normal = "#98a7fb" -secondary_cursor_insert = "#75b868" +cursorline = "#e8ecf1" +secondary_cursor = "#e1a99d" +secondary_cursor_normal = "#97a7fb" +secondary_cursor_insert = "#74b867" diff --git a/runtime/themes/catppuccin_macchiato.toml b/runtime/themes/catppuccin_macchiato.toml index 6203eaade..581eb6130 100644 --- a/runtime/themes/catppuccin_macchiato.toml +++ b/runtime/themes/catppuccin_macchiato.toml @@ -1,7 +1,6 @@ inherits = "catppuccin_mocha" [palette] -# catppuccin palette colors rosewater = "#f4dbd6" flamingo = "#f0c6c6" pink = "#f5bde6" @@ -16,7 +15,6 @@ sky = "#91d7e3" sapphire = "#7dc4e4" blue = "#8aadf4" lavender = "#b7bdf8" - text = "#cad3f5" subtext1 = "#b8c0e0" subtext0 = "#a5adcb" @@ -26,13 +24,11 @@ overlay0 = "#6e738d" surface2 = "#5b6078" surface1 = "#494d64" surface0 = "#363a4f" - base = "#24273a" mantle = "#1e2030" crust = "#181926" -# derived colors by blending existing palette colors cursorline = "#303347" -secondary_cursor = "#b6a5a7" -secondary_cursor_normal = "#8b90bf" -secondary_cursor_insert = "#7fa47a" +secondary_cursor = "#b6a6a7" +secondary_cursor_normal = "#8b91bf" +secondary_cursor_insert = "#80a57a" diff --git a/runtime/themes/catppuccin_mocha.toml b/runtime/themes/catppuccin_mocha.toml index 58173dab1..3c030762e 100644 --- a/runtime/themes/catppuccin_mocha.toml +++ b/runtime/themes/catppuccin_mocha.toml @@ -1,19 +1,22 @@ # Syntax highlighting # ------------------- +"attribute" = "yellow" + "type" = "yellow" +"type.enum.variant" = "teal" "constructor" = "sapphire" "constant" = "peach" -"constant.builtin" = "peach" "constant.character" = "teal" "constant.character.escape" = "pink" "string" = "green" -"string.regexp" = "peach" +"string.regexp" = "pink" "string.special" = "blue" +"string.special.symbol" = "red" -"comment" = { fg = "overlay1", modifiers = ["italic"] } +"comment" = { fg = "overlay2", modifiers = ["italic"] } "variable" = "text" "variable.parameter" = { fg = "maroon", modifiers = ["italic"] } @@ -26,7 +29,6 @@ "punctuation.special" = "sky" "keyword" = "mauve" -"keyword.storage.modifier.ref" = "teal" "keyword.control.conditional" = { fg = "mauve", modifiers = ["italic"] } "operator" = "sky" @@ -34,10 +36,9 @@ "function" = "blue" "function.macro" = "mauve" -"tag" = "mauve" -"attribute" = "blue" +"tag" = "blue" -"namespace" = { fg = "blue", modifiers = ["italic"] } +"namespace" = { fg = "yellow", modifiers = ["italic"] } "special" = "blue" # fuzzy highlight @@ -51,8 +52,7 @@ "markup.list" = "mauve" "markup.bold" = { modifiers = ["bold"] } "markup.italic" = { modifiers = ["italic"] } -"markup.strikethrough" = { modifiers = ["crossed_out"] } -"markup.link.url" = { fg = "rosewater", modifiers = ["underlined"] } +"markup.link.url" = { fg = "blue", modifiers = ["italic", "underlined"] } "markup.link.text" = "blue" "markup.raw" = "flamingo" @@ -70,8 +70,8 @@ "ui.statusline" = { fg = "subtext1", bg = "mantle" } "ui.statusline.inactive" = { fg = "surface2", bg = "mantle" } "ui.statusline.normal" = { fg = "base", bg = "lavender", modifiers = ["bold"] } -"ui.statusline.insert" = { fg = "base", bg = "green", modifiers = ["bold"] } -"ui.statusline.select" = { fg = "base", bg = "flamingo", modifiers = ["bold"] } +"ui.statusline.insert" = { fg = "base", bg = "green", modifiers = ["bold"] } +"ui.statusline.select" = { fg = "base", bg = "flamingo", modifiers = ["bold"] } "ui.popup" = { fg = "text", bg = "surface0" } "ui.window" = { fg = "crust" } @@ -88,7 +88,7 @@ "ui.virtual" = "overlay0" "ui.virtual.ruler" = { bg = "surface0" } "ui.virtual.indent-guide" = "surface0" -"ui.virtual.inlay-hint" = { fg = "overlay0", bg = "base" } +"ui.virtual.inlay-hint" = { fg = "surface1", bg = "mantle" } "ui.virtual.jump-label" = { fg = "rosewater", modifiers = ["bold"] } "ui.selection" = { bg = "surface1" } @@ -116,8 +116,6 @@ "diagnostic.warning" = { underline = { color = "yellow", style = "curl" } } "diagnostic.info" = { underline = { color = "sky", style = "curl" } } "diagnostic.hint" = { underline = { color = "teal", style = "curl" } } -"diagnostic.unnecessary" = { modifiers = ["dim"] } -"diagnostic.deprecated" = { modifiers = ["crossed_out"] } error = "red" warning = "yellow" @@ -125,7 +123,6 @@ info = "sky" hint = "teal" [palette] -# catppuccin palette colors rosewater = "#f5e0dc" flamingo = "#f2cdcd" pink = "#f5c2e7" @@ -140,7 +137,6 @@ sky = "#89dceb" sapphire = "#74c7ec" blue = "#89b4fa" lavender = "#b4befe" - text = "#cdd6f4" subtext1 = "#bac2de" subtext0 = "#a6adc8" @@ -150,13 +146,11 @@ overlay0 = "#6c7086" surface2 = "#585b70" surface1 = "#45475a" surface0 = "#313244" - base = "#1e1e2e" mantle = "#181825" crust = "#11111b" -# derived colors by blending existing palette colors cursorline = "#2a2b3c" secondary_cursor = "#b5a6a8" secondary_cursor_normal = "#878ec0" -secondary_cursor_insert = "#7da87e" +secondary_cursor_insert = "#7ea87f" From dbacaaddcaa4a9dd39c73d0102d03ea7c24ca647 Mon Sep 17 00:00:00 2001 From: slawomirlech Date: Sat, 15 Jun 2024 09:05:04 +0200 Subject: [PATCH 5/5] DAP: Deserialize number IDs (#10943) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Fix deserialization of id * Removing external dependencies This reverts commit 27962afc16c8f047e0c28b181e8a55ba7548cde9. * Fix incorrect import * Adding tests * Moved tests --------- Co-authored-by: SÅ‚awomir Lech --- helix-dap/src/types.rs | 36 ++++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/helix-dap/src/types.rs b/helix-dap/src/types.rs index bbaf53a60..9cec05e65 100644 --- a/helix-dap/src/types.rs +++ b/helix-dap/src/types.rs @@ -1,4 +1,4 @@ -use serde::{Deserialize, Serialize}; +use serde::{Deserialize, Deserializer, Serialize}; use serde_json::Value; use std::collections::HashMap; use std::path::PathBuf; @@ -311,7 +311,8 @@ pub struct Variable { #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct Module { - pub id: String, // TODO: || number + #[serde(deserialize_with = "from_number")] + pub id: String, pub name: String, #[serde(skip_serializing_if = "Option::is_none")] pub path: Option, @@ -331,6 +332,23 @@ pub struct Module { pub address_range: Option, } +fn from_number<'de, D>(deserializer: D) -> Result +where + D: Deserializer<'de>, +{ + #[derive(Deserialize)] + #[serde(untagged)] + enum NumberOrString { + Number(i64), + String(String), + } + + match NumberOrString::deserialize(deserializer)? { + NumberOrString::Number(n) => Ok(n.to_string()), + NumberOrString::String(s) => Ok(s), + } +} + pub mod requests { use super::*; #[derive(Debug, Default, PartialEq, Eq, Clone, Deserialize, Serialize)] @@ -887,4 +905,18 @@ pub mod events { pub offset: usize, pub count: usize, } + + #[test] + fn test_deserialize_module_id_from_number() { + let raw = r#"{"id": 0, "name": "Name"}"#; + let module: super::Module = serde_json::from_str(raw).expect("Error!"); + assert_eq!(module.id, "0"); + } + + #[test] + fn test_deserialize_module_id_from_string() { + let raw = r#"{"id": "0", "name": "Name"}"#; + let module: super::Module = serde_json::from_str(raw).expect("Error!"); + assert_eq!(module.id, "0"); + } }