Merge branch 'helix-editor:master' into vsplit_extend

pull/10934/head
Lyndon-Mackay 5 months ago committed by GitHub
commit d06b8d941e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

4
Cargo.lock generated

@ -2698,9 +2698,9 @@ checksum = "d4c87d22b6e3f4a18d4d40ef354e97c90fcb14dd91d7dc0aa9d8a1172ebf7202"
[[package]] [[package]]
name = "unicode-width" name = "unicode-width"
version = "0.1.13" version = "0.1.12"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0336d538f7abc86d282a4189614dfaa90810dfc2c6f6427eaf88e16311dd225d" checksum = "68f5e5f3158ecfd4b8ff6fe086db7c8467a2dfdac97fe420f2b7c4aa97af66d6"
[[package]] [[package]]
name = "url" name = "url"

@ -1,4 +1,4 @@
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Deserializer, Serialize};
use serde_json::Value; use serde_json::Value;
use std::collections::HashMap; use std::collections::HashMap;
use std::path::PathBuf; use std::path::PathBuf;
@ -311,7 +311,8 @@ pub struct Variable {
#[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)] #[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct Module { pub struct Module {
pub id: String, // TODO: || number #[serde(deserialize_with = "from_number")]
pub id: String,
pub name: String, pub name: String,
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
pub path: Option<PathBuf>, pub path: Option<PathBuf>,
@ -331,6 +332,23 @@ pub struct Module {
pub address_range: Option<String>, pub address_range: Option<String>,
} }
fn from_number<'de, D>(deserializer: D) -> Result<String, D::Error>
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 { pub mod requests {
use super::*; use super::*;
#[derive(Debug, Default, PartialEq, Eq, Clone, Deserialize, Serialize)] #[derive(Debug, Default, PartialEq, Eq, Clone, Deserialize, Serialize)]
@ -887,4 +905,18 @@ pub mod events {
pub offset: usize, pub offset: usize,
pub count: 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");
}
} }

@ -1029,11 +1029,12 @@ pub fn rename_symbol(cx: &mut Context) {
fn create_rename_prompt( fn create_rename_prompt(
editor: &Editor, editor: &Editor,
prefill: String, prefill: String,
history_register: Option<char>,
language_server_id: Option<LanguageServerId>, language_server_id: Option<LanguageServerId>,
) -> Box<ui::Prompt> { ) -> Box<ui::Prompt> {
let prompt = ui::Prompt::new( let prompt = ui::Prompt::new(
"rename-to:".into(), "rename-to:".into(),
None, history_register,
ui::completers::none, ui::completers::none,
move |cx: &mut compositor::Context, input: &str, event: PromptEvent| { move |cx: &mut compositor::Context, input: &str, event: PromptEvent| {
if event != PromptEvent::Validate { if event != PromptEvent::Validate {
@ -1070,6 +1071,7 @@ pub fn rename_symbol(cx: &mut Context) {
} }
let (view, doc) = current_ref!(cx.editor); let (view, doc) = current_ref!(cx.editor);
let history_register = cx.register;
if doc if doc
.language_servers_with_feature(LanguageServerFeature::RenameSymbol) .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); compositor.push(prompt);
}, },
); );
} else { } else {
let prefill = get_prefill_from_word_boundary(cx.editor); 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); cx.push_layer(prompt);
} }
} }

