Compare commits

...

7 Commits

Author SHA1 Message Date
Waldir Pimenta d79e841d30
Merge 044a61f270 into 362e97e927 2025-06-16 10:17:25 -05:00
Michael Davis 362e97e927
Update tree-house to v0.3.0
This release contains some fixes to highlight ordering which could cause
panics in the markdown component for highlights arriving out of order.
2025-06-16 10:27:19 -04:00
Michael Davis ba54b6afe4
LSP: Short-circuit documentColors request for no servers
This fixes a deadlock when starting Helix with very many files, like
`hx runtime/queries/*/*.scm`. The tree-sitter query files don't have
an active language server on my machine and yet we were spawning a tokio
task to collect documentColors responses. We can skip that entirely.
Further debugging is needed to figure out why this lead to a deadlock
previously.
2025-06-16 09:42:48 -04:00
Tatesa Uradnik 837627dd8a
feat: allow moving nonexistent file (#13748) 2025-06-16 08:19:28 -05:00
CalebLarsen 1246549afd
Fix: update c++ highlights (#13772) 2025-06-16 08:04:22 -05:00
uncenter ada8004ea5
Highlight HTML entities (#13753) 2025-06-16 08:03:02 -05:00
Waldir Pimenta 044a61f270 Rephrase tutorial instructions to avoid ambiguity 2025-06-14 19:24:04 +01:00
9 changed files with 151 additions and 66 deletions

4
Cargo.lock generated
View File

@ -2810,9 +2810,9 @@ checksum = "5d99f8c9a7727884afe522e9bd5edbfc91a3312b36a77b5fb8926e4c31a41801"
[[package]] [[package]]
name = "tree-house" name = "tree-house"
version = "0.2.0" version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "679e3296e503901cd9f6e116be5a43a9270222215bf6c78b4b1f4af5c3dcc62d" checksum = "d00ea55222392f171ae004dd13b62edd09d995633abf0c13406a8df3547fb999"
dependencies = [ dependencies = [
"arc-swap", "arc-swap",
"hashbrown 0.15.4", "hashbrown 0.15.4",

View File

@ -37,7 +37,7 @@ package.helix-tui.opt-level = 2
package.helix-term.opt-level = 2 package.helix-term.opt-level = 2
[workspace.dependencies] [workspace.dependencies]
tree-house = { version = "0.2.0", default-features = false } tree-house = { version = "0.3.0", default-features = false }
nucleo = "0.5.0" nucleo = "0.5.0"
slotmap = "1.0.7" slotmap = "1.0.7"
thiserror = "2.0" thiserror = "2.0"

View File

@ -81,6 +81,10 @@ fn request_document_colors(editor: &mut Editor, doc_id: DocumentId) {
}) })
.collect(); .collect();
if futures.is_empty() {
return;
}
tokio::spawn(async move { tokio::spawn(async move {
let mut all_colors = Vec::new(); let mut all_colors = Vec::new();
loop { loop {

View File

@ -1437,7 +1437,11 @@ impl Editor {
log::error!("failed to apply workspace edit: {err:?}") log::error!("failed to apply workspace edit: {err:?}")
} }
} }
fs::rename(old_path, &new_path)?;
if old_path.exists() {
fs::rename(old_path, &new_path)?;
}
if let Some(doc) = self.document_by_path(old_path) { if let Some(doc) = self.document_by_path(old_path) {
self.set_doc_path(doc.id(), &new_path); self.set_doc_path(doc.id(), &new_path);
} }

View File

@ -937,7 +937,7 @@ indent = { tab-width = 2, unit = " " }
[[grammar]] [[grammar]]
name = "html" name = "html"
source = { git = "https://github.com/tree-sitter/tree-sitter-html", rev = "29f53d8f4f2335e61bf6418ab8958dac3282077a" } source = { git = "https://github.com/tree-sitter/tree-sitter-html", rev = "cbb91a0ff3621245e890d1c50cc811bffb77a26b" }
[[language]] [[language]]
name = "python" name = "python"

View File

@ -1,3 +1,48 @@
; inherits: html (tag_name) @tag
(erroneous_end_tag_name) @error
(doctype) @constant
(attribute_name) @attribute
(comment) @comment
((attribute
(attribute_name) @attribute
(quoted_attribute_value (attribute_value) @markup.link.url))
(#any-of? @attribute "href" "src"))
((element
(start_tag
(tag_name) @tag)
(text) @markup.link.label)
(#eq? @tag "a"))
(attribute [(attribute_value) (quoted_attribute_value)] @string)
((element
(start_tag
(tag_name) @tag)
(text) @markup.bold)
(#any-of? @tag "strong" "b"))
((element
(start_tag
(tag_name) @tag)
(text) @markup.italic)
(#any-of? @tag "em" "i"))
((element
(start_tag
(tag_name) @tag)
(text) @markup.strikethrough)
(#any-of? @tag "s" "del"))
[
"<"
">"
"</"
"/>"
"<!"
] @punctuation.bracket
"=" @punctuation.delimiter
["---"] @punctuation.delimiter ["---"] @punctuation.delimiter

View File

@ -12,8 +12,6 @@
(namespace_definition name: (namespace_identifier) @namespace) (namespace_definition name: (namespace_identifier) @namespace)
(namespace_identifier) @namespace (namespace_identifier) @namespace
(qualified_identifier name: (identifier) @type.enum.variant)
(auto) @type (auto) @type
"decltype" @type "decltype" @type
@ -21,12 +19,29 @@
(reference_declarator ["&" "&&"] @type.builtin) (reference_declarator ["&" "&&"] @type.builtin)
(abstract_reference_declarator ["&" "&&"] @type.builtin) (abstract_reference_declarator ["&" "&&"] @type.builtin)
; -------
; Functions ; Functions
; -------
; Support up to 4 levels of nesting of qualifiers
; i.e. a::b::c::d::func();
(call_expression (call_expression
function: (qualified_identifier function: (qualified_identifier
name: (identifier) @function)) name: (identifier) @function))
(call_expression
function: (qualified_identifier
name: (qualified_identifier
name: (identifier) @function)))
(call_expression
function: (qualified_identifier
name: (qualified_identifier
name: (qualified_identifier
name: (identifier) @function))))
(call_expression
function: (qualified_identifier
name: (qualified_identifier
name: (qualified_identifier
name: (qualified_identifier
name: (identifier) @function)))))
(template_function (template_function
name: (identifier) @function) name: (identifier) @function)
@ -34,26 +49,42 @@
(template_method (template_method
name: (field_identifier) @function) name: (field_identifier) @function)
; Support up to 3 levels of nesting of qualifiers ; Support up to 4 levels of nesting of qualifiers
; i.e. a::b::c::func(); ; i.e. a::b::c::d::func();
(function_declarator (function_declarator
declarator: (qualified_identifier declarator: (qualified_identifier
name: (identifier) @function)) name: (identifier) @function))
(function_declarator (function_declarator
declarator: (qualified_identifier declarator: (qualified_identifier
name: (qualified_identifier name: (qualified_identifier
name: (identifier) @function))) name: (identifier) @function)))
(function_declarator (function_declarator
declarator: (qualified_identifier declarator: (qualified_identifier
name: (qualified_identifier name: (qualified_identifier
name: (qualified_identifier name: (qualified_identifier
name: (identifier) @function)))) name: (identifier) @function))))
(function_declarator
declarator: (qualified_identifier
name: (qualified_identifier
name: (qualified_identifier
name: (qualified_identifier
name: (identifier) @function)))))
(function_declarator (function_declarator
declarator: (field_identifier) @function) declarator: (field_identifier) @function)
; Constructors
(class_specifier
(type_identifier) @type
(field_declaration_list
(function_definition
(function_declarator
(identifier) @constructor)))
(#eq? @type @constructor))
(destructor_name "~" @constructor
(identifier) @constructor)
; Parameters ; Parameters
(parameter_declaration (parameter_declaration

View File

@ -2,6 +2,7 @@
(erroneous_end_tag_name) @error (erroneous_end_tag_name) @error
(doctype) @constant (doctype) @constant
(attribute_name) @attribute (attribute_name) @attribute
(entity) @string.special.symbol
(comment) @comment (comment) @comment
((attribute ((attribute

View File

@ -90,7 +90,7 @@
= 1.3 DELETION = = 1.3 DELETION =
================================================================= =================================================================
Type the d key to delete the character under the cursor. Typing the d key deletes the character under the cursor.
1. Move the cursor to the line marked '-->' below. 1. Move the cursor to the line marked '-->' below.
2. Move the cursor to each extra character, and type d to 2. Move the cursor to each extra character, and type d to
@ -112,7 +112,7 @@
= 1.4 INSERT MODE = = 1.4 INSERT MODE =
================================================================= =================================================================
Type the i key to enter Insert mode. Typing the i key enters Insert mode.
1. Move the cursor to the line marked '-->' below. 1. Move the cursor to the line marked '-->' below.
2. Move to a place in the line which is missing text and type 2. Move to a place in the line which is missing text and type
@ -134,7 +134,7 @@
= 1.5 SAVING A FILE = = 1.5 SAVING A FILE =
================================================================= =================================================================
Type :w / :write to save a file. Typing :w / :write saves a file.
1. Exit Helix using :q! as explained before, or open a new 1. Exit Helix using :q! as explained before, or open a new
terminal. terminal.
@ -200,8 +200,8 @@
= 2.2 OPENING LINES = = 2.2 OPENING LINES =
================================================================= =================================================================
Type o to add a newline and insert below the cursor. Typing o adds a newline and starts inserting below the cursor.
Type O to add a newline and insert above the cursor. Typing O adds a newline and starts inserting above the cursor.
1. Move the cursor to the line marked '-->' below. 1. Move the cursor to the line marked '-->' below.
2. Type o to open a line below and type your answer. 2. Type o to open a line below and type your answer.
@ -244,7 +244,7 @@
= 3.1 MOTIONS AND SELECTIONS = = 3.1 MOTIONS AND SELECTIONS =
================================================================= =================================================================
Type w to select forward until the next word. Typing w selects forward until the next word.
The d key doesn't actually delete the character at the cursor, The d key doesn't actually delete the character at the cursor,
it deletes all selected text. Your cursor is like a it deletes all selected text. Your cursor is like a
@ -310,7 +310,7 @@
= 3.4 THE CHANGE COMMAND = = 3.4 THE CHANGE COMMAND =
================================================================= =================================================================
Type c to change the current selection. Typing c changes the current selection.
The change command deletes the current selection and enters The change command deletes the current selection and enters
Insert mode, so it is a very common shorthand for di. Insert mode, so it is a very common shorthand for di.
@ -332,7 +332,7 @@
= 3.5 COUNTS WITH MOTIONS = = 3.5 COUNTS WITH MOTIONS =
================================================================= =================================================================
Type a number before a motion to repeat it that many times. Typing a number before a motion repeats it that many times.
1. Move the cursor to the line marked '-->' below. 1. Move the cursor to the line marked '-->' below.
2. Type 2w to move 2 words forward. 2. Type 2w to move 2 words forward.
@ -354,8 +354,8 @@
= 3.6 SELECT / EXTEND MODE = = 3.6 SELECT / EXTEND MODE =
================================================================= =================================================================
Type v to enter Select mode. Typing v enters Select mode.
Type v again or Escape to return to Normal mode Typing v again or Escape returns to Normal mode
In Select mode every movement will extend the selection, as In Select mode every movement will extend the selection, as
opposed to replacing it. opposed to replacing it.
@ -376,7 +376,7 @@
= 3.7 SELECTING LINES = = 3.7 SELECTING LINES =
================================================================= =================================================================
Type x to select a whole line. Type x again to select the next. Typing x selects a whole line. Typing x again selects the next.
1. Move the cursor to the second line marked '-->' below. 1. Move the cursor to the second line marked '-->' below.
2. Type x to select the line, and d to delete it. 2. Type x to select the line, and d to delete it.
@ -398,7 +398,7 @@
= 3.8 COLLAPSING SELECTIONS = = 3.8 COLLAPSING SELECTIONS =
================================================================= =================================================================
Type ; to collapse selections to single cursors. Typing ; collapses selections to single cursors.
Sometimes, you want to deselect without having to move the Sometimes, you want to deselect without having to move the
cursor(s). This can be done using the ; key. cursor(s). This can be done using the ; key.
@ -464,9 +464,9 @@
= 4.2 COPYING AND PASTING TEXT = = 4.2 COPYING AND PASTING TEXT =
================================================================= =================================================================
Type y to yank (copy) the selection. Typing y yanks (copies) the selection.
Type p to paste the yanked selection after the cursor. Typing p pastes the yanked selection after the cursor.
Type P to paste the yanked text before the cursor. Typing P pastes the yanked text before the cursor.
1. Move the cursor to the line marked '-->' below. 1. Move the cursor to the line marked '-->' below.
Make sure your cursor is on the "b" of banana. Make sure your cursor is on the "b" of banana.
@ -486,9 +486,9 @@
= 4.3 SEARCHING IN FILE = = 4.3 SEARCHING IN FILE =
================================================================= =================================================================
Type / to search forward in file, Enter to confirm search. Typing / searches forward in file, and Enter confirms the search.
Type n to go to the next search match. Typing n goes to the next search match.
Type N to go to the previous search match. Typing N goes to the previous search match.
1. Type / and type in a common word, like 'banana'. 1. Type / and type in a common word, like 'banana'.
2. Press Enter to confirm the search. 2. Press Enter to confirm the search.
@ -530,7 +530,7 @@
= 5.1 MULTIPLE CURSORS = = 5.1 MULTIPLE CURSORS =
================================================================= =================================================================
Type C to duplicate the cursor to the next suitable line. Typing C duplicates the cursor to the next suitable line.
1. Move the cursor to the first line marked '-->' below. Place 1. Move the cursor to the first line marked '-->' below. Place
the cursor somewhere past the '-->'. the cursor somewhere past the '-->'.
@ -552,7 +552,7 @@
= 5.2 THE SELECT COMMAND = = 5.2 THE SELECT COMMAND =
================================================================= =================================================================
Type s to select matches in the selection. Typing s selects matches in the selection.
1. Move the cursor to the line marked '-->' below. 1. Move the cursor to the line marked '-->' below.
2. Type x to select the line. 2. Type x to select the line.
@ -596,7 +596,7 @@
= 5.4 ALIGN SELECTIONS = = 5.4 ALIGN SELECTIONS =
================================================================= =================================================================
Type & to align the contents of the selections. Typing & aligns the contents of the selections.
1. Move the cursor to the first line marked '-->' below. Place 1. Move the cursor to the first line marked '-->' below. Place
the cursor on the whitespace just after the arrow. the cursor on the whitespace just after the arrow.
@ -618,7 +618,7 @@
= 5.5 SPLIT SELECTION INTO LINES = = 5.5 SPLIT SELECTION INTO LINES =
================================================================= =================================================================
Press Alt-s to split the selection(s) on newlines. Pressing Alt-s splits the selection(s) on newlines.
1. Move the cursor to the first row of the table below. 1. Move the cursor to the first row of the table below.
2. Select the entire table with 6x. 2. Select the entire table with 6x.
@ -662,9 +662,9 @@
= 6.1 SELECTING TO A CHARACTER = = 6.1 SELECTING TO A CHARACTER =
================================================================= =================================================================
Type f<ch> to select up to and including (find) a character. Typing f<ch> (find) selects up to and including a character.
Type t<ch> to do the same, but not including (till) a character. Typing t<ch> (till) does the same, but not including a character.
Type uppercase F / T to do the same backwards. Typing uppercase F / T does the same backwards.
1. Move the cursor to the line marked '-->' below. Place the 1. Move the cursor to the line marked '-->' below. Place the
cursor on the first dash. cursor on the first dash.
@ -684,7 +684,7 @@
= 6.2 THE REPLACE COMMAND = = 6.2 THE REPLACE COMMAND =
================================================================= =================================================================
Type r<ch> to replace all selected characters with <ch>. Typing r<ch> replaces all selected characters with <ch>.
1. Move to the second line of the table, place the cursor on the 1. Move to the second line of the table, place the cursor on the
first =. first =.
@ -706,8 +706,8 @@
= 6.3 REPETITION = = 6.3 REPETITION =
================================================================= =================================================================
Type . to repeat the last insert command. Typing . repeats the last insert command.
Press Alt-. to repeat the last f / t selection. Pressing Alt-. repeats the last f / t selection.
1. Move the cursor to the line marked '-->' below. 1. Move the cursor to the line marked '-->' below.
2. Make a change, insertion or appendage and repeat it with . . 2. Make a change, insertion or appendage and repeat it with . .
@ -750,7 +750,7 @@
= 7.1 REPLACE WITH YANKED TEXT = = 7.1 REPLACE WITH YANKED TEXT =
================================================================= =================================================================
Type R to replace the selection with previously yanked text. Typing R replaces the selection with previously yanked text.
1. Move the cursor to the line marked '-->' below. 1. Move the cursor to the line marked '-->' below.
2. Type w to select "watermelons" and then y to yank it. 2. Type w to select "watermelons" and then y to yank it.
@ -772,7 +772,7 @@
= 7.2 JOINING LINES = = 7.2 JOINING LINES =
================================================================= =================================================================
Type J to join together lines in selection. Typing J joins together lines in selection.
1. Move the cursor to the line marked '-->' below. 1. Move the cursor to the line marked '-->' below.
2. Type x four times or 4x to select all four lines. 2. Type x four times or 4x to select all four lines.
@ -794,7 +794,7 @@ lines.
= 7.3 INDENTING LINES = = 7.3 INDENTING LINES =
================================================================= =================================================================
Type > to indent a line and < to unindent it. Typing > indents a line, and < unindents it.
1. Move the cursor to the line marked '-->' below. 1. Move the cursor to the line marked '-->' below.
2. Move down to the second line and type > to indent it. 2. Move down to the second line and type > to indent it.
@ -816,8 +816,8 @@ lines.
= 7.4 INCREMENTING AND DECREMENTING = = 7.4 INCREMENTING AND DECREMENTING =
================================================================= =================================================================
Press Ctrl-a to increment the number under selection. Pressing Ctrl-a increments the number under selection.
Press Ctrl-x to decrement the number under selection. Pressing Ctrl-x decrements the number under selection.
1. Move the cursor to the third line marked '-->' below. 1. Move the cursor to the third line marked '-->' below.
2. Press Ctrl-a to increment the second point marked 2. 2. Press Ctrl-a to increment the second point marked 2.
@ -865,7 +865,7 @@ lines.
most recent search term as well as macros, which you'll learn most recent search term as well as macros, which you'll learn
about in the next section. about in the next section.
Type "<ch> to select register <ch>. Typing "<ch> selects register <ch>.
1. Move the cursor to the line marked '-->' below. 1. Move the cursor to the line marked '-->' below.
2. Type w to select "watermelons" and yank with y. 2. Type w to select "watermelons" and yank with y.
@ -884,9 +884,9 @@ lines.
Macros are a way to record a set of actions you want to repeat. Macros are a way to record a set of actions you want to repeat.
You can also record macros to a specific register (default @). You can also record macros to a specific register (default @).
Type Q to start recording a macro - you should see a popup at Typing Q starts recording a macro - you should see a popup at
the bottom of your screen. Type Q again to stop recording. the bottom of your screen. Typing Q again stops recording.
Type q to repeat the macro from register @ (the default). Typing q repeats the macro from register @ (the default).
1. Move the cursor to the first line marked '-->' below. 1. Move the cursor to the first line marked '-->' below.
Ensure your cursor is on the '>' of the arrow. Ensure your cursor is on the '>' of the arrow.
@ -930,7 +930,7 @@ lines.
n and N both refer to register /, this means we can set that n and N both refer to register /, this means we can set that
register without having to type in a search. register without having to type in a search.
Type * to copy the selection into register /, setting the search Typing * copies the selection into register /, setting the search
term to the selection. This copies the primary selection, which term to the selection. This copies the primary selection, which
you will learn about in the section on cycling selections. you will learn about in the section on cycling selections.
@ -974,10 +974,10 @@ lines.
searching or jumping to the definition of a function in code. It searching or jumping to the definition of a function in code. It
stores these in what's called the jumplist. stores these in what's called the jumplist.
Press Ctrl-s to manually save your current position to Pressing Ctrl-s manually saves your current position to
the jumplist. the jumplist.
Press Ctrl-i ("in") and Ctrl-o ("out") to move forward and Pressing Ctrl-i ("in") and Ctrl-o ("out") moves forward and
backwards in the jumplist respectively. backwards in the jumplist respectively.
1. Press Ctrl-s somewhere. 1. Press Ctrl-s somewhere.
@ -992,10 +992,10 @@ lines.
= 9.4 JUMP WITH TWO-CHARACTER LABELS = = 9.4 JUMP WITH TWO-CHARACTER LABELS =
================================================================= =================================================================
Type gw to enable the 2-character labels. The start of each word Typing gw enables the 2-character labels. The start of each word
will be replaced by 2 highlighted characters. Type any sequence will be replaced by 2 highlighted characters. You can then type
of 2 highlighted characters to jump to the corresponding label, any sequence of 2 highlighted characters to jump to the
or use ESC to drop the labels. corresponding label, or use ESC to drop the labels.
The 2-character labels allow you to quickly jump to any location The 2-character labels allow you to quickly jump to any location
in the viewable selection. in the viewable selection.
@ -1036,10 +1036,10 @@ lines.
= 10.1 CYCLING AND REMOVING SELECTIONS = = 10.1 CYCLING AND REMOVING SELECTIONS =
================================================================= =================================================================
Type ) and ( to cycle the primary selection forward and backward Typing ) and ( cycles the primary selection forward and backward
through selections respectively. through selections respectively.
Press Alt-, to remove the primary selection. Pressing Alt-, removes the primary selection.
1. Move the cursor to the line marked '-->' below. 1. Move the cursor to the line marked '-->' below.
2. Select both lines with xx or 2x. 2. Select both lines with xx or 2x.
@ -1058,7 +1058,7 @@ lines.
= 10.2 CYCLING THE CONTENT OF SELECTIONS = = 10.2 CYCLING THE CONTENT OF SELECTIONS =
================================================================= =================================================================
Press Alt-) and Alt-( to cycle the content of the selections Pressing Alt-) and Alt-( cycles the content of the selections
forward and backward respectively. forward and backward respectively.
1. Move the cursor to the line marked '-->' below. 1. Move the cursor to the line marked '-->' below.
@ -1080,9 +1080,9 @@ lines.
= 10.3 CHANGING CASE = = 10.3 CHANGING CASE =
================================================================= =================================================================
Type ~ to switch the case of all selected letters. Typing ~ switches the case of all selected letters.
Type ` to set all selected letters to lowercase. Typing ` sets all selected letters to lowercase.
Press Alt-` to set all selected letters to uppercase. Pressing Alt-` sets all selected letters to uppercase.
1. Move the cursor to the first line marked '-->' below. 1. Move the cursor to the first line marked '-->' below.
2. Select each wrongly capitalised or lowercase letter 2. Select each wrongly capitalised or lowercase letter
@ -1102,7 +1102,7 @@ lines.
= 10.4 SPLITTING SELECTIONS = = 10.4 SPLITTING SELECTIONS =
================================================================= =================================================================
Type S to split each selection on a regex pattern. Typing S splits each selection on a regex pattern.
1. Move the cursor to the line under ---. 1. Move the cursor to the line under ---.
2. Type xx / 2x to select the lines. 2. Type xx / 2x to select the lines.
@ -1146,7 +1146,7 @@ letters! that is not good grammar. you can fix this.
= 11.1 COMMENTING A LINE = = 11.1 COMMENTING A LINE =
================================================================= =================================================================
Press Ctrl-c to comment the line under your cursor. Pressing Ctrl-c comments the line under your cursor.
To uncomment the line, press Ctrl-c again. To uncomment the line, press Ctrl-c again.
1. Move your cursor to the line marked '-->' below. 1. Move your cursor to the line marked '-->' below.