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]]
name = "tree-house"
version = "0.2.0"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "679e3296e503901cd9f6e116be5a43a9270222215bf6c78b4b1f4af5c3dcc62d"
checksum = "d00ea55222392f171ae004dd13b62edd09d995633abf0c13406a8df3547fb999"
dependencies = [
"arc-swap",
"hashbrown 0.15.4",

View File

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

View File

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

View File

@ -1437,7 +1437,11 @@ impl Editor {
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) {
self.set_doc_path(doc.id(), &new_path);
}

View File

@ -937,7 +937,7 @@ indent = { tab-width = 2, unit = " " }
[[grammar]]
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]]
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

View File

@ -12,8 +12,6 @@
(namespace_definition name: (namespace_identifier) @namespace)
(namespace_identifier) @namespace
(qualified_identifier name: (identifier) @type.enum.variant)
(auto) @type
"decltype" @type
@ -21,12 +19,29 @@
(reference_declarator ["&" "&&"] @type.builtin)
(abstract_reference_declarator ["&" "&&"] @type.builtin)
; -------
; Functions
; -------
; Support up to 4 levels of nesting of qualifiers
; i.e. a::b::c::d::func();
(call_expression
function: (qualified_identifier
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
name: (identifier) @function)
@ -34,26 +49,42 @@
(template_method
name: (field_identifier) @function)
; Support up to 3 levels of nesting of qualifiers
; i.e. a::b::c::func();
; Support up to 4 levels of nesting of qualifiers
; i.e. a::b::c::d::func();
(function_declarator
declarator: (qualified_identifier
name: (identifier) @function))
(function_declarator
declarator: (qualified_identifier
name: (qualified_identifier
name: (identifier) @function)))
(function_declarator
declarator: (qualified_identifier
name: (qualified_identifier
name: (qualified_identifier
name: (identifier) @function))))
(function_declarator
declarator: (qualified_identifier
name: (qualified_identifier
name: (qualified_identifier
name: (qualified_identifier
name: (identifier) @function)))))
(function_declarator
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
(parameter_declaration

View File

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

View File

@ -90,7 +90,7 @@
= 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.
2. Move the cursor to each extra character, and type d to
@ -112,7 +112,7 @@
= 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.
2. Move to a place in the line which is missing text and type
@ -134,7 +134,7 @@
= 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
terminal.
@ -200,8 +200,8 @@
= 2.2 OPENING LINES =
=================================================================
Type o to add a newline and insert below the cursor.
Type O to add a newline and insert above the cursor.
Typing o adds a newline and starts inserting below the cursor.
Typing O adds a newline and starts inserting above the cursor.
1. Move the cursor to the line marked '-->' below.
2. Type o to open a line below and type your answer.
@ -244,7 +244,7 @@
= 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,
it deletes all selected text. Your cursor is like a
@ -310,7 +310,7 @@
= 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
Insert mode, so it is a very common shorthand for di.
@ -332,7 +332,7 @@
= 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.
2. Type 2w to move 2 words forward.
@ -354,8 +354,8 @@
= 3.6 SELECT / EXTEND MODE =
=================================================================
Type v to enter Select mode.
Type v again or Escape to return to Normal mode
Typing v enters Select mode.
Typing v again or Escape returns to Normal mode
In Select mode every movement will extend the selection, as
opposed to replacing it.
@ -376,7 +376,7 @@
= 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.
2. Type x to select the line, and d to delete it.
@ -398,7 +398,7 @@
= 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
cursor(s). This can be done using the ; key.
@ -464,9 +464,9 @@
= 4.2 COPYING AND PASTING TEXT =
=================================================================
Type y to yank (copy) the selection.
Type p to paste the yanked selection after the cursor.
Type P to paste the yanked text before the cursor.
Typing y yanks (copies) the selection.
Typing p pastes the yanked selection after the cursor.
Typing P pastes the yanked text before the cursor.
1. Move the cursor to the line marked '-->' below.
Make sure your cursor is on the "b" of banana.
@ -486,9 +486,9 @@
= 4.3 SEARCHING IN FILE =
=================================================================
Type / to search forward in file, Enter to confirm search.
Type n to go to the next search match.
Type N to go to the previous search match.
Typing / searches forward in file, and Enter confirms the search.
Typing n goes to the next search match.
Typing N goes to the previous search match.
1. Type / and type in a common word, like 'banana'.
2. Press Enter to confirm the search.
@ -530,7 +530,7 @@
= 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
the cursor somewhere past the '-->'.
@ -552,7 +552,7 @@
= 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.
2. Type x to select the line.
@ -596,7 +596,7 @@
= 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
the cursor on the whitespace just after the arrow.
@ -618,7 +618,7 @@
= 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.
2. Select the entire table with 6x.
@ -662,9 +662,9 @@
= 6.1 SELECTING TO A CHARACTER =
=================================================================
Type f<ch> to select up to and including (find) a character.
Type t<ch> to do the same, but not including (till) a character.
Type uppercase F / T to do the same backwards.
Typing f<ch> (find) selects up to and including a character.
Typing t<ch> (till) does the same, but not including a character.
Typing uppercase F / T does the same backwards.
1. Move the cursor to the line marked '-->' below. Place the
cursor on the first dash.
@ -684,7 +684,7 @@
= 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
first =.
@ -706,8 +706,8 @@
= 6.3 REPETITION =
=================================================================
Type . to repeat the last insert command.
Press Alt-. to repeat the last f / t selection.
Typing . repeats the last insert command.
Pressing Alt-. repeats the last f / t selection.
1. Move the cursor to the line marked '-->' below.
2. Make a change, insertion or appendage and repeat it with . .
@ -750,7 +750,7 @@
= 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.
2. Type w to select "watermelons" and then y to yank it.
@ -772,7 +772,7 @@
= 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.
2. Type x four times or 4x to select all four lines.
@ -794,7 +794,7 @@ 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.
2. Move down to the second line and type > to indent it.
@ -816,8 +816,8 @@ lines.
= 7.4 INCREMENTING AND DECREMENTING =
=================================================================
Press Ctrl-a to increment the number under selection.
Press Ctrl-x to decrement the number under selection.
Pressing Ctrl-a increments the number under selection.
Pressing Ctrl-x decrements the number under selection.
1. Move the cursor to the third line marked '-->' below.
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
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.
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.
You can also record macros to a specific register (default @).
Type Q to start recording a macro - you should see a popup at
the bottom of your screen. Type Q again to stop recording.
Type q to repeat the macro from register @ (the default).
Typing Q starts recording a macro - you should see a popup at
the bottom of your screen. Typing Q again stops recording.
Typing q repeats the macro from register @ (the default).
1. Move the cursor to the first line marked '-->' below.
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
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
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
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.
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.
1. Press Ctrl-s somewhere.
@ -992,10 +992,10 @@ lines.
= 9.4 JUMP WITH TWO-CHARACTER LABELS =
=================================================================
Type gw to enable the 2-character labels. The start of each word
will be replaced by 2 highlighted characters. Type any sequence
of 2 highlighted characters to jump to the corresponding label,
or use ESC to drop the labels.
Typing gw enables the 2-character labels. The start of each word
will be replaced by 2 highlighted characters. You can then type
any sequence of 2 highlighted characters to jump to the
corresponding label, or use ESC to drop the labels.
The 2-character labels allow you to quickly jump to any location
in the viewable selection.
@ -1036,10 +1036,10 @@ lines.
= 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.
Press Alt-, to remove the primary selection.
Pressing Alt-, removes the primary selection.
1. Move the cursor to the line marked '-->' below.
2. Select both lines with xx or 2x.
@ -1058,7 +1058,7 @@ lines.
= 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.
1. Move the cursor to the line marked '-->' below.
@ -1080,9 +1080,9 @@ lines.
= 10.3 CHANGING CASE =
=================================================================
Type ~ to switch the case of all selected letters.
Type ` to set all selected letters to lowercase.
Press Alt-` to set all selected letters to uppercase.
Typing ~ switches the case of all selected letters.
Typing ` sets all selected letters to lowercase.
Pressing Alt-` sets all selected letters to uppercase.
1. Move the cursor to the first line marked '-->' below.
2. Select each wrongly capitalised or lowercase letter
@ -1102,7 +1102,7 @@ lines.
= 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 ---.
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 =
=================================================================
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.
1. Move your cursor to the line marked '-->' below.