@ -938,7 +938,11 @@ impl EditorView {
// If the count is already started and the input is a number, always continue the count. // If the count is already started and the input is a number, always continue the count.
(key!(i @ '0'..='9'), Some(count)) => { (key!(i @ '0'..='9'), Some(count)) => {
let i = i.to_digit(10).unwrap() as usize; 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. // 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) => { (key!(i @ '1'..='9'), None) if !self.keymaps.contains_key(mode, event) => {

@ -1,7 +1,6 @@
inherits = "catppuccin_mocha" inherits = "catppuccin_mocha"
[palette] [palette]
# catppuccin palette colors
rosewater = "#f2d5cf" rosewater = "#f2d5cf"
flamingo = "#eebebe" flamingo = "#eebebe"
pink = "#f4b8e4" pink = "#f4b8e4"
@ -16,7 +15,6 @@ sky = "#99d1db"
sapphire = "#85c1dc" sapphire = "#85c1dc"
blue = "#8caaee" blue = "#8caaee"
lavender = "#babbf1" lavender = "#babbf1"
text = "#c6d0f5" text = "#c6d0f5"
subtext1 = "#b5bfe2" subtext1 = "#b5bfe2"
subtext0 = "#a5adce" subtext0 = "#a5adce"
@ -26,13 +24,11 @@ overlay0 = "#737994"
surface2 = "#626880" surface2 = "#626880"
surface1 = "#51576d" surface1 = "#51576d"
surface0 = "#414559" surface0 = "#414559"
base = "#303446" base = "#303446"
mantle = "#292c3c" mantle = "#292c3c"
crust = "#232634" crust = "#232634"
# derived colors by blending existing palette colors
cursorline = "#3b3f52" cursorline = "#3b3f52"
secondary_cursor = "#b8a5a6" secondary_cursor = "#b8a5a6"
secondary_cursor_normal = "#9193be" secondary_cursor_normal = "#9192be"
secondary_cursor_insert = "#83a275" secondary_cursor_insert = "#83a275"

@ -1,7 +1,6 @@
inherits = "catppuccin_mocha" inherits = "catppuccin_mocha"
[palette] [palette]
# catppuccin palette colors
rosewater = "#dc8a78" rosewater = "#dc8a78"
flamingo = "#dd7878" flamingo = "#dd7878"
pink = "#ea76cb" pink = "#ea76cb"
@ -16,7 +15,6 @@ sky = "#04a5e5"
sapphire = "#209fb5" sapphire = "#209fb5"
blue = "#1e66f5" blue = "#1e66f5"
lavender = "#7287fd" lavender = "#7287fd"
text = "#4c4f69" text = "#4c4f69"
subtext1 = "#5c5f77" subtext1 = "#5c5f77"
subtext0 = "#6c6f85" subtext0 = "#6c6f85"
@ -26,13 +24,11 @@ overlay0 = "#9ca0b0"
surface2 = "#acb0be" surface2 = "#acb0be"
surface1 = "#bcc0cc" surface1 = "#bcc0cc"
surface0 = "#ccd0da" surface0 = "#ccd0da"
base = "#eff1f5" base = "#eff1f5"
mantle = "#e6e9ef" mantle = "#e6e9ef"
crust = "#dce0e8" crust = "#dce0e8"
# derived colors by blending existing palette colors cursorline = "#e8ecf1"
cursorline = "#e9ebf1" secondary_cursor = "#e1a99d"
secondary_cursor = "#e2a99e" secondary_cursor_normal = "#97a7fb"
secondary_cursor_normal = "#98a7fb" secondary_cursor_insert = "#74b867"
secondary_cursor_insert = "#75b868"

@ -1,7 +1,6 @@
inherits = "catppuccin_mocha" inherits = "catppuccin_mocha"
[palette] [palette]
# catppuccin palette colors
rosewater = "#f4dbd6" rosewater = "#f4dbd6"
flamingo = "#f0c6c6" flamingo = "#f0c6c6"
pink = "#f5bde6" pink = "#f5bde6"
@ -16,7 +15,6 @@ sky = "#91d7e3"
sapphire = "#7dc4e4" sapphire = "#7dc4e4"
blue = "#8aadf4" blue = "#8aadf4"
lavender = "#b7bdf8" lavender = "#b7bdf8"
text = "#cad3f5" text = "#cad3f5"
subtext1 = "#b8c0e0" subtext1 = "#b8c0e0"
subtext0 = "#a5adcb" subtext0 = "#a5adcb"
@ -26,13 +24,11 @@ overlay0 = "#6e738d"
surface2 = "#5b6078" surface2 = "#5b6078"
surface1 = "#494d64" surface1 = "#494d64"
surface0 = "#363a4f" surface0 = "#363a4f"
base = "#24273a" base = "#24273a"
mantle = "#1e2030" mantle = "#1e2030"
crust = "#181926" crust = "#181926"
# derived colors by blending existing palette colors
cursorline = "#303347" cursorline = "#303347"
secondary_cursor = "#b6a5a7" secondary_cursor = "#b6a6a7"
secondary_cursor_normal = "#8b90bf" secondary_cursor_normal = "#8b91bf"
secondary_cursor_insert = "#7fa47a" secondary_cursor_insert = "#80a57a"

@ -1,19 +1,22 @@
# Syntax highlighting # Syntax highlighting
# ------------------- # -------------------
"attribute" = "yellow"
"type" = "yellow" "type" = "yellow"
"type.enum.variant" = "teal"
"constructor" = "sapphire" "constructor" = "sapphire"
"constant" = "peach" "constant" = "peach"
"constant.builtin" = "peach"
"constant.character" = "teal" "constant.character" = "teal"
"constant.character.escape" = "pink" "constant.character.escape" = "pink"
"string" = "green" "string" = "green"
"string.regexp" = "peach" "string.regexp" = "pink"
"string.special" = "blue" "string.special" = "blue"
"string.special.symbol" = "red"
"comment" = { fg = "overlay1", modifiers = ["italic"] } "comment" = { fg = "overlay2", modifiers = ["italic"] }
"variable" = "text" "variable" = "text"
"variable.parameter" = { fg = "maroon", modifiers = ["italic"] } "variable.parameter" = { fg = "maroon", modifiers = ["italic"] }
@ -26,7 +29,6 @@
"punctuation.special" = "sky" "punctuation.special" = "sky"
"keyword" = "mauve" "keyword" = "mauve"
"keyword.storage.modifier.ref" = "teal"
"keyword.control.conditional" = { fg = "mauve", modifiers = ["italic"] } "keyword.control.conditional" = { fg = "mauve", modifiers = ["italic"] }
"operator" = "sky" "operator" = "sky"
@ -34,10 +36,9 @@
"function" = "blue" "function" = "blue"
"function.macro" = "mauve" "function.macro" = "mauve"
"tag" = "mauve" "tag" = "blue"
"attribute" = "blue"
"namespace" = { fg = "blue", modifiers = ["italic"] } "namespace" = { fg = "yellow", modifiers = ["italic"] }
"special" = "blue" # fuzzy highlight "special" = "blue" # fuzzy highlight
@ -51,8 +52,7 @@
"markup.list" = "mauve" "markup.list" = "mauve"
"markup.bold" = { modifiers = ["bold"] } "markup.bold" = { modifiers = ["bold"] }
"markup.italic" = { modifiers = ["italic"] } "markup.italic" = { modifiers = ["italic"] }
"markup.strikethrough" = { modifiers = ["crossed_out"] } "markup.link.url" = { fg = "blue", modifiers = ["italic", "underlined"] }
"markup.link.url" = { fg = "rosewater", modifiers = ["underlined"] }
"markup.link.text" = "blue" "markup.link.text" = "blue"
"markup.raw" = "flamingo" "markup.raw" = "flamingo"
@ -70,8 +70,8 @@
"ui.statusline" = { fg = "subtext1", bg = "mantle" } "ui.statusline" = { fg = "subtext1", bg = "mantle" }
"ui.statusline.inactive" = { fg = "surface2", bg = "mantle" } "ui.statusline.inactive" = { fg = "surface2", bg = "mantle" }
"ui.statusline.normal" = { fg = "base", bg = "lavender", modifiers = ["bold"] } "ui.statusline.normal" = { fg = "base", bg = "lavender", modifiers = ["bold"] }
"ui.statusline.insert" = { fg = "base", bg = "green", modifiers = ["bold"] } "ui.statusline.insert" = { fg = "base", bg = "green", modifiers = ["bold"] }
"ui.statusline.select" = { fg = "base", bg = "flamingo", modifiers = ["bold"] } "ui.statusline.select" = { fg = "base", bg = "flamingo", modifiers = ["bold"] }
"ui.popup" = { fg = "text", bg = "surface0" } "ui.popup" = { fg = "text", bg = "surface0" }
"ui.window" = { fg = "crust" } "ui.window" = { fg = "crust" }
@ -88,7 +88,7 @@
"ui.virtual" = "overlay0" "ui.virtual" = "overlay0"
"ui.virtual.ruler" = { bg = "surface0" } "ui.virtual.ruler" = { bg = "surface0" }
"ui.virtual.indent-guide" = "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.virtual.jump-label" = { fg = "rosewater", modifiers = ["bold"] }
"ui.selection" = { bg = "surface1" } "ui.selection" = { bg = "surface1" }
@ -116,8 +116,6 @@
"diagnostic.warning" = { underline = { color = "yellow", style = "curl" } } "diagnostic.warning" = { underline = { color = "yellow", style = "curl" } }
"diagnostic.info" = { underline = { color = "sky", style = "curl" } } "diagnostic.info" = { underline = { color = "sky", style = "curl" } }
"diagnostic.hint" = { underline = { color = "teal", style = "curl" } } "diagnostic.hint" = { underline = { color = "teal", style = "curl" } }
"diagnostic.unnecessary" = { modifiers = ["dim"] }
"diagnostic.deprecated" = { modifiers = ["crossed_out"] }
error = "red" error = "red"
warning = "yellow" warning = "yellow"
@ -125,7 +123,6 @@ info = "sky"
hint = "teal" hint = "teal"
[palette] [palette]
# catppuccin palette colors
rosewater = "#f5e0dc" rosewater = "#f5e0dc"
flamingo = "#f2cdcd" flamingo = "#f2cdcd"
pink = "#f5c2e7" pink = "#f5c2e7"
@ -140,7 +137,6 @@ sky = "#89dceb"
sapphire = "#74c7ec" sapphire = "#74c7ec"
blue = "#89b4fa" blue = "#89b4fa"
lavender = "#b4befe" lavender = "#b4befe"
text = "#cdd6f4" text = "#cdd6f4"
subtext1 = "#bac2de" subtext1 = "#bac2de"
subtext0 = "#a6adc8" subtext0 = "#a6adc8"
@ -150,13 +146,11 @@ overlay0 = "#6c7086"
surface2 = "#585b70" surface2 = "#585b70"
surface1 = "#45475a" surface1 = "#45475a"
surface0 = "#313244" surface0 = "#313244"
base = "#1e1e2e" base = "#1e1e2e"
mantle = "#181825" mantle = "#181825"
crust = "#11111b" crust = "#11111b"
# derived colors by blending existing palette colors
cursorline = "#2a2b3c" cursorline = "#2a2b3c"
secondary_cursor = "#b5a6a8" secondary_cursor = "#b5a6a8"
secondary_cursor_normal = "#878ec0" secondary_cursor_normal = "#878ec0"
secondary_cursor_insert = "#7da87e" secondary_cursor_insert = "#7ea87f"

Loading…
Cancel
Save