From 528a5e3aff011f652b0f3ac3bff61de41a9e05b2 Mon Sep 17 00:00:00 2001 From: Jaden Date: Sat, 9 Sep 2023 19:58:28 +0000 Subject: [PATCH 01/26] Update EdgedDB (ESDL) grammar (#8222) --- languages.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/languages.toml b/languages.toml index 8777408f9113..b23cb44895a6 100644 --- a/languages.toml +++ b/languages.toml @@ -2069,7 +2069,7 @@ roots = ["edgedb.toml"] [[grammar]] name ="esdl" -source = { git = "https://github.com/greym0uth/tree-sitter-esdl", rev = "b840c8a8028127e0a7c6e6c45141adade2bd75cf" } +source = { git = "https://github.com/greym0uth/tree-sitter-esdl", rev = "df83acc8cacd0cfb139eecee0e718dc32c4f92e2" } [[language]] name = "pascal" From b959162ceb41d891c8b5fad6145ca5d1a4964a54 Mon Sep 17 00:00:00 2001 From: Luke Halasy Date: Sun, 10 Sep 2023 08:57:44 -0400 Subject: [PATCH 02/26] Add tree-sitter-highlight-name command (#8170) * adds treesitter-highlight-name command * commit documentation changes * moves the get_highlight_name function into core/syntax * rename get_highlight_name function to get_highlight_for_node_at_position * addresses pr comments: moves fn into helper fn, simplifies a lot * commit updated documentation changes * changes scope method to return &str so that callers can decide whether or not to own --- book/src/generated/typable-cmd.md | 1 + helix-term/src/commands/typed.rs | 85 +++++++++++++++++++++++++++++++ helix-view/src/theme.rs | 5 ++ 3 files changed, 91 insertions(+) diff --git a/book/src/generated/typable-cmd.md b/book/src/generated/typable-cmd.md index 4a6e697aeca1..4b737893d465 100644 --- a/book/src/generated/typable-cmd.md +++ b/book/src/generated/typable-cmd.md @@ -55,6 +55,7 @@ | `:lsp-restart` | Restarts the language servers used by the current doc | | `:lsp-stop` | Stops the language servers that are used by the current doc | | `:tree-sitter-scopes` | Display tree sitter scopes, primarily for theming and development. | +| `:tree-sitter-highlight-name` | Display name of tree-sitter highlight scope under the cursor. | | `: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. | | `:debug-eval` | Evaluate expression in current debug context. | diff --git a/helix-term/src/commands/typed.rs b/helix-term/src/commands/typed.rs index ef539180d289..4237b6f620bc 100644 --- a/helix-term/src/commands/typed.rs +++ b/helix-term/src/commands/typed.rs @@ -1527,6 +1527,84 @@ fn tree_sitter_scopes( Ok(()) } +fn tree_sitter_highlight_name( + cx: &mut compositor::Context, + _args: &[Cow], + event: PromptEvent, +) -> anyhow::Result<()> { + fn find_highlight_at_cursor( + cx: &mut compositor::Context<'_>, + ) -> Option { + use helix_core::syntax::HighlightEvent; + + let (view, doc) = current!(cx.editor); + let syntax = doc.syntax()?; + let text = doc.text().slice(..); + let cursor = doc.selection(view.id).primary().cursor(text); + let byte = text.char_to_byte(cursor); + let node = syntax + .tree() + .root_node() + .descendant_for_byte_range(byte, byte)?; + // Query the same range as the one used in syntax highlighting. + let range = { + // Calculate viewport byte ranges: + let row = text.char_to_line(view.offset.anchor.min(text.len_chars())); + // Saturating subs to make it inclusive zero indexing. + let last_line = text.len_lines().saturating_sub(1); + let height = view.inner_area(doc).height; + let last_visible_line = (row + height as usize).saturating_sub(1).min(last_line); + let start = text.line_to_byte(row.min(last_line)); + let end = text.line_to_byte(last_visible_line + 1); + + start..end + }; + + let mut highlight = None; + + for event in syntax.highlight_iter(text, Some(range), None) { + match event.unwrap() { + HighlightEvent::Source { start, end } + if start == node.start_byte() && end == node.end_byte() => + { + return highlight; + } + HighlightEvent::HighlightStart(hl) => { + highlight = Some(hl); + } + _ => (), + } + } + + None + } + + if event != PromptEvent::Validate { + return Ok(()); + } + + let Some(highlight) = find_highlight_at_cursor(cx) else { + return Ok(()); + }; + + let content = cx.editor.theme.scope(highlight.0).to_string(); + + let callback = async move { + let call: job::Callback = Callback::EditorCompositor(Box::new( + move |editor: &mut Editor, compositor: &mut Compositor| { + let content = ui::Markdown::new(content, editor.syn_loader.clone()); + let popup = Popup::new("hover", content).auto_close(true); + compositor.replace_or_push("hover", popup); + }, + )); + Ok(call) + }; + + cx.jobs.callback(callback); + + Ok(()) +} + fn vsplit( cx: &mut compositor::Context, args: &[Cow], @@ -2703,6 +2781,13 @@ pub const TYPABLE_COMMAND_LIST: &[TypableCommand] = &[ fun: tree_sitter_scopes, signature: CommandSignature::none(), }, + TypableCommand { + name: "tree-sitter-highlight-name", + aliases: &[], + doc: "Display name of tree-sitter highlight scope under the cursor.", + fun: tree_sitter_highlight_name, + signature: CommandSignature::none(), + }, TypableCommand { name: "debug-start", aliases: &["dbg"], diff --git a/helix-view/src/theme.rs b/helix-view/src/theme.rs index a288ae9aa8bb..4acc56648aa0 100644 --- a/helix-view/src/theme.rs +++ b/helix-view/src/theme.rs @@ -297,6 +297,11 @@ impl Theme { self.highlights[index] } + #[inline] + pub fn scope(&self, index: usize) -> &str { + &self.scopes[index] + } + pub fn name(&self) -> &str { &self.name } From 0d986fce76f2089322d07b4b37b7914c826713cc Mon Sep 17 00:00:00 2001 From: Ross Manchester <33374742+rossmanch@users.noreply.github.com> Date: Sun, 10 Sep 2023 19:53:15 +0100 Subject: [PATCH 03/26] chore: add additional ignore file highlights (#8220) * chore: add additional ignore file highlights Various files use the same syntax highlighting as `.gitignore` and similarly tell different tools what files/folders to ignore. Update the languages file so that other ignore type files use the same highlighting as gitignore. The files added are: - `.ignore` - `.prettierignore` - `.eslintignore` - `.npmignore` * chore: add highlighting for codeowners files Add `CODEOWNERS` as an additional file type for `git-ignore` in the language file. `CODEOWNERS`'s grammar is close enough to that of `.gitignore`, this can be used to avoid making a new grammar specifically for `CODEOWNERS` files. --- languages.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/languages.toml b/languages.toml index b23cb44895a6..d9cf7ef2c391 100644 --- a/languages.toml +++ b/languages.toml @@ -1380,7 +1380,7 @@ source = { git = "https://github.com/mtoohey31/tree-sitter-gitattributes", rev = name = "git-ignore" scope = "source.gitignore" roots = [] -file-types = [".gitignore", ".gitignore_global"] +file-types = [".gitignore", ".gitignore_global", ".ignore", ".prettierignore", ".eslintignore", ".npmignore", "CODEOWNERS"] injection-regex = "git-ignore" comment-token = "#" grammar = "gitignore" From 829db76563be3c7aec71ba3602b20bbbfa75f078 Mon Sep 17 00:00:00 2001 From: Alexis Mousset Date: Sun, 10 Sep 2023 20:54:34 +0200 Subject: [PATCH 04/26] Add feed-related formats as xml (#8232) --- languages.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/languages.toml b/languages.toml index d9cf7ef2c391..3e3c5a5a251d 100644 --- a/languages.toml +++ b/languages.toml @@ -2202,7 +2202,7 @@ source = { git = "https://github.com/Unoqwy/tree-sitter-kdl", rev = "e1cd292c6d1 name = "xml" scope = "source.xml" injection-regex = "xml" -file-types = ["xml", "mobileconfig", "plist", "xib", "storyboard", "svg", "xsd", "gml", "xaml", "gir"] +file-types = ["xml", "mobileconfig", "plist", "xib", "storyboard", "svg", "xsd", "gml", "xaml", "gir", "rss", "atom", "opml"] indent = { tab-width = 2, unit = " " } roots = [] From 81d6d3ff0eace62481863b7957b5ccc52b1c6718 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Sun, 10 Sep 2023 15:27:04 -0400 Subject: [PATCH 05/26] re-add indent and textobject queries for perl (#7947) * bump tree-sitter-perl version need some grammar tweaks for the indent queries to function properly * add indent queries for perl * add textobject queries for perl --- book/src/generated/lang-support.md | 2 +- languages.toml | 2 +- runtime/queries/perl/indents.scm | 29 ++++++++++++++++++++++++++++ runtime/queries/perl/textobjects.scm | 14 ++++++++++++++ 4 files changed, 45 insertions(+), 2 deletions(-) create mode 100644 runtime/queries/perl/indents.scm create mode 100644 runtime/queries/perl/textobjects.scm diff --git a/book/src/generated/lang-support.md b/book/src/generated/lang-support.md index 596b62babdae..c1b0acfdbd69 100644 --- a/book/src/generated/lang-support.md +++ b/book/src/generated/lang-support.md @@ -112,7 +112,7 @@ | pascal | ✓ | ✓ | | `pasls` | | passwd | ✓ | | | | | pem | ✓ | | | | -| perl | ✓ | | | `perlnavigator` | +| perl | ✓ | ✓ | ✓ | `perlnavigator` | | php | ✓ | ✓ | ✓ | `intelephense` | | po | ✓ | ✓ | | | | pod | ✓ | | | | diff --git a/languages.toml b/languages.toml index 3e3c5a5a251d..4d1e6fe0a51d 100644 --- a/languages.toml +++ b/languages.toml @@ -1119,7 +1119,7 @@ indent = { tab-width = 2, unit = " " } [[grammar]] name = "perl" -source = { git = "https://github.com/tree-sitter-perl/tree-sitter-perl", rev = "ed21ecbcc128a6688770ebafd3ef68a1c9bc1ea9" } +source = { git = "https://github.com/tree-sitter-perl/tree-sitter-perl", rev = "9f3166800d40267fa68ed8273e96baf74f390517" } [[language]] name = "pod" diff --git a/runtime/queries/perl/indents.scm b/runtime/queries/perl/indents.scm new file mode 100644 index 000000000000..03318243bd12 --- /dev/null +++ b/runtime/queries/perl/indents.scm @@ -0,0 +1,29 @@ +[ + (block) + (conditional_statement) + (loop_statement) + (cstyle_for_statement) + (for_statement) + (elsif) + (array_element_expression) + (hash_element_expression) + (coderef_call_expression) + (anonymous_slice_expression) + (slice_expression) + (keyval_expression) + (anonymous_array_expression) + (anonymous_hash_expression) + (stub_expression) + (func0op_call_expression) + (func1op_call_expression) + (map_grep_expression) + (function_call_expression) + (method_call_expression) + (attribute) +] @indent + +[ + "}" + "]" + ")" +] @outdent diff --git a/runtime/queries/perl/textobjects.scm b/runtime/queries/perl/textobjects.scm new file mode 100644 index 000000000000..1b0b5f076c24 --- /dev/null +++ b/runtime/queries/perl/textobjects.scm @@ -0,0 +1,14 @@ +(subroutine_declaration_statement + body: (_) @function.inside) @function.around +(anonymous_subroutine_expression + body: (_) @function.inside) @function.around + +(package_statement) @class.around +(package_statement + (block) @class.inside) + +(list_expression + (_) @parameter.inside) + +(comment) @comment.around +(pod) @comment.around From 6f3a6575dc9f4f9390cdfa5b56f5a0d182775ca2 Mon Sep 17 00:00:00 2001 From: Yhya <113423953+yhyadev@users.noreply.github.com> Date: Sun, 10 Sep 2023 19:27:56 +0000 Subject: [PATCH 06/26] add material theme collection (#8211) * Create material theme files * Add material deep ocean pallete * Add primary theme properties to material deep ocean theme * Fix material deep ocean theme * Ad syntax highlighting to material deep ocean theme * Make material oceanic theme * Make material darker theme * Remove material lighter theme * Make material palenight theme * Make other material themes inherit material deep ocean theme * Add virtual ruler background to the material theme collection --- runtime/themes/material_darker.toml | 20 ++++ runtime/themes/material_deep_ocean.toml | 123 ++++++++++++++++++++++++ runtime/themes/material_oceanic.toml | 21 ++++ runtime/themes/material_palenight.toml | 19 ++++ 4 files changed, 183 insertions(+) create mode 100644 runtime/themes/material_darker.toml create mode 100644 runtime/themes/material_deep_ocean.toml create mode 100644 runtime/themes/material_oceanic.toml create mode 100644 runtime/themes/material_palenight.toml diff --git a/runtime/themes/material_darker.toml b/runtime/themes/material_darker.toml new file mode 100644 index 000000000000..f117f7194078 --- /dev/null +++ b/runtime/themes/material_darker.toml @@ -0,0 +1,20 @@ +# Material Theme for Helix Editor + +inherits = "material_deep_ocean" + +[palette] +bg = "#212121" +text = "#b0bec5" + +gray = "#616161" +error = "#ff5370" + +disabled = "#474747" + +accent = "#ff9800" + +highlight = "#3f3f3f" + +comment = "#616161" + +selection = "#404040" diff --git a/runtime/themes/material_deep_ocean.toml b/runtime/themes/material_deep_ocean.toml new file mode 100644 index 000000000000..b98a32e559b0 --- /dev/null +++ b/runtime/themes/material_deep_ocean.toml @@ -0,0 +1,123 @@ +# Material Theme for Helix Editor + +# Syntax Highlighting + +"type" = "purple" + +"constructor" = "blue" + +"constant" = "yellow" + +"string" = "green" +"string.regexp" = "yellow" +"string.special" = "blue" + +"comment" = { fg = "comment" } + +"variable" = "text" +"variable.parameter" = { fg = "orange" } +"variable.builtin" = "yellow" + +"label" = "orange" + +"punctuation" = "cyan" + +"keyword" = "purple" +"keyword.storage" = "cyan" + +"operator" = "cyan" + +"function" = "blue" +"function.macro" = "cyan" + +"tag" = "red" +"attribute" = "purple" + +"namespace" = { fg = "yellow" } + +"special" = "cyan" + +"markup.heading.marker" = { fg = "cyan", modifiers = ["bold"] } +"markup.heading.1" = "cyan" +"markup.heading.2" = "red" +"markup.heading.3" = "green" +"markup.heading.4" = "yellow" +"markup.heading.5" = "blue" +"markup.heading.6" = "orange" +"markup.list" = "purple" +"markup.bold" = { modifiers = ["bold"] } +"markup.italic" = { modifiers = ["italic"] } +"markup.strikethrough" = { modifiers = ["crossed_out"] } +"markup.link.url" = { fg = "green", modifiers = ["underlined"] } +"markup.link.text" = "blue" +"markup.raw" = "text" + +"diff.plus" = "green" +"diff.minus" = "red" +"diff.delta" = "blue" + +# User Interface + +"ui.background" = { bg = "bg", fg = "text" } +"ui.text" = { fg = "text" } + +"ui.statusline" = { bg = "bg", fg = "text" } +"ui.statusline.inactive" = { bg = "bg", fg = "disabled" } +"ui.statusline.normal" = { bg = "accent", fg = "text" } +"ui.statusline.insert" = { bg = "green", fg = "text" } +"ui.statusline.select" = { bg = "purple", fg = "text" } + + +"ui.selection" = { bg = "selection" } + +"ui.linenr" = { fg = "line-number" } +"ui.linenr.selected" = { fg = "accent" } + +"ui.cursor" = { bg = "highlight", fg = "white" } + +"ui.cursor.primary" = { bg = "white", fg = "gray" } +"ui.cursorline.primary" = { bg = "white" } + +"ui.virtual" = { fg = "gray" } +"ui.virtual.ruler" = { bg = "highlight" } +"ui.virtual.indent-guide" = { fg = "gray" } + +"ui.highlight" = { bg = "highlight" } + +"ui.menu" = { bg = "highlight", fg = "text" } + +"ui.help" = { bg = "highlight", fg = "text" } + +"ui.popup" = { bg = "highlight", fg = "text" } + +warning = "yellow" +error = "error" +info = "blue" +hint = "purple" + +[palette] +bg = "#0f111a" +text = "#a6accd" + +white = "#eeffff" +green = "#c3e88d" +yellow = "#ffcb6b" +blue = "#82aaff" +red = "#f07178" +purple = "#c792ea" +orange = "#f78c6c" +cyan = "#89ddff" +gray = "#717cb4" +error = "#ff5370" + +disabled = "#464b5d" + +accent = "#84ffff" + +highlight = "#1f2233" + +comment = "#464b5d" + +selection = "#1f2233" + +line-number = "#3b3f51" diff --git a/runtime/themes/material_oceanic.toml b/runtime/themes/material_oceanic.toml new file mode 100644 index 000000000000..ea4930d30510 --- /dev/null +++ b/runtime/themes/material_oceanic.toml @@ -0,0 +1,21 @@ +# Material Theme for Helix Editor + +inherits = "material_deep_ocean" + +[palette] +bg = "#25363b" +text = "#b0bec5" + +gray = "#546e7a" + +disabled = "#415967" + +accent = "#009688" + +highlight = "#425b67" + +comment = "#546e7a" + +selection = "#395b65" + +line-number = "#355058" \ No newline at end of file diff --git a/runtime/themes/material_palenight.toml b/runtime/themes/material_palenight.toml new file mode 100644 index 000000000000..ef9c27e26acd --- /dev/null +++ b/runtime/themes/material_palenight.toml @@ -0,0 +1,19 @@ +# Material Theme for Helix Editor + +inherits = "material_deep_ocean" + +[palette] +bg = "#292d3e" +text = "#a6accd" + +disabled = "#515772" + +accent = "#ab47bc" + +highlight = "#444267" + +comment = "#676e95" + +selection = "#444267" + +line-number = "#3a3f58" \ No newline at end of file From 83ac53a1090e90bb36376dcf5713fac8e1cf66fd Mon Sep 17 00:00:00 2001 From: Alexis Mousset Date: Sun, 10 Sep 2023 22:31:12 +0200 Subject: [PATCH 07/26] Fix various typos (#8233) --- helix-core/src/syntax.rs | 2 +- helix-view/src/document.rs | 2 +- runtime/themes/jellybeans.toml | 2 +- runtime/themes/molokai.toml | 2 +- runtime/themes/nightfox.toml | 4 ++-- runtime/themes/noctis.toml | 6 +++--- runtime/themes/rose_pine.toml | 2 +- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/helix-core/src/syntax.rs b/helix-core/src/syntax.rs index bf167c28def1..881b45098a9e 100644 --- a/helix-core/src/syntax.rs +++ b/helix-core/src/syntax.rs @@ -962,7 +962,7 @@ impl Syntax { let res = syntax.update(source, source, &ChangeSet::new(source)); if res.is_err() { - log::error!("TS parser failed, disabeling TS for the current buffer: {res:?}"); + log::error!("TS parser failed, disabling TS for the current buffer: {res:?}"); return None; } Some(syntax) diff --git a/helix-view/src/document.rs b/helix-view/src/document.rs index 36dbbcb8bcb4..bb61eaa6aae6 100644 --- a/helix-view/src/document.rs +++ b/helix-view/src/document.rs @@ -1206,7 +1206,7 @@ impl Document { transaction.changes(), ); if res.is_err() { - log::error!("TS parser failed, disabeling TS for the current buffer: {res:?}"); + log::error!("TS parser failed, disabling TS for the current buffer: {res:?}"); self.syntax = None; } } diff --git a/runtime/themes/jellybeans.toml b/runtime/themes/jellybeans.toml index 592db9a92e7c..55088c298194 100644 --- a/runtime/themes/jellybeans.toml +++ b/runtime/themes/jellybeans.toml @@ -22,7 +22,7 @@ "constant.builtin.boolean" = "yellow" "constant.character" = "yellow" -"constant.characted.escape" = "red_error" +"constant.character.escape" = "red_error" "constant.numeric" = "dark_orange" "string" = "dark_green" "string.regexp" = "light_purple" diff --git a/runtime/themes/molokai.toml b/runtime/themes/molokai.toml index fc8e533d5e8a..2d5c9455e571 100644 --- a/runtime/themes/molokai.toml +++ b/runtime/themes/molokai.toml @@ -13,7 +13,7 @@ inherits = "monokai" "keyword.storage.modifier" = { fg = "#fd971f", modifiers = ["italic"] } "label" = "#e6db74" "operator" = "keyword" -"punctuation.delimeter" = "#8f8f8f" +"punctuation.delimiter" = "#8f8f8f" "type" = "light-blue" "variable.builtin" = { fg = "#ae81ff", modifiers = ["bold"] } "tag.builtin" = { fg = "#ae81ff", modifiers = ["bold"] } diff --git a/runtime/themes/nightfox.toml b/runtime/themes/nightfox.toml index 069b32ab4d33..6c5ed3501f93 100644 --- a/runtime/themes/nightfox.toml +++ b/runtime/themes/nightfox.toml @@ -125,7 +125,7 @@ "keyword.control.exception" = { fg = "magenta" } # `try`, `catch`, `raise`/`throw` and related. "keyword.operator" = { fg = "fg2", modifiers = ["bold"] } # 'or', 'and', 'in'. "keyword.directive" = { fg = "pink-bright" } # Preprocessor directives (#if in C...). -"keyword.function" = { fg = "red" } # The keyword to define a funtion: 'def', 'fun', 'fn'. +"keyword.function" = { fg = "red" } # The keyword to define a function: 'def', 'fun', 'fn'. "keyword.storage" = { fg = "magenta" } # Keywords describing how things are stored "keyword.storage.type" = { fg = "magenta" } # The type of something, class, function, var, let, etc. "keyword.storage.modifier" = { fg = "yellow" } # Storage modifiers like static, mut, const, ref, etc. @@ -183,6 +183,6 @@ bg4 = "#39506d" # Conceal, border fg fg0 = "#d6d6d7" # Lighter fg fg1 = "#cdcecf" # Default fg fg2 = "#aeafb0" # Darker fg (status line) -fg3 = "#71839b" # Darker fg (line numbers, fold colums) +fg3 = "#71839b" # Darker fg (line numbers, fold columns) sel0 = "#2b3b51" # Popup bg, visual selection bg sel1 = "#3c5372" # Popup sel bg, search bg diff --git a/runtime/themes/noctis.toml b/runtime/themes/noctis.toml index c7d33680ea3a..f4c2d5b5a0a5 100644 --- a/runtime/themes/noctis.toml +++ b/runtime/themes/noctis.toml @@ -100,14 +100,14 @@ 'variable' = { fg = "white" } # Variable names. 'variable.builtin' = { } # Language reserved variables: `this`, `self`, `super`, etc. -'variable.parameter' = { } # Funtion parameters. +'variable.parameter' = { } # Function parameters. 'variable.other.member' = { } # Fields of composite data types (e.g. structs, unions). 'variable.function' = { } # ? 'label' = { fg = "purple" } # Loop labels in rust. 'punctuation' = { fg = "yellow", modifiers = ["bold"] } # (){}[]:;,. -# 'punctuation.delimeter' = { fg = "yellow" } # Commas and colons. +# 'punctuation.delimiter' = { fg = "yellow" } # Commas and colons. # 'punctuation.bracket' = { fg = "yellow" } # Parentheses, angle brackets, etc. 'keyword' = { fg = "pink", modifiers = ["bold"] } # Language reserved keywords. @@ -119,7 +119,7 @@ 'keyword.control.exception' = {fg = "pink", modifiers = ["bold"] } # 'raise' in python. 'keyword.operator' = { } # 'or', 'and', 'in'. 'keyword.directive' = { fg = "purple" } # Preprocessor directives (#if in C). -'keyword.function' = { } # The keyword to define a funtion: 'def', 'fun', 'fn'. +'keyword.function' = { } # The keyword to define a function: 'def', 'fun', 'fn'. 'operator' = { fg = "pink", modifiers = ["bold"] } # Logical (&&, ||) and - I assume - Mathematical (+, %) operators diff --git a/runtime/themes/rose_pine.toml b/runtime/themes/rose_pine.toml index e1d968941b52..4bbf219ed09e 100644 --- a/runtime/themes/rose_pine.toml +++ b/runtime/themes/rose_pine.toml @@ -89,7 +89,7 @@ "comment" = { fg = "muted", modifiers = ["italic"]} # "comment.line" = "" # "comment.block" = "" -# "comment.block.documenation" = "" +# "comment.block.documentation" = "" "variable" = "text" "variable.builtin" = "love" From acef759a5e2e4dab46d037efab8775912639e229 Mon Sep 17 00:00:00 2001 From: Galen Abell Date: Sun, 10 Sep 2023 22:49:28 +0200 Subject: [PATCH 08/26] Add additional YAML injections (#8217) --- runtime/queries/yaml/injections.scm | 52 +++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/runtime/queries/yaml/injections.scm b/runtime/queries/yaml/injections.scm index 321c90add371..52b437a4ec20 100644 --- a/runtime/queries/yaml/injections.scm +++ b/runtime/queries/yaml/injections.scm @@ -1,2 +1,54 @@ ((comment) @injection.content (#set! injection.language "comment")) + +; The remaining code in this file incorporates work covered by the following +; copyright and permission notice: +; +; Copyright 2023 the nvim-treesitter authors +; +; Licensed under the Apache License, Version 2.0 (the "License"); +; you may not use this file except in compliance with the License. +; You may obtain a copy of the License at +; +; http://www.apache.org/licenses/LICENSE-2.0 +; +; Unless required by applicable law or agreed to in writing, software +; distributed under the License is distributed on an "AS IS" BASIS, +; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +; See the License for the specific language governing permissions and +; limitations under the License. + +; Modified for Helix from https://github.com/nvim-treesitter/nvim-treesitter/blob/master/queries/yaml/injections.scm + +;; Github actions ("run") / Gitlab CI ("scripts") +(block_mapping_pair + key: (flow_node) @_run (#match? @_run "^(run|script|before_script|after_script)$") + value: (flow_node + (plain_scalar + (string_scalar) @injection.content) + (#set! injection.language "bash"))) + +(block_mapping_pair + key: (flow_node) @_run (#match? @_run "^(run|script|before_script|after_script)$") + value: (block_node + (block_scalar) @injection.content + (#set! injection.language "bash"))) + +(block_mapping_pair + key: (flow_node) @_run (#match? @_run "^(run|script|before_script|after_script)$") + value: (block_node + (block_sequence + (block_sequence_item + (flow_node + (plain_scalar + (string_scalar) @injection.content)) + (#set! injection.language "bash"))))) + +(block_mapping_pair + key: (flow_node) @_run (#match? @_run "^(run|script|before_script|after_script)$") + value: (block_node + (block_sequence + (block_sequence_item + (block_node + (block_scalar) @injection.content + (#set! injection.language "bash")))))) From 060e73a7110fe38cc6ed30ca0cc3abc686e225fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bla=C5=BE=20Hrastnik?= Date: Mon, 11 Sep 2023 13:14:41 +0900 Subject: [PATCH 09/26] Lower idle-timeout to 250ms The aim is to make it slow enough it only triggers during a typing pause, but not too slow. Initial value was chosen as a safe slow default but I've been using 250 for a while. --- helix-view/src/editor.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/helix-view/src/editor.rs b/helix-view/src/editor.rs index 86f35e0db7bd..6963867af6b1 100644 --- a/helix-view/src/editor.rs +++ b/helix-view/src/editor.rs @@ -244,7 +244,7 @@ pub struct Config { /// Set a global text_width pub text_width: usize, /// Time in milliseconds since last keypress before idle timers trigger. - /// Used for autocompletion, set to 0 for instant. Defaults to 400ms. + /// Used for autocompletion, set to 0 for instant. Defaults to 250ms. #[serde( serialize_with = "serialize_duration_millis", deserialize_with = "deserialize_duration_millis" @@ -817,7 +817,7 @@ impl Default for Config { auto_completion: true, auto_format: true, auto_save: false, - idle_timeout: Duration::from_millis(400), + idle_timeout: Duration::from_millis(250), preview_completion_insert: true, completion_trigger_len: 2, auto_info: true, From 95e994ab3817b3803f0d25b10423de4ef74508d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bla=C5=BE=20Hrastnik?= Date: Mon, 11 Sep 2023 13:15:45 +0900 Subject: [PATCH 10/26] Add more shebangs to languages --- languages.toml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/languages.toml b/languages.toml index 4d1e6fe0a51d..85cc95d40b08 100644 --- a/languages.toml +++ b/languages.toml @@ -587,7 +587,7 @@ scope = "source.ts" injection-regex = "(ts|typescript)" file-types = ["ts", "mts", "cts"] language-id = "typescript" -shebangs = [] +shebangs = ["deno", "ts-node"] roots = [] language-servers = [ "typescript-language-server" ] indent = { tab-width = 2, unit = " " } @@ -821,6 +821,7 @@ name = "julia" scope = "source.julia" injection-regex = "julia" file-types = ["jl"] +shebangs = ["julia"] roots = ["Manifest.toml", "Project.toml"] comment-token = "#" language-servers = [ "julia" ] @@ -834,7 +835,7 @@ source = { git = "https://github.com/tree-sitter/tree-sitter-julia", rev = "8fb3 name = "java" scope = "source.java" injection-regex = "java" -file-types = ["java"] +file-types = ["java", "jav"] roots = ["pom.xml", "build.gradle", "build.gradle.kts"] language-servers = [ "jdtls" ] indent = { tab-width = 2, unit = " " } @@ -874,7 +875,7 @@ name = "ocaml" scope = "source.ocaml" injection-regex = "ocaml" file-types = ["ml"] -shebangs = [] +shebangs = ["ocaml", "ocamlrun", "ocamlscript"] roots = [] comment-token = "(**)" language-servers = [ "ocamllsp" ] @@ -1824,6 +1825,7 @@ name = "scheme" scope = "source.scheme" injection-regex = "scheme" file-types = ["ss", "scm"] +shebangs = ["scheme", "guile", "chicken"] roots = [] comment-token = ";" indent = { tab-width = 2, unit = " " } From ef23847957463b95a68599efb12a32837d73727b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bla=C5=BE=20Hrastnik?= Date: Mon, 11 Sep 2023 13:15:58 +0900 Subject: [PATCH 11/26] scheme: Highlight abbreviations --- runtime/queries/scheme/highlights.scm | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/runtime/queries/scheme/highlights.scm b/runtime/queries/scheme/highlights.scm index 468193745d93..c7050847fae8 100644 --- a/runtime/queries/scheme/highlights.scm +++ b/runtime/queries/scheme/highlights.scm @@ -97,3 +97,8 @@ ["(" ")" "[" "]" "{" "}"] @punctuation.bracket +(quote "'") @operator +(unquote_splicing ",@") @operator +(unquote ",") @operator +(quasiquote "`") @operator + From 7090555daba6bce37dc6cc900387015a10a1e791 Mon Sep 17 00:00:00 2001 From: Em Zhan Date: Mon, 11 Sep 2023 19:06:25 -0500 Subject: [PATCH 12/26] Add `insert-final-newline` config option (#8157) Co-authored-by: Xalfer <64538944+Xalfer@users.noreply.github.com> --- book/src/configuration.md | 1 + helix-term/src/commands/typed.rs | 70 ++++++++----- helix-term/tests/test/commands/write.rs | 125 +++++++++++++++++++++++- helix-term/tests/test/helpers.rs | 2 +- helix-term/tests/test/splits.rs | 6 +- helix-view/src/editor.rs | 3 + 6 files changed, 173 insertions(+), 34 deletions(-) diff --git a/book/src/configuration.md b/book/src/configuration.md index eb2cf473cffd..3b78481e3103 100644 --- a/book/src/configuration.md +++ b/book/src/configuration.md @@ -64,6 +64,7 @@ Its settings will be merged with the configuration directory `config.toml` and t | `text-width` | Maximum line length. Used for the `:reflow` command and soft-wrapping if `soft-wrap.wrap-at-text-width` is set | `80` | | `workspace-lsp-roots` | Directories relative to the workspace root that are treated as LSP roots. Should only be set in `.helix/config.toml` | `[]` | | `default-line-ending` | The line ending to use for new documents. Can be `native`, `lf`, `crlf`, `ff`, `cr` or `nel`. `native` uses the platform's native line ending (`crlf` on Windows, otherwise `lf`). | `native` | +| `insert-final-newline` | Whether to automatically insert a trailing line-ending on write if missing | `true` | ### `[editor.statusline]` Section diff --git a/helix-term/src/commands/typed.rs b/helix-term/src/commands/typed.rs index 4237b6f620bc..abe6dd97ec89 100644 --- a/helix-term/src/commands/typed.rs +++ b/helix-term/src/commands/typed.rs @@ -6,7 +6,7 @@ use crate::job::Job; use super::*; use helix_core::fuzzy::fuzzy_match; -use helix_core::{encoding, shellwords::Shellwords}; +use helix_core::{encoding, line_ending, shellwords::Shellwords}; use helix_view::document::DEFAULT_LANGUAGE_NAME; use helix_view::editor::{Action, CloseError, ConfigEvent}; use serde_json::Value; @@ -330,12 +330,16 @@ fn write_impl( path: Option<&Cow>, force: bool, ) -> anyhow::Result<()> { - let editor_auto_fmt = cx.editor.config().auto_format; + let config = cx.editor.config(); let jobs = &mut cx.jobs; let (view, doc) = current!(cx.editor); let path = path.map(AsRef::as_ref); - let fmt = if editor_auto_fmt { + if config.insert_final_newline { + insert_final_newline(doc, view); + } + + let fmt = if config.auto_format { doc.auto_format().map(|fmt| { let callback = make_format_callback( doc.id(), @@ -359,6 +363,16 @@ fn write_impl( Ok(()) } +fn insert_final_newline(doc: &mut Document, view: &mut View) { + let text = doc.text(); + if line_ending::get_line_ending(&text.slice(..)).is_none() { + let eof = Selection::point(text.len_chars()); + let insert = Transaction::insert(text, &eof, doc.line_ending.as_str().into()); + doc.apply(&insert, view.id); + doc.append_changes_to_history(view); + } +} + fn write( cx: &mut compositor::Context, args: &[Cow], @@ -658,11 +672,10 @@ pub fn write_all_impl( write_scratch: bool, ) -> anyhow::Result<()> { let mut errors: Vec<&'static str> = Vec::new(); - let auto_format = cx.editor.config().auto_format; + let config = cx.editor.config(); let jobs = &mut cx.jobs; let current_view = view!(cx.editor); - // save all documents let saves: Vec<_> = cx .editor .documents @@ -693,32 +706,35 @@ pub fn write_all_impl( current_view.id }; - let fmt = if auto_format { - doc.auto_format().map(|fmt| { - let callback = make_format_callback( - doc.id(), - doc.version(), - target_view, - fmt, - Some((None, force)), - ); - jobs.add(Job::with_callback(callback).wait_before_exiting()); - }) - } else { - None - }; + Some((doc.id(), target_view)) + }) + .collect(); - if fmt.is_none() { - return Some(doc.id()); - } + for (doc_id, target_view) in saves { + let doc = doc_mut!(cx.editor, &doc_id); + if config.insert_final_newline { + insert_final_newline(doc, view_mut!(cx.editor, target_view)); + } + + let fmt = if config.auto_format { + doc.auto_format().map(|fmt| { + let callback = make_format_callback( + doc_id, + doc.version(), + target_view, + fmt, + Some((None, force)), + ); + jobs.add(Job::with_callback(callback).wait_before_exiting()); + }) + } else { None - }) - .collect(); + }; - // manually call save for the rest of docs that don't have a formatter - for id in saves { - cx.editor.save::(id, None, force)?; + if fmt.is_none() { + cx.editor.save::(doc_id, None, force)?; + } } if !errors.is_empty() && !force { diff --git a/helix-term/tests/test/commands/write.rs b/helix-term/tests/test/commands/write.rs index f33c8aaf6fd9..376ba5e7b1e7 100644 --- a/helix-term/tests/test/commands/write.rs +++ b/helix-term/tests/test/commands/write.rs @@ -93,7 +93,7 @@ async fn test_buffer_close_concurrent() -> anyhow::Result<()> { ) .await?; - helpers::assert_file_has_content(file.as_file_mut(), &RANGE.end().to_string())?; + helpers::assert_file_has_content(file.as_file_mut(), &platform_line(&RANGE.end().to_string()))?; Ok(()) } @@ -209,7 +209,7 @@ async fn test_write_concurrent() -> anyhow::Result<()> { let mut file_content = String::new(); file.as_file_mut().read_to_string(&mut file_content)?; - assert_eq!(RANGE.end().to_string(), file_content); + assert_eq!(platform_line(&RANGE.end().to_string()), file_content); Ok(()) } @@ -424,13 +424,132 @@ async fn test_write_utf_bom_file() -> anyhow::Result<()> { Ok(()) } +#[tokio::test(flavor = "multi_thread")] +async fn test_write_insert_final_newline_added_if_missing() -> anyhow::Result<()> { + let mut file = tempfile::NamedTempFile::new()?; + let mut app = helpers::AppBuilder::new() + .with_file(file.path(), None) + .with_input_text("#[h|]#ave you tried chamomile tea?") + .build()?; + + test_key_sequence(&mut app, Some(":w"), None, false).await?; + + helpers::assert_file_has_content( + file.as_file_mut(), + &helpers::platform_line("have you tried chamomile tea?\n"), + )?; + + Ok(()) +} + +#[tokio::test(flavor = "multi_thread")] +async fn test_write_insert_final_newline_unchanged_if_not_missing() -> anyhow::Result<()> { + let mut file = tempfile::NamedTempFile::new()?; + let mut app = helpers::AppBuilder::new() + .with_file(file.path(), None) + .with_input_text(&helpers::platform_line("#[t|]#en minutes, please\n")) + .build()?; + + test_key_sequence(&mut app, Some(":w"), None, false).await?; + + helpers::assert_file_has_content( + file.as_file_mut(), + &helpers::platform_line("ten minutes, please\n"), + )?; + + Ok(()) +} + +#[tokio::test(flavor = "multi_thread")] +async fn test_write_insert_final_newline_unchanged_if_missing_and_false() -> anyhow::Result<()> { + let mut file = tempfile::NamedTempFile::new()?; + let mut app = helpers::AppBuilder::new() + .with_config(Config { + editor: helix_view::editor::Config { + insert_final_newline: false, + ..Default::default() + }, + ..Default::default() + }) + .with_file(file.path(), None) + .with_input_text("#[t|]#he quiet rain continued through the night") + .build()?; + + test_key_sequence(&mut app, Some(":w"), None, false).await?; + + helpers::assert_file_has_content( + file.as_file_mut(), + "the quiet rain continued through the night", + )?; + + Ok(()) +} + +#[tokio::test(flavor = "multi_thread")] +async fn test_write_all_insert_final_newline_add_if_missing_and_modified() -> anyhow::Result<()> { + let mut file1 = tempfile::NamedTempFile::new()?; + let mut file2 = tempfile::NamedTempFile::new()?; + let mut app = helpers::AppBuilder::new() + .with_file(file1.path(), None) + .with_input_text("#[w|]#e don't serve time travelers here") + .build()?; + + test_key_sequence( + &mut app, + Some(&format!( + ":o {}ia time traveler walks into a bar:wa", + file2.path().to_string_lossy() + )), + None, + false, + ) + .await?; + + helpers::assert_file_has_content( + file1.as_file_mut(), + &helpers::platform_line("we don't serve time travelers here\n"), + )?; + + helpers::assert_file_has_content( + file2.as_file_mut(), + &helpers::platform_line("a time traveler walks into a bar\n"), + )?; + + Ok(()) +} + +#[tokio::test(flavor = "multi_thread")] +async fn test_write_all_insert_final_newline_do_not_add_if_unmodified() -> anyhow::Result<()> { + let mut file = tempfile::NamedTempFile::new()?; + let mut app = helpers::AppBuilder::new() + .with_file(file.path(), None) + .build()?; + + file.write_all(b"i lost on Jeopardy!")?; + file.rewind()?; + + test_key_sequence(&mut app, Some(":wa"), None, false).await?; + + helpers::assert_file_has_content(file.as_file_mut(), "i lost on Jeopardy!")?; + + Ok(()) +} + async fn edit_file_with_content(file_content: &[u8]) -> anyhow::Result<()> { let mut file = tempfile::NamedTempFile::new()?; file.as_file_mut().write_all(&file_content)?; helpers::test_key_sequence( - &mut helpers::AppBuilder::new().build()?, + &mut helpers::AppBuilder::new() + .with_config(Config { + editor: helix_view::editor::Config { + insert_final_newline: false, + ..Default::default() + }, + ..Default::default() + }) + .build()?, Some(&format!(":o {}:x", file.path().to_string_lossy())), None, true, diff --git a/helix-term/tests/test/helpers.rs b/helix-term/tests/test/helpers.rs index 6466bc764bbe..e6762baf9c6d 100644 --- a/helix-term/tests/test/helpers.rs +++ b/helix-term/tests/test/helpers.rs @@ -350,7 +350,7 @@ pub fn assert_file_has_content(file: &mut File, content: &str) -> anyhow::Result let mut file_content = String::new(); file.read_to_string(&mut file_content)?; - assert_eq!(content, file_content); + assert_eq!(file_content, content); Ok(()) } diff --git a/helix-term/tests/test/splits.rs b/helix-term/tests/test/splits.rs index 1d70f24a6dac..f010c86ba4ab 100644 --- a/helix-term/tests/test/splits.rs +++ b/helix-term/tests/test/splits.rs @@ -62,9 +62,9 @@ async fn test_split_write_quit_all() -> anyhow::Result<()> { ) .await?; - helpers::assert_file_has_content(file1.as_file_mut(), "hello1")?; - helpers::assert_file_has_content(file2.as_file_mut(), "hello2")?; - helpers::assert_file_has_content(file3.as_file_mut(), "hello3")?; + helpers::assert_file_has_content(file1.as_file_mut(), &platform_line("hello1"))?; + helpers::assert_file_has_content(file2.as_file_mut(), &platform_line("hello2"))?; + helpers::assert_file_has_content(file3.as_file_mut(), &platform_line("hello3"))?; Ok(()) } diff --git a/helix-view/src/editor.rs b/helix-view/src/editor.rs index 6963867af6b1..2265633dfced 100644 --- a/helix-view/src/editor.rs +++ b/helix-view/src/editor.rs @@ -287,6 +287,8 @@ pub struct Config { pub workspace_lsp_roots: Vec, /// Which line ending to choose for new documents. Defaults to `native`. i.e. `crlf` on Windows, otherwise `lf`. pub default_line_ending: LineEndingConfig, + /// Whether to automatically insert a trailing line-ending on write if missing. Defaults to `true`. + pub insert_final_newline: bool, /// Enables smart tab pub smart_tab: Option, } @@ -842,6 +844,7 @@ impl Default for Config { completion_replace: false, workspace_lsp_roots: Vec::new(), default_line_ending: LineEndingConfig::default(), + insert_final_newline: true, smart_tab: Some(SmartTabConfig::default()), } } From a8449afbfeb357bc140eb0666ef1efaf3555c4dc Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 11 Sep 2023 19:09:27 -0500 Subject: [PATCH 13/26] build(deps): bump thiserror from 1.0.47 to 1.0.48 (#8252) Bumps [thiserror](https://github.com/dtolnay/thiserror) from 1.0.47 to 1.0.48. - [Release notes](https://github.com/dtolnay/thiserror/releases) - [Commits](https://github.com/dtolnay/thiserror/compare/1.0.47...1.0.48) --- updated-dependencies: - dependency-name: thiserror dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Cargo.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2b0527c3ae22..89699d3f3823 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2286,18 +2286,18 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.47" +version = "1.0.48" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97a802ec30afc17eee47b2855fc72e0c4cd62be9b4efe6591edde0ec5bd68d8f" +checksum = "9d6d7a740b8a666a7e828dd00da9c0dc290dff53154ea77ac109281de90589b7" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.47" +version = "1.0.48" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6bb623b56e39ab7dcd4b1b98bb6c8f8d907ed255b18de254088016b27a8ee19b" +checksum = "49922ecae66cc8a249b77e68d1d0623c1b2c514f0060c27cdc68bd62a1219d35" dependencies = [ "proc-macro2", "quote", From d46127fb2e52cfe0bb3b476cf21919a79e49c0c9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 11 Sep 2023 19:11:17 -0500 Subject: [PATCH 14/26] build(deps): bump which from 4.4.0 to 4.4.1 (#8251) Bumps [which](https://github.com/harryfei/which-rs) from 4.4.0 to 4.4.1. - [Changelog](https://github.com/harryfei/which-rs/blob/master/CHANGELOG.md) - [Commits](https://github.com/harryfei/which-rs/compare/4.4.0...4.4.1) --- updated-dependencies: - dependency-name: which dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Cargo.lock | 45 ++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 42 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 89699d3f3823..2fec9a8b2812 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -366,6 +366,27 @@ dependencies = [ "syn 2.0.28", ] +[[package]] +name = "dirs" +version = "5.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44c45a9d03d6676652bcb5e724c7e988de1acad23a711b5217ab9cbecbec2225" +dependencies = [ + "dirs-sys", +] + +[[package]] +name = "dirs-sys" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "520f05a5cbd335fae5a99ff7a6ab8627577660ee5cfd6a94a6a929b52ff0321c" +dependencies = [ + "libc", + "option-ext", + "redox_users", + "windows-sys 0.48.0", +] + [[package]] name = "dunce" version = "1.0.4" @@ -1804,6 +1825,12 @@ version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" +[[package]] +name = "option-ext" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" + [[package]] name = "parking_lot" version = "0.12.1" @@ -1947,6 +1974,17 @@ dependencies = [ "bitflags 1.3.2", ] +[[package]] +name = "redox_users" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b" +dependencies = [ + "getrandom", + "redox_syscall 0.2.16", + "thiserror", +] + [[package]] name = "regex" version = "1.9.5" @@ -2601,13 +2639,14 @@ checksum = "0046fef7e28c3804e5e38bfa31ea2a0f73905319b677e57ebe37e49358989b5d" [[package]] name = "which" -version = "4.4.0" +version = "4.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2441c784c52b289a054b7201fc93253e288f094e2f4be9058343127c4226a269" +checksum = "8ad25fe5717e59ada8ea33511bbbf7420b11031730a24c65e82428766c307006" dependencies = [ + "dirs", "either", - "libc", "once_cell", + "rustix 0.38.11", ] [[package]] From 719ef3f8797439b27af4f1389e591334e2814633 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 12 Sep 2023 02:18:35 +0200 Subject: [PATCH 15/26] build(deps): bump chrono from 0.4.26 to 0.4.30 (#8247) Bumps [chrono](https://github.com/chronotope/chrono) from 0.4.26 to 0.4.30. - [Release notes](https://github.com/chronotope/chrono/releases) - [Changelog](https://github.com/chronotope/chrono/blob/main/CHANGELOG.md) - [Commits](https://github.com/chronotope/chrono/compare/v0.4.26...v0.4.30) --- updated-dependencies: - dependency-name: chrono dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Cargo.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2fec9a8b2812..39cc7a554429 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -185,14 +185,14 @@ dependencies = [ [[package]] name = "chrono" -version = "0.4.26" +version = "0.4.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec837a71355b28f6556dbd569b37b3f363091c0bd4b2e735674521b4c5fd9bc5" +checksum = "defd4e7873dbddba6c7c91e199c7fcb946abc4a6a4ac3195400bcfb01b5de877" dependencies = [ "android-tzdata", "iana-time-zone", "num-traits", - "winapi", + "windows-targets 0.48.0", ] [[package]] From e3d537cee5f06fa8a3454b7eeba80852308d52e8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 12 Sep 2023 02:21:14 +0200 Subject: [PATCH 16/26] build(deps): bump url from 2.4.0 to 2.4.1 (#8250) Bumps [url](https://github.com/servo/rust-url) from 2.4.0 to 2.4.1. - [Release notes](https://github.com/servo/rust-url/releases) - [Commits](https://github.com/servo/rust-url/compare/v2.4.0...v2.4.1) --- updated-dependencies: - dependency-name: url dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 39cc7a554429..3799e389525a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2551,9 +2551,9 @@ checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" [[package]] name = "url" -version = "2.4.0" +version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50bff7831e19200a85b17131d085c25d7811bc4e186efdaf54bbd132994a88cb" +checksum = "143b538f18257fac9cad154828a57c6bf5157e1aa604d4816b5995bf6de87ae5" dependencies = [ "form_urlencoded", "idna", From ccabfee3811bdcc8372beaae777a98fd36e2657e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 12 Sep 2023 02:47:31 +0200 Subject: [PATCH 17/26] build(deps): bump rustix from 0.38.11 to 0.38.13 (#8249) Bumps [rustix](https://github.com/bytecodealliance/rustix) from 0.38.11 to 0.38.13. - [Release notes](https://github.com/bytecodealliance/rustix/releases) - [Commits](https://github.com/bytecodealliance/rustix/compare/v0.38.11...v0.38.13) --- updated-dependencies: - dependency-name: rustix dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Cargo.lock | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 3799e389525a..d2a700a85df5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1455,7 +1455,7 @@ dependencies = [ "log", "once_cell", "parking_lot", - "rustix 0.38.11", + "rustix 0.38.13", "serde", "serde_json", "slotmap", @@ -1657,9 +1657,9 @@ checksum = "36eb31c1778188ae1e64398743890d0877fef36d11521ac60406b42016e8c2cf" [[package]] name = "linux-raw-sys" -version = "0.4.3" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09fc20d2ca12cb9f044c93e3bd6d32d523e6e2ec3db4f7b2939cd99026ecd3f0" +checksum = "1a9bad9f94746442c783ca431b22403b519cd7fbeed0533fdd6328b2f2212128" [[package]] name = "lock_api" @@ -2052,14 +2052,14 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.11" +version = "0.38.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0c3dde1fc030af041adc40e79c0e7fbcf431dd24870053d187d7c66e4b87453" +checksum = "d7db8590df6dfcd144d22afd1b83b36c21a18d7cbc1dc4bb5295a8712e9eb662" dependencies = [ "bitflags 2.4.0", "errno", "libc", - "linux-raw-sys 0.4.3", + "linux-raw-sys 0.4.7", "windows-sys 0.48.0", ] @@ -2289,7 +2289,7 @@ dependencies = [ "cfg-if", "fastrand", "redox_syscall 0.3.5", - "rustix 0.38.11", + "rustix 0.38.13", "windows-sys 0.48.0", ] @@ -2646,7 +2646,7 @@ dependencies = [ "dirs", "either", "once_cell", - "rustix 0.38.11", + "rustix 0.38.13", ] [[package]] From e4ba237258afc7b8545c3e08719a55207b604ae3 Mon Sep 17 00:00:00 2001 From: Bannerets Date: Tue, 12 Sep 2023 20:51:54 +0300 Subject: [PATCH 18/26] Disable auto-pairing ` in OCaml (#8260) --- languages.toml | 2 -- 1 file changed, 2 deletions(-) diff --git a/languages.toml b/languages.toml index 85cc95d40b08..37d2e94cf602 100644 --- a/languages.toml +++ b/languages.toml @@ -886,7 +886,6 @@ indent = { tab-width = 2, unit = " " } '{' = '}' '[' = ']' '"' = '"' -'`' = '`' [[grammar]] name = "ocaml" @@ -907,7 +906,6 @@ indent = { tab-width = 2, unit = " " } '{' = '}' '[' = ']' '"' = '"' -'`' = '`' [[grammar]] name = "ocaml-interface" From 729f32de21d6ead25c1795f262b1be6661016b46 Mon Sep 17 00:00:00 2001 From: Chirikumbrah <78883260+Chirikumbrah@users.noreply.github.com> Date: Wed, 13 Sep 2023 00:06:21 +0300 Subject: [PATCH 19/26] Better indent line color for Dracula theme. (#8266) --- runtime/themes/dracula.toml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/runtime/themes/dracula.toml b/runtime/themes/dracula.toml index 1ec5b4fe2765..1253544f2ed3 100644 --- a/runtime/themes/dracula.toml +++ b/runtime/themes/dracula.toml @@ -90,6 +90,7 @@ "ui.virtual.whitespace" = { fg = "current_line" } "ui.virtual.wrap" = { fg = "current_line" } "ui.virtual.ruler" = { bg = "black" } +"ui.virtual.indent-guide" = { fg = "indent" } "ui.virtual.inlay-hint" = { fg = "cyan" } "ui.virtual.inlay-hint.parameter" = { fg = "cyan", modifiers = ["italic", "dim"] } "ui.virtual.inlay-hint.type" = { fg = "cyan", modifiers = ["italic", "dim"] } @@ -123,6 +124,7 @@ black = "#191A21" grey = "#666771" comment = "#6272A4" current_line = "#44475a" +indent = "#56596a" selection = "#363848" red = "#ff5555" orange = "#ffb86c" From fe6b556f51e5dfac828e139131af99117b655efe Mon Sep 17 00:00:00 2001 From: Em Zhan Date: Wed, 13 Sep 2023 09:37:39 -0500 Subject: [PATCH 20/26] Fix search highlighting for the default docs theme (#8270) --- book/custom.css | 2 +- docs/CONTRIBUTING.md | 13 ++++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/book/custom.css b/book/custom.css index 0e812090e319..4b039125e78e 100644 --- a/book/custom.css +++ b/book/custom.css @@ -164,7 +164,7 @@ code.hljs { --searchresults-header-fg: #5f5f71; --searchresults-border-color: #5c5c68; --searchresults-li-bg: #242430; - --search-mark-bg: #acff5; + --search-mark-bg: #a2cff5; } .colibri .content .header { diff --git a/docs/CONTRIBUTING.md b/docs/CONTRIBUTING.md index 982b2237e960..2be8f77c77de 100644 --- a/docs/CONTRIBUTING.md +++ b/docs/CONTRIBUTING.md @@ -29,9 +29,15 @@ files, run cargo xtask docgen ``` -inside the project. We use [xtask][xtask] as an ad-hoc task runner and -thus do not require any dependencies other than `cargo` (You don't have -to `cargo install` anything either). +inside the project. We use [xtask][xtask] as an ad-hoc task runner. + +To preview the book itself, install [mdbook][mdbook]. Then, run + +```shell +mdbook serve book +``` + +and visit [http://localhost:3000](http://localhost:3000). # Testing @@ -58,4 +64,5 @@ The current MSRV and future changes to the MSRV are listed in the [Firefox docum [architecture.md]: ./architecture.md [docs]: https://docs.helix-editor.com/ [xtask]: https://github.com/matklad/cargo-xtask +[mdbook]: https://rust-lang.github.io/mdBook/guide/installation.html [helpers.rs]: ../helix-term/tests/test/helpers.rs From 764172d5bce243e11c23b4540ce89968bcb2f643 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Tj=C3=A4der?= Date: Thu, 14 Sep 2023 00:37:53 +0200 Subject: [PATCH 21/26] Theme: Papercolor: Cleanup, linting and using inheritance (#8276) --- runtime/themes/papercolor-dark.toml | 183 ++++++----------- runtime/themes/papercolor-light.toml | 293 +++++++++++++++++---------- 2 files changed, 257 insertions(+), 219 deletions(-) diff --git a/runtime/themes/papercolor-dark.toml b/runtime/themes/papercolor-dark.toml index eaaa36dcf52c..6e6dc0c3352d 100644 --- a/runtime/themes/papercolor-dark.toml +++ b/runtime/themes/papercolor-dark.toml @@ -1,124 +1,75 @@ # Palette based on https://github.com/NLKNguyen/papercolor-theme # Author: Soc Virnyl Estela -"ui.linenr.selected" = { fg = "linenr_fg_selected" } -"ui.background" = {bg="background"} -"ui.text" = "foreground" -"ui.text.focus" = { fg = "selection_background", modifiers = ["bold"]} -"ui.selection" = {bg="selection_background", fg="selection_foreground"} -"ui.cursorline" = {bg="cursorline_background"} -"ui.highlight" = {bg="cursorline_background"} -"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="selection_foreground", fg="foreground"} -"ui.virtual.whitespace" = { fg = "regular5" } -"ui.virtual.ruler" = {bg="cursorline_background"} -"ui.cursor.match" = {bg = "regular5", fg = "regular0"} -"ui.cursor" = {bg = "regular5", fg = "background"} -"ui.window" = {bg = "#303030", fg = "bright2"} -"ui.help" = {bg = "background", fg = "bright2"} -"ui.popup" = {bg = "#303030", fg = "bright6"} -"ui.menu" = {bg = "#303030", fg = "bright6"} -"ui.menu.selected" = {bg = "#C6C6C6", fg="selection_foreground"} +inherits = "papercolor-light" -"markup.heading" = { fg = "regular4", modifiers = ["bold"] } -"markup.heading.1" = { fg = "bright2", modifiers = ["bold"] } -"markup.heading.2" = { fg = "bright5", modifiers = ["bold"] } -"markup.heading.3" = { fg = "bright3", modifiers = ["bold"] } -"markup.heading.4" = { fg = "bright5", modifiers = ["bold"] } -"markup.heading.5" = { fg = "bright5", modifiers = ["bold"] } -"markup.heading.6" = { fg = "bright5", modifiers = ["bold"] } -"markup.list" = "bright3" -"markup.bold" = { fg = "foreground", modifiers = ["bold"] } -"markup.italic" = { fg = "bright0", modifiers = ["italic"] } -"markup.strikethrough" = { modifiers = ["crossed_out"] } -"markup.link.url" = { fg = "bright6", modifiers = ["underlined"] } -"markup.link.text" = "bright2" -"markup.link.label" = { fg = "regular2", modifiers = ["bold"] } -"markup.raw" = "foreground" - -"string" = "foreground" -"attribute" = "bright7" -"keyword" = { fg = "regular4", modifiers = ["bold"]} -"keyword.directive" = "regular4" -"keyword.control.conditional" = "bright3" -"keyword.function" = "regular4" -"namespace" = "bright1" -"type" = "bright2" -"type.builtin" = { fg = "foreground", modifiers = ["bold"]} -"variable" = "foreground" -"variable.builtin" = "cyan" -"variable.other.member" = "cyan" -"variable.parameter" = "foreground" - -"special" = "#3E999F" -"function" = "bright6" -"constructor" = "regular4" -"function.builtin" = { fg = "foreground", modifiers = ["bold"]} -"function.macro" = { fg = "regular4", modifiers = ["bold"] } -"comment" = { fg = "#686868", modifiers = ["dim"] } -"ui.linenr" = { fg = "bright0" } -"module" = "regular4" -"constant" = "bright5" -"constant.builtin" = "bright6" -"constant.numeric" = "bright5" -"constant.character.escape" = { fg = "foreground", modifiers = ["bold"]} -"operator" = { fg = "regular4", modifiers = ["bold"]} - -"label" = { fg = "selection_background", modifiers = ["bold", "italic"] } - -"diff.plus" = "regular2" -"diff.delta" = "regular6" -"diff.minus" = "regular1" +[palette] +background = "#1c1c1c" +foreground = "#d0d0d0" -"warning" = "bright4" -"error" = "regular1" -"info" = "bright4" +regular0 = "#1c1c1c" # color00 "Background" +regular1 = "#af005f" # color01 "Negative" +regular2 = "#5faf00" # color02 "Positive" +regular3 = "#d7af5f" # color03 "Olive" +regular4 = "#5fafd7" # color04 "Neutral" / Aqua +regular5 = "#808080" # color05 "Comment" +regular6 = "#d7875f" # color06 "Navy" +regular7 = "#d0d0d0" # color07 "Foreground" +bright0 = "#585858" # color08 "Nontext" +bright1 = "#5faf5f" # color09 "Red" +bright2 = "#afd700" # color10 "Pink" +bright3 = "#af87d7" # color11 "Purple" +bright4 = "#ffaf00" # color12 "Accent" +bright5 = "#ff5faf" # color13 "Orange" +bright6 = "#00afaf" # color14 "Blue" +bright7 = "#5f8787" # color15 "Highlight" -"diagnostic.warning".underline = { color = "bright4", style = "curl" } -"diagnostic.error".underline = { color = "regular1", style = "curl" } -"diagnostic.info".underline = { color = "bright4", style = "curl" } -"diagnostic.hint".underline = { color = "bright4", style = "curl" } +selection_fg = "#000000" +selection_bg = "#8787af" +selection_secondary_fg = "#333333" +selection_secondary_bg = "#707097" +special = "#3e999f" +cursorline_bg = "#303030" +cursorline_secondary_bg = "#2a2a2a" +cursorcolumn_bg = "#303030" +cursorcolumn_secondary_bg = "#2a2a2a" +cursorlinenr_fg = "#ffff00" +popupmenu_fg = "#c6c6c6" +popupmenu_bg = "#303030" +linenumber_fg = "#585858" +vertsplit_fg = "#5f8787" +statusline_active_fg = "#1c1c1c" +statusline_active_bg = "#5f8787" +statusline_inactive_fg = "#bcbcbc" +statusline_inactive_bg = "#3a3a3a" +todo_fg = "#ff8700" +error_fg = "#af005f" +error_bg = "#5f0000" +matchparen_bg = "#4e4e4e" +matchparen_fg = "#c6c6c6" +wildmenu_fg = "#1c1c1c" +wildmenu_bg = "#afd700" +diffadd_fg = "#87d700" +diffadd_bg = "#005f00" +diffdelete_fg = "#af005f" +diffdelete_bg = "#5f0000" +diffchange_bg = "#005f5f" -[palette] -background="#1c1c1c" -foreground="#d0d0d0" -regular0="#1c1c1c" -regular1="#af005f" -regular2="#5faf00" -regular3="#d7af5f" -regular4="#5fafd7" -regular5="#808080" -regular6="#d7875f" -regular7="#d0d0d0" -bright0="#585858" -bright1="#5faf5f" -bright2="#afd700" -bright3="#af87d7" -bright4="#FFAF00" -bright5="#ff5faf" -bright6="#00afaf" -bright7="#5f8787" -selection_foreground="#585858" -selection_background="#8787AF" -cursorline_background="#303030" -paper_bar_bg="#5F8787" -black="#1c1c1c" -red="#af005f" -green="#5faf00" -yellow="#d7af5f" -blue="#5fafd7" -magenta="#808080" -cyan="#d7875f" -gray="#d0d0d0" -light-red="#5faf5f" -light-green="#afd700" -light-yellow="#af87d7" -light-blue="#FFAF00" -light-magenta="#ff5faf" -light-cyan="#00afaf" -light-gray="#5f8787" -white="#808080" -linenr_fg_selected="#FFFF00" +# 16 bit ANSI color names +black = "#1c1c1c" +red = "#af005f" +green = "#5faf00" +yellow = "#d7af5f" +blue = "#5fafd7" +magenta = "#808080" +cyan = "#d7875f" +white = "#d0d0d0" +light-black = "#585858" +light-red = "#5faf5f" +light-green = "#afd700" +light-yellow = "#af87d7" +light-blue = "#ffaf00" +light-magenta = "#ff5faf" +light-cyan = "#00afaf" +light-white = "#5f8787" diff --git a/runtime/themes/papercolor-light.toml b/runtime/themes/papercolor-light.toml index 63671e1b3ff7..ae104e17e0b5 100644 --- a/runtime/themes/papercolor-light.toml +++ b/runtime/themes/papercolor-light.toml @@ -1,31 +1,124 @@ # Palette based on https://github.com/NLKNguyen/papercolor-theme # Author: Soc Virnyl Estela -"ui.linenr.selected" = { fg = "linenr_fg_selected" } -"ui.background" = {bg="background"} +"ui.linenr.selected" = { fg = "cursorlinenr_fg", modifiers = ["bold"] } +"ui.linenr" = { fg = "linenumber_fg" } +"ui.background" = { bg = "background" } "ui.text" = "foreground" -"ui.text.focus" = { fg = "selection_background", modifiers = ["bold"]} -"ui.selection" = {bg="selection_background", fg="selection_foreground"} -"ui.highlight" = {bg="cursorline_background"} -"ui.cursorline" = {bg="cursorline_background"} -"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="bright0", fg="foreground"} -"ui.virtual" = "indent" +"ui.text.focus" = { fg = "selection_bg", modifiers = ["bold"] } +"ui.selection" = { bg = "selection_secondary_bg", fg = "selection_secondary_fg" } +"ui.selection.primary" = { bg = "selection_bg", fg = "selection_fg" } +"ui.highlight" = { bg = "cursorline_bg" } + +"ui.cursorline" = { bg = "cursorline_bg" } +"ui.cursorline.secondary" = { bg = "cursorline_secondary_bg" } +"ui.cursorcolumn" = { bg = "cursorline_bg" } +"ui.cursorcolumn.secondary" = { bg = "cursorcolumn_secondary_bg" } + +"ui.statusline" = { bg = "statusline_active_bg", fg = "statusline_active_fg" } +"ui.statusline.inactive" = { bg = "statusline_inactive_bg", fg = "statusline_inactive_fg" } +"ui.statusline.normal" = { bg = "statusline_inactive_bg", fg = "bright6" } +"ui.statusline.insert" = { bg = "statusline_inactive_bg", fg = "bright4" } +"ui.statusline.select" = { bg = "statusline_inactive_bg", fg = "regular3" } +"ui.statusline.separator" = { bg = "statusline_active_bg", fg = "statusline_active_bg" } + +"ui.virtual" = { fg = "cursorlinenr_fg" } "ui.virtual.whitespace" = { fg = "regular5" } -"ui.virtual.ruler" = {bg="cursorline_background"} -"ui.cursor.match" = {bg = "regular5", fg = "regular0"} -"ui.cursor" = {bg = "regular5", fg = "background"} -"ui.window" = {bg = "#D0D0D0", fg = "bright2"} -"ui.help" = {bg = "background", fg = "bright2"} -"ui.popup" = {bg = "#D0D0D0", fg = "bright7"} -"ui.menu" = {bg = "#D0D0D0", fg = "bright7"} -"ui.menu.selected" = {bg = "selection_background", fg="selection_foreground"} - -"markup.heading" = { fg = "bright7", modifiers = ["bold"] } +"ui.virtual.indent-guide" = { fg = "bright0" } +"ui.virtual.ruler" = { bg = "cursorline_secondary_bg", fg = "regular4" } +"ui.cursor.match" = { bg = "matchparen_bg", fg = "matchparen_fg" } +"ui.cursor" = { bg = "regular5", fg = "background" } +"ui.cursor.primary" = { bg = "foreground", fg = "background" } +"ui.window" = { fg = "vertsplit_fg" } +"ui.help" = { bg = "wildmenu_bg", fg = "wildmenu_fg" } +"ui.popup" = { bg = "popupmenu_bg", fg = "popupmenu_fg" } +"ui.popup.info" = { bg = "popupmenu_bg", fg = "bright7", modifiers = ["bold"] } +"ui.menu" = { bg = "popupmenu_bg", fg = "foreground" } +"ui.menu.selected" = { bg = "selection_bg", fg = "selection_fg" } + +"warning" = "bright5" +"error" = { bg = "error_bg", fg = "error_fg" } +"info" = "todo_fg" + +"diagnostic.warning" = { fg = "bright0", modifiers = [ + "dim", +], underline = { color = "bright5", style = "curl" } } +"diagnostic.error".underline = { color = "bright1", style = "curl" } +"diagnostic.info".underline = { color = "bright4", style = "curl" } +"diagnostic.hint".underline = { color = "bright6", style = "curl" } + +# Tree-sitter scopes for syntax highlighting +"attribute" = "bright4" + +"type" = { fg = "bright2", modifiers = ["bold"] } +"type.builtin" = { fg = "bright2", modifiers = ["bold"] } +"type.enum" = { fg = "foreground" } +"type.enum.variant" = { fg = "foreground" } + +"constructor" = "foreground" + +"constant" = "bright5" +"constant.builtin" = "regular3" +"constant.builtin.boolean" = { fg = "regular2", modifiers = ["bold"] } +"constant.character.escape" = { fg = "bright3", modifiers = ["bold"] } +"constant.character" = { fg = "regular3" } +"constant.numeric" = "bright5" + +"string" = "regular3" +"string.regexp" = "bright3" + +"comment" = { fg = "regular5", modifiers = ["italic"] } +"comment.line" = { fg = "regular5", modifiers = ["italic"] } +"comment.block" = { fg = "regular5", modifiers = ["italic"] } +"comment.block.documentation" = { fg = "regular5", modifiers = ["bold"] } + +"variable" = "foreground" +"variable.builtin" = "bright5" +"variable.other.member" = "foreground" +"variable.parameter" = "foreground" + +"label" = { fg = "selection_bg", modifiers = ["bold", "italic"] } + +"punctuation" = { fg = "foreground" } +"punctuation.delimiter" = { fg = "regular4", modifiers = ["bold"] } +"punctuation.bracket" = { fg = "foreground" } +"punctuation.special" = { fg = "bright1", modifiers = ["bold"] } + +"keyword" = { fg = "bright2" } +"keyword.control" = "bright1" +"keyword.control.conditional" = { fg = "bright3", modifiers = ["bold"] } +"keyword.control.repeat" = { fg = "bright3", modifiers = ["bold"] } +"keyword.control.import" = { fg = "bright2" } +"keyword.control.return" = { fg = "bright2" } +"keyword.control.exception" = { fg = "bright1" } + +"keyword.operator" = { fg = "regular4", modifiers = ["bold"] } +"keyword.directive" = "regular4" +"keyword.function" = "bright2" +"keyword.storage" = "bright2" +"keyword.storage.type" = { fg = "regular4", modifiers = ["bold"] } +"keyword.storage.modifier" = { fg = "regular6", modifiers = ["bold"] } +"keyword.storage.modifier.ref" = { fg = "regular4", modifiers = ["bold"] } +"keyword.special" = "bright1" + +"operator" = { fg = "regular4", modifiers = ["bold"] } + +"function" = { fg = "foreground" } +"function.builtin" = { fg = "bright6" } +"function.method" = { fg = "foreground" } +"function.macro" = { fg = "regular3", modifiers = ["bold"] } +"function.special" = { fg = "bright4" } + +"tag" = { fg = "regular4" } + +"namespace" = "bright6" + +"special" = "special" + +"markup.heading" = { fg = "bright4", modifiers = ["bold"] } +"markup.heading.marker" = { fg = "bright2", modifiers = ["bold"] } "markup.heading.1" = { fg = "bright2", modifiers = ["bold"] } -"markup.heading.2" = { fg = "bright4", modifiers = ["bold"] } +"markup.heading.2" = { fg = "bright5", modifiers = ["bold"] } "markup.heading.3" = { fg = "bright3", modifiers = ["bold"] } "markup.heading.4" = { fg = "bright4", modifiers = ["bold"] } "markup.heading.5" = { fg = "bright4", modifiers = ["bold"] } @@ -34,90 +127,84 @@ "markup.bold" = { fg = "foreground", modifiers = ["bold"] } "markup.italic" = { modifiers = ["italic"] } "markup.strikethrough" = { modifiers = ["crossed_out"] } -"markup.link.url" = { fg = "regular4", modifiers = ["underlined"] } +"markup.link.url" = { fg = "bright6", underline.style = "line" } "markup.link.text" = "bright2" -"markup.link.label" = { fg = "regular7", modifiers = ["bold"] } -"markup.raw" = "foreground" - -"string" = "foreground" -"attribute" = "bright7" -"keyword" = { fg = "regular4", modifiers = ["bold"]} -"keyword.directive" = "regular1" -"namespace" = "regular1" -"type" = "bright2" -"type.builtin" = { fg = "regular4", modifiers = ["bold"]} -"variable" = "foreground" -"variable.builtin" = "cyan" -"variable.other.member" = "regular4" -"variable.parameter" = "foreground" - -"special" = "#3E999F" -"function" = "bright1" -"constructor" = "bright1" -"function.builtin" = { fg = "regular4", modifiers = ["bold"]} -"function.macro" = { fg = "regular1" } -"comment" = { fg = "bright0", modifiers = ["dim"] } -"ui.linenr" = { fg = "bright0" } -"module" = "#af0000" -"constant" = "#5f8700" -"constant.builtin" = "#5f8700" -"constant.numeric" = "#d75f00" -"constant.character.escape" = { fg = "#8700af", modifiers = ["bold"]} -"operator" = { fg = "regular4", modifiers = ["bold"]} +"markup.link.label" = { fg = "regular2", modifiers = ["bold"] } +"markup.quote" = "regular4" +# Both inline and block code +"markup.raw" = "regular3" -"label" = { fg = "selection_background", modifiers = ["bold", "italic"] } +"diff.plus" = { bg = "diffadd_bg", fg = "diffadd_fg" } +"diff.delta" = { bg = "diffchange_bg" } +"diff.delta.moved" = { modifiers = ["italic"] } +"diff.minus" = { bg = "diffdelete_bg", fg = "diffdelete_fg" } -"diff.plus" = "regular2" -"diff.delta" = "bright0" -"diff.minus" = "bright1" - -"warning" = "bright4" -"error" = "regular1" -"info" = "#FFAF00" +[palette] +background = "#eeeeee" +foreground = "#444444" +regular0 = "#eeeeee" # color00 "Background" +regular1 = "#af0000" # color01 "Negative" +regular2 = "#008700" # color02 "Positive" +regular3 = "#5f8700" # color03 "Olve" +regular4 = "#0087af" # color04 "Neutral" / Aqua +regular5 = "#878787" # color05 "Comment" +regular6 = "#005f87" # color06 "Navy" +regular7 = "#444444" # color07 "Foreground" +bright0 = "#bcbcbc" # color08 "Nontext" +bright1 = "#d70000" # color09 "Red" +bright2 = "#d70087" # color10 "Pink" +bright3 = "#8700af" # color11 "Purple" +bright4 = "#d75f00" # color12 "Accent" +bright5 = "#d75f00" # color13 "Orange" +bright6 = "#005faf" # color14 "Blue" +bright7 = "#005f87" # color15 "Highlight" -"diagnostic.warning".underline = { color = "bright4", style = "curl" } -"diagnostic.error".underline = { color = "regular1", style = "curl" } -"diagnostic.info".underline = { color = "#FFAF00", style = "curl" } -"diagnostic.hint".underline = { color = "#FFAF00", style = "curl" } +selection_fg = "#eeeeee" +selection_bg = "#0087af" +selection_secondary_fg = "#d9d7d7" +selection_secondary_bg = "#2c687a" +special = "#3e999f" +cursorline_bg = "#e4e4e4" +cursorline_secondary_bg = "#eaeaea" +cursorcolumn_bg = "#e4e4e4" +cursorcolumn_secondary_bg = "#eaeaea" +cursorlinenr_fg = "#af5f00" +popupmenu_fg = "#444444" +popupmenu_bg = "#d0d0d0" +linenumber_fg = "#b2b2b2" +vertsplit_fg = "#005f87" +statusline_active_fg = "#e4e4e4" +statusline_active_bg = "#005f87" +statusline_inactive_fg = "#444444" +statusline_inactive_bg = "#d0d0d0" +todo_fg = "#00af5f" +error_fg = "#af0000" +error_bg = "#ffd7ff" +matchparen_bg = "#c6c6c6" +matchparen_fg = "#005f87" +wildmenu_fg = "#444444" +wildmenu_bg = "#ffff00" +diffadd_fg = "#008700" +diffadd_bg = "#afffaf" +diffdelete_fg = "#af0000" +diffdelete_bg = "#ffd7ff" +diffchange_bg = "#ffd787" -[palette] -background="#eeeeee" -foreground="#444444" -regular0="#eeeeee" -regular1="#af0000" -regular2="#008700" -regular3="#5f8700" -regular4="#0087af" -regular5="#878787" -regular6="#005f87" -regular7="#764e37" -bright0="#bcbcbc" -bright1="#d70000" -bright2="#d70087" -bright3="#8700af" -bright4="#d75f00" -bright5="#d75f00" -bright6="#4c7a5d" -bright7="#005faf" -selection_foreground="#eeeeee" -selection_background="#0087af" -cursorline_background="#fdfdfd" -paper_bar_bg="#005F87" -black="#eeeeee" -red="#d70000" -green="#008700" -yellow="#5f8700" -blue="#0087af" -magenta="#878787" -cyan="#005f87" -gray="#764e37" -light-red="#d70000" -light-green="#d70087" -light-yellow="#8700af" -light-blue="#d75f00" -light-magenta="#d75f00" -light-cyan="#4c7a4d" -light-gray="#005faf" -white="#444444" -linenr_fg_selected="#AF634D" +# 16 bit ANSI color names +black = "#eeeeee" +red = "#d70000" +green = "#008700" +yellow = "#5f8700" +blue = "#0087af" +magenta = "#878787" +cyan = "#005f87" +white = "#444444" +light-black = "#bcbcbc" +light-red = "#d70000" +light-green = "#d70087" +light-yellow = "#8700af" +light-blue = "#d75f00" +light-magenta = "#d75f00" +light-cyan = "#4c7a4d" +light-white = "#005faf" From e41bee6ac63095a3cd74c3efba0a417d8834f0b8 Mon Sep 17 00:00:00 2001 From: Anton Romanov Date: Wed, 13 Sep 2023 15:38:14 -0700 Subject: [PATCH 22/26] [theme] Fix zenburn theme inlay hint color (#8278) --- runtime/themes/zenburn.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/themes/zenburn.toml b/runtime/themes/zenburn.toml index 8518e78f8390..9a4a7abccf6a 100644 --- a/runtime/themes/zenburn.toml +++ b/runtime/themes/zenburn.toml @@ -9,7 +9,7 @@ "ui.selection" = { bg = "#304a3d" } "ui.selection.primary" = { bg = "#2f2f2f" } "comment" = { fg = "comment" } -"ui.virtual.inlay-hint" = { fg = "comment" } +"ui.virtual.inlay-hint" = { fg = "#9f9f9f" } "comment.block.documentation" = { fg = "black", modifiers = ["bold"] } "ui.statusline" = { bg = "statusbg", fg = "#ccdc90" } "ui.statusline.inactive" = { fg = '#2e3330', bg = '#88b090' } From e9d0bd7aefda6962b56245eb7d0f56b5d2fa4859 Mon Sep 17 00:00:00 2001 From: Pascal Kuthe Date: Tue, 12 Sep 2023 21:11:07 +0200 Subject: [PATCH 23/26] fix crash in picker preview for invalid ranges --- helix-term/src/ui/picker.rs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/helix-term/src/ui/picker.rs b/helix-term/src/ui/picker.rs index 94a69b0d3805..7e745f7241fb 100644 --- a/helix-term/src/ui/picker.rs +++ b/helix-term/src/ui/picker.rs @@ -112,9 +112,9 @@ impl Preview<'_, '_> { /// Alternate text to show for the preview. fn placeholder(&self) -> &str { match *self { - Self::EditorDocument(_) => "", + Self::EditorDocument(_) => "", Self::Cached(preview) => match preview { - CachedPreview::Document(_) => "", + CachedPreview::Document(_) => "", CachedPreview::Binary => "", CachedPreview::LargeFile => "", CachedPreview::NotFound => "", @@ -693,8 +693,14 @@ impl Picker { if let Some((path, range)) = self.current_file(cx.editor) { let preview = self.get_preview(path, cx.editor); let doc = match preview.document() { - Some(doc) => doc, - None => { + Some(doc) + if range.map_or(true, |(start, end)| { + start <= end && end <= doc.text().len_lines() + }) => + { + doc + } + _ => { let alt_text = preview.placeholder(); let x = inner.x + inner.width.saturating_sub(alt_text.len() as u16) / 2; let y = inner.y + inner.height / 2; From 13d4463e4146473391e37b7f75e99b731aa55878 Mon Sep 17 00:00:00 2001 From: Pascal Kuthe Date: Tue, 12 Sep 2023 21:12:36 +0200 Subject: [PATCH 24/26] correctly center items in picker preview --- helix-term/src/ui/picker.rs | 36 ++++++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/helix-term/src/ui/picker.rs b/helix-term/src/ui/picker.rs index 7e745f7241fb..2c41fc12d685 100644 --- a/helix-term/src/ui/picker.rs +++ b/helix-term/src/ui/picker.rs @@ -710,18 +710,30 @@ impl Picker { }; let mut offset = ViewPosition::default(); - if let Some(range) = range { - let text_fmt = doc.text_format(inner.width, None); - let annotations = TextAnnotations::default(); - (offset.anchor, offset.vertical_offset) = char_idx_at_visual_offset( - doc.text().slice(..), - doc.text().line_to_char(range.0), - // align to middle - -(inner.height as isize / 2), - 0, - &text_fmt, - &annotations, - ); + if let Some((start_line, end_line)) = range { + let height = end_line - start_line; + let text = doc.text().slice(..); + let start = text.line_to_char(start_line); + let middle = text.line_to_char(start_line + height / 2); + if height < inner.height as usize { + let text_fmt = doc.text_format(inner.width, None); + let annotations = TextAnnotations::default(); + (offset.anchor, offset.vertical_offset) = char_idx_at_visual_offset( + text, + middle, + // align to middle + -(inner.height as isize / 2), + 0, + &text_fmt, + &annotations, + ); + if start < offset.anchor { + offset.anchor = start; + offset.vertical_offset = 0; + } + } else { + offset.anchor = start; + } } let mut highlights = EditorView::doc_syntax_highlights( From 19d44b6fde2a7689ff32410c573106b9c8359236 Mon Sep 17 00:00:00 2001 From: Abderrahmane TAHRI JOUTI <302837+atahrijouti@users.noreply.github.com> Date: Sat, 16 Sep 2023 00:22:40 +0200 Subject: [PATCH 25/26] add cyan_light theme (#8293) Co-authored-by: Michael Davis --- runtime/themes/cyan_light.toml | 151 +++++++++++++++++++++++++++++++++ 1 file changed, 151 insertions(+) create mode 100644 runtime/themes/cyan_light.toml diff --git a/runtime/themes/cyan_light.toml b/runtime/themes/cyan_light.toml new file mode 100644 index 000000000000..2114054d0f56 --- /dev/null +++ b/runtime/themes/cyan_light.toml @@ -0,0 +1,151 @@ +# An approximation/port of the Cyan Light Theme from Jetbrains +# +# Original Color Scheme here https://plugins.jetbrains.com/plugin/12102-cyan-light-theme + +"attribute" = "blue" +"type" = "shade07" +"type.enum.variant" = "purple" +"constructor" = "shade07" + +"constant" = "darker_blue" +"constant.builtin.boolean" = "blue" +"constant.character" = "blue" +"constant.character.escape" = "dark_red" +"constant.numeric" = "blue" + +"string" = "green" +"string.regexp" = "blue" +"string.special" = { fg = "dark_red", modifiers = ["underlined"] } + +"comment" = "comment_gray" + +"variable" = "green_blue" +"variable.builtin" = { fg = "darker_blue" } +"variable.parameter" = "purple" +"variable.other.member" = "purple" + +"label" = { fg = "darker_blue", modifiers = ["underlined"] } +"punctuation" = "shade06" + +"keyword" = "darker_blue" +"keyword.control.exception" = "darker_blue" + +"operator" = "shade06" + +"function" = "shade07" +"function.macro" = "yellow" +"function.builtin" = { fg = "shade07", modifiers = ["italic"] } +"function.special" = "dark_red" +"function.method" = "dark_yellow" + +"tag" = "darker_blue" +"special" = "shade06" +"namespace" = "darker_blue" + +"markup.bold" = { fg = "shade06", modifiers = ["bold"] } +"markup.italic" = { fg = "shade06", modifiers = ["italic"] } +"markup.strikethrough" = { fg = "shade06", modifiers = ["crossed_out"] } +"markup.heading" = { fg = "purple" } +"markup.list" = "darker_blue" +"markup.list.numbered" = "darker_blue" +"markup.list.unnumbered" = "darker_blue" +"markup.link.url" = "shade06" +"markup.link.text" = { fg = "dark_blue", modifiers = ['underlined'] } +"markup.link.label" = "dark_blue" +"markup.quote" = "green" +"markup.raw" = "green" +"markup.raw.inline" = "green" +"markup.raw.block" = "green" + +"diff.plus" = "diff_green" +"diff.minus" = "diff_red" +"diff.delta" = "diff_blue" + +# ui specific +"ui.background" = { bg = "shade00" } +"ui.cursor" = { bg = "shade02" } +"ui.cursor.primary" = { bg = "cursor_blue" } +"ui.cursor.match" = { fg = "shade00", bg = "shade04" } +"ui.cursor.primary.select" = { bg = "light_purple" } +"ui.cursor.primary.insert" = { bg = "light_green" } + +"ui.selection" = { bg = "lighter_blue" } +"ui.selection.primary" = { bg = "lighter_blue" } + +"ui.highlight" = { bg = "faint_blue" } +"ui.cursorline.primary" = { bg = "faint_blue" } + +"ui.linenr" = { fg = "shade03" } +"ui.linenr.selected" = { fg = "shade04", bg = "faint_blue", modifiers = [ + "bold", +] } + +"ui.statusline" = { fg = "shade06", bg = "shade02" } +"ui.statusline.inactive" = { fg = "shade04", bg = "shade01" } +"ui.statusline.normal" = { fg = "shade00", bg = "blue" } +"ui.statusline.insert" = { fg = "shade00", bg = "green" } +"ui.statusline.select" = { fg = "shade00", bg = "purple" } + +"ui.popup" = { bg = "shade01", fg = "shade04" } +"ui.window" = { bg = "shade00", fg = "shade04" } +"ui.help" = { fg = "shade06", bg = "shade01" } +"ui.text" = "shade05" +"ui.text.focus" = { fg = "shade07", bg = "light_blue" } +"ui.virtual" = "shade03" +"ui.virtual.ruler" = { bg = "shade04" } +"ui.menu" = { fg = "shade05", bg = "shade01" } +"ui.menu.selected" = { fg = "shade07", bg = "light_blue" } + +"hint" = "shade04" +"info" = "light_blue" +"warning" = "orange" +"error" = "red" +"diagnostic" = { modifiers = [] } +"diagnostic.hint" = { underline = { color = "shade04", style = "line" } } +"diagnostic.info" = { underline = { color = "light_blue", style = "line" } } +"diagnostic.warning" = { underline = { color = "orange", style = "curl" } } +"diagnostic.error" = { underline = { color = "red", style = "curl" } } + +[palette] +shade00 = "#f2f3f7" +shade01 = "#dadde8" +shade02 = "#c1c6d9" +shade03 = "#a9b0ca" +shade04 = "#525c85" +shade05 = "#434b6c" +shade06 = "#343a54" +shade07 = "#25293c" + +background = "#f2f3f7" +foreground = "#25293c" + +comment_gray = "#808080" + +diff_blue = "#C3D6E8" +faint_blue = "#E8Eef1" +lighter_blue = "#d0eaff" +light_blue = "#99ccff" +cursor_blue = "#80bfff" +blue = "#0073E6" +dark_blue = "#185b93" +darker_blue = "#000080" + + +purple = "#660E7A" +light_purple = "#ED9CFF" + +diff_green = "#C9DEC1" +green = "#00733B" +light_green = "#5DCE87" +green_blue = "#458383" + + +yellow = "#808000" +dark_yellow = "#7A7A43" + +light_orange = "#f9c881" +orange = "#F49810" + +diff_red = "#EBBCBC" +red = "#d90016" +dark_red = "#7F0000" From 941dc6c614d684804c3580c4ae8b3c4368aab217 Mon Sep 17 00:00:00 2001 From: Cyrill Schenkel Date: Sat, 16 Sep 2023 02:04:44 +0200 Subject: [PATCH 26/26] add GNU assembler (gas) support #8291) --- book/src/generated/lang-support.md | 1 + languages.toml | 15 ++++++++++++++- runtime/queries/gas/highlights.scm | 21 +++++++++++++++++++++ runtime/queries/gas/injections.scm | 2 ++ runtime/queries/gas/textobjects.scm | 2 ++ 5 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 runtime/queries/gas/highlights.scm create mode 100644 runtime/queries/gas/injections.scm create mode 100644 runtime/queries/gas/textobjects.scm diff --git a/book/src/generated/lang-support.md b/book/src/generated/lang-support.md index c1b0acfdbd69..9d036b73cd04 100644 --- a/book/src/generated/lang-support.md +++ b/book/src/generated/lang-support.md @@ -44,6 +44,7 @@ | forth | ✓ | | | `forth-lsp` | | fortran | ✓ | | ✓ | `fortls` | | fsharp | ✓ | | | `fsautocomplete` | +| gas | ✓ | ✓ | | | | gdscript | ✓ | ✓ | ✓ | | | gemini | ✓ | | | | | git-attributes | ✓ | | | | diff --git a/languages.toml b/languages.toml index 37d2e94cf602..a6ff9c676eda 100644 --- a/languages.toml +++ b/languages.toml @@ -2495,7 +2495,7 @@ source = { git = "https://github.com/erasin/tree-sitter-po", rev = "417cee9abb20 [[language]] name = "nasm" scope = "source.nasm" -file-types = ["asm", "s", "S", "nasm"] +file-types = ["asm", "S", "nasm"] injection-regex = "n?asm" roots = [] comment-token = ";" @@ -2505,6 +2505,19 @@ indent = { tab-width = 8, unit = " " } name = "nasm" source = { git = "https://github.com/naclsn/tree-sitter-nasm", rev = "a0db15db6fcfb1bf2cc8702500e55e558825c48b" } +[[language]] +name = "gas" +scope = "source.gas" +file-types = ["s"] +injection-regex = "gas" +roots = [] +comment-token = "#" +indent = { tab-width = 8, unit = " " } + +[[grammar]] +name = "gas" +source = { git = "https://github.com/sirius94/tree-sitter-gas", rev = "60f443646b20edee3b7bf18f3a4fb91dc214259a" } + [[language]] name = "rst" scope = "source.rst" diff --git a/runtime/queries/gas/highlights.scm b/runtime/queries/gas/highlights.scm new file mode 100644 index 000000000000..46cefcbabc3a --- /dev/null +++ b/runtime/queries/gas/highlights.scm @@ -0,0 +1,21 @@ +(comment) @comment +(number) @constant.numeric +(directive_name) @keyword.directive +(symbol) @variable +(label) @function +(label) +(instruction_prefix) @keyword +(instruction_name) @function.special +(register) @constant.builtin +(string) @string +(char) @constant.character +(type) @type +(constant "$" @constant) +(operand_modifier) @attribute + +(expression + ["-" "+" "*" "/" "="] @operator) + +["(" ")"] @punctuation.bracket + +["," ":"] @punctuation.delimiter diff --git a/runtime/queries/gas/injections.scm b/runtime/queries/gas/injections.scm new file mode 100644 index 000000000000..2f0e58eb6431 --- /dev/null +++ b/runtime/queries/gas/injections.scm @@ -0,0 +1,2 @@ +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/runtime/queries/gas/textobjects.scm b/runtime/queries/gas/textobjects.scm new file mode 100644 index 000000000000..4465c87686a6 --- /dev/null +++ b/runtime/queries/gas/textobjects.scm @@ -0,0 +1,2 @@ +(comment) @comment.inside +(comment)+ @comment.around