Compare commits

...

10 Commits

Author SHA1 Message Date
dependabot[bot] b47519ab11
build(deps): bump signal-hook from 0.3.15 to 0.3.16 (#7664)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
10 months ago
dependabot[bot] b87858b7b4
build(deps): bump indoc from 2.0.2 to 2.0.3 (#7663)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
10 months ago
dependabot[bot] 1478a0d3a6
build(deps): bump anyhow from 1.0.71 to 1.0.72 (#7662)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
10 months ago
dependabot[bot] 6d4fd77315
build(deps): bump serde_json from 1.0.100 to 1.0.103 (#7661)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
10 months ago
J. Brock 2fa576b177
Remove snap aliasing instructions (#7657)
The helix snap now gets aliased to hx by default at installation time,
so manual aliasing should no longer be required.

Signed-off-by: Joseph Brock <joseph.brock@protonmail.com>
10 months ago
Jesse Luehrs e7f60611ac
switch to https://github.com/tree-sitter-perl/tree-sitter-perl (#7644) 10 months ago
Jake Langford ad2061bab6
Update my name README.md (#7656) 10 months ago
Pascal Kuthe 8f1c6456f3
Clear statusline while prompt is visible (#7646) 10 months ago
Pascal Kuthe 68a98ac36b use a single query for injections
In the past we used two separate queries for combined and normal injections. There was no real reason for this (except historical/slightly easier implementation). Instead, we now use a single query and simply check if an injection corresponds to a combined injection or not.
10 months ago
Pascal Kuthe 2d5ff9ec8f fix crash when encountering overlapping injections 10 months ago

16
Cargo.lock generated

@ -81,9 +81,9 @@ dependencies = [
[[package]]
name = "anyhow"
version = "1.0.71"
version = "1.0.72"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c7d0618f0e0b7e8ff11427422b64564d5fb0be1940354bfe2e0529b18a9d9b8"
checksum = "3b13c32d80ecc7ab747b80c3784bce54ee8a7a0cc4fbda9bf4cda2cf6fe90854"
[[package]]
name = "arc-swap"
@ -1514,9 +1514,9 @@ dependencies = [
[[package]]
name = "indoc"
version = "2.0.2"
version = "2.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "761cde40c27e2a9877f8c928fd248b7eec9dd48623dd514b256858ca593fbba7"
checksum = "2c785eefb63ebd0e33416dfcb8d6da0bf27ce752843a45632a67bf10d4d4b5c4"
[[package]]
name = "instant"
@ -1992,9 +1992,9 @@ dependencies = [
[[package]]
name = "serde_json"
version = "1.0.100"
version = "1.0.103"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0f1e14e89be7aa4c4b78bdbdc9eb5bf8517829a600ae8eaa39a6e1d960b5185c"
checksum = "d03b412469450d4404fe8499a268edd7f8b79fecb074b0d812ad64ca21f4031b"
dependencies = [
"itoa",
"ryu",
@ -2029,9 +2029,9 @@ checksum = "ae1a47186c03a32177042e55dbc5fd5aee900b8e0069a8d70fba96a9375cd012"
[[package]]
name = "signal-hook"
version = "0.3.15"
version = "0.3.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "732768f1176d21d09e076c23a93123d40bba92d50c4058da34d45c8de8e682b9"
checksum = "b824b6e687aff278cdbf3b36f07aa52d4bd4099699324d5da86a2ebce3aa00b3"
dependencies = [
"libc",
"signal-hook-registry",

@ -61,4 +61,4 @@ Discuss the project on the community [Matrix Space](https://matrix.to/#/#helix-c
# Credits
Thanks to [@JakeHL](https://github.com/JakeHL) for designing the logo!
Thanks to [@jakenvac](https://github.com/jakenvac) for designing the logo!

@ -109,7 +109,7 @@
| pascal | ✓ | ✓ | | `pasls` |
| passwd | ✓ | | | |
| pem | ✓ | | | |
| perl | ✓ | | | `perlnavigator` |
| perl | ✓ | | | `perlnavigator` |
| php | ✓ | ✓ | ✓ | `intelephense` |
| po | ✓ | ✓ | | |
| ponylang | ✓ | ✓ | ✓ | |

@ -113,14 +113,7 @@ Helix is available on [Snapcraft](https://snapcraft.io/helix) and can be install
snap install --classic helix
```
This will install Helix as `/snap/bin/helix` (so make sure `/snap/bin` is in your `PATH`), which is not the preferred invocation (`hx`).
As a workaround you can manually alias the command globally with:
```sh
snap alias helix hx
```
Or, otherwise, just alias in your shell's config.
This will install Helix as both `/snap/bin/helix` and `/snap/bin/hx`, so make sure `/snap/bin` is in your `PATH`.
### AppImage

@ -50,4 +50,4 @@ textwrap = "0.16.0"
[dev-dependencies]
quickcheck = { version = "1", default-features = false }
indoc = "2.0.2"
indoc = "2.0.3"

@ -1135,12 +1135,38 @@ impl Syntax {
layer.tree().root_node(),
RopeProvider(source_slice),
);
let mut combined_injections = vec![
(None, Vec::new(), IncludedChildren::default());
layer.config.combined_injections_patterns.len()
];
let mut injections = Vec::new();
let mut last_injection_end = 0;
for mat in matches {
let (injection_capture, content_node, included_children) = layer
.config
.injection_for_match(&layer.config.injections_query, &mat, source_slice);
// in case this is a combined injection save it for more processing later
if let Some(combined_injection_idx) = layer
.config
.combined_injections_patterns
.iter()
.position(|&pattern| pattern == mat.pattern_index)
{
let entry = &mut combined_injections[combined_injection_idx];
if injection_capture.is_some() {
entry.0 = injection_capture;
}
if let Some(content_node) = content_node {
if content_node.start_byte() >= last_injection_end {
entry.1.push(content_node);
last_injection_end = content_node.end_byte();
}
}
entry.2 = included_children;
continue;
}
// Explicitly remove this match so that none of its other captures will remain
// in the stream of captures.
mat.remove();
@ -1155,49 +1181,23 @@ impl Syntax {
intersect_ranges(&layer.ranges, &[content_node], included_children);
if !ranges.is_empty() {
if content_node.start_byte() < last_injection_end {
continue;
}
last_injection_end = content_node.end_byte();
injections.push((config, ranges));
}
}
}
}
// Process combined injections.
if let Some(combined_injections_query) = &layer.config.combined_injections_query {
let mut injections_by_pattern_index =
vec![
(None, Vec::new(), IncludedChildren::default());
combined_injections_query.pattern_count()
];
let matches = cursor.matches(
combined_injections_query,
layer.tree().root_node(),
RopeProvider(source_slice),
);
for mat in matches {
let entry = &mut injections_by_pattern_index[mat.pattern_index];
let (injection_capture, content_node, included_children) = layer
.config
.injection_for_match(combined_injections_query, &mat, source_slice);
if injection_capture.is_some() {
entry.0 = injection_capture;
}
if let Some(content_node) = content_node {
entry.1.push(content_node);
}
entry.2 = included_children;
}
for (lang_name, content_nodes, included_children) in injections_by_pattern_index
{
if let (Some(lang_name), false) = (lang_name, content_nodes.is_empty()) {
if let Some(config) = (injection_callback)(&lang_name) {
let ranges = intersect_ranges(
&layer.ranges,
&content_nodes,
included_children,
);
if !ranges.is_empty() {
injections.push((config, ranges));
}
for (lang_name, content_nodes, included_children) in combined_injections {
if let (Some(lang_name), false) = (lang_name, content_nodes.is_empty()) {
if let Some(config) = (injection_callback)(&lang_name) {
let ranges =
intersect_ranges(&layer.ranges, &content_nodes, included_children);
if !ranges.is_empty() {
injections.push((config, ranges));
}
}
}
@ -1560,7 +1560,7 @@ pub struct HighlightConfiguration {
pub language: Grammar,
pub query: Query,
injections_query: Query,
combined_injections_query: Option<Query>,
combined_injections_patterns: Vec<usize>,
highlights_pattern_index: usize,
highlight_indices: ArcSwap<Vec<Option<Highlight>>>,
non_local_variable_patterns: Vec<bool>,
@ -1676,26 +1676,15 @@ impl HighlightConfiguration {
}
}
let mut injections_query = Query::new(language, injection_query)?;
// Construct a separate query just for dealing with the 'combined injections'.
// Disable the combined injection patterns in the main query.
let mut combined_injections_query = Query::new(language, injection_query)?;
let mut has_combined_queries = false;
for pattern_index in 0..injections_query.pattern_count() {
let settings = injections_query.property_settings(pattern_index);
if settings.iter().any(|s| &*s.key == "injection.combined") {
has_combined_queries = true;
injections_query.disable_pattern(pattern_index);
} else {
combined_injections_query.disable_pattern(pattern_index);
}
}
let combined_injections_query = if has_combined_queries {
Some(combined_injections_query)
} else {
None
};
let injections_query = Query::new(language, injection_query)?;
let combined_injections_patterns = (0..injections_query.pattern_count())
.filter(|&i| {
injections_query
.property_settings(i)
.iter()
.any(|s| &*s.key == "injection.combined")
})
.collect();
// Find all of the highlighting patterns that are disabled for nodes that
// have been identified as local variables.
@ -1744,7 +1733,7 @@ impl HighlightConfiguration {
language,
query,
injections_query,
combined_injections_query,
combined_injections_patterns,
highlights_pattern_index,
highlight_indices,
non_local_variable_patterns,

@ -78,5 +78,5 @@ helix-loader = { version = "0.6", path = "../helix-loader" }
[dev-dependencies]
smallvec = "1.11"
indoc = "2.0.2"
indoc = "2.0.3"
tempfile = "3.6.0"

@ -356,6 +356,7 @@ impl Prompt {
let completion_color = theme.get("ui.menu");
let selected_color = theme.get("ui.menu.selected");
let suggestion_color = theme.get("ui.text.inactive");
let background = theme.get("ui.background");
// completion
let max_len = self
@ -451,6 +452,7 @@ impl Prompt {
}
let line = area.height - 1;
surface.clear_with(area.clip_top(line), background);
// render buffer text
surface.set_string(area.x, area.y + line, &self.prompt, prompt_color);

@ -1112,7 +1112,7 @@ indent = { tab-width = 2, unit = " " }
[[grammar]]
name = "perl"
source = { git = "https://github.com/ganezdragon/tree-sitter-perl", rev = "0ac2c6da562c7a2c26ed7e8691d4a590f7e8b90a" }
source = { git = "https://github.com/tree-sitter-perl/tree-sitter-perl", rev = "ed21ecbcc128a6688770ebafd3ef68a1c9bc1ea9" }
[[language]]
name = "racket"

@ -0,0 +1,19 @@
(comment) @fold
(pod) @fold
; fold the block-typed package statements only
(package_statement (block)) @fold
[(subroutine_declaration_statement)
(conditional_statement)
(loop_statement)
(for_statement)
(cstyle_for_statement)
(block_statement)
(phaser_statement)] @fold
(anonymous_subroutine_expression) @fold
; perhaps folks want to fold these too?
[(anonymous_array_expression)
(anonymous_hash_expression)] @fold

@ -1,181 +1,100 @@
; Variables
(variable_declaration
.
(scope) @keyword)
[
(single_var_declaration)
(scalar_variable)
(array_variable)
(hash_variable)
(hash_variable)
] @variable
"use" "no" "require" "package"
] @keyword.control.import
[
(package_name)
(special_scalar_variable)
(special_array_variable)
(special_hash_variable)
(special_literal)
(super)
] @constant
(
[
(package_name)
(super)
]
.
("::" @operator)
)
(comments) @comment
(pod_statement) @comment.block.documentation
"sub"
] @keyword.function
[
(use_no_statement)
(use_no_feature_statement)
(use_no_if_statement)
(use_no_version)
(use_constant_statement)
(use_parent_statement)
] @keyword
(use_constant_statement
constant: (identifier) @constant)
"if" "elsif" "else" "unless"
] @keyword.control.conditional
[
"require"
] @keyword
(method_invocation
.
(identifier) @variable)
(method_invocation
(arrow_operator)
.
(identifier) @function)
(method_invocation
function_name: (identifier) @function)
(named_block_statement
function_name: (identifier) @function)
(call_expression
function_name: (identifier) @function)
(function_definition
name: (identifier) @function)
[
(function)
(map)
(grep)
(bless)
] @function
"while" "until"
"for" "foreach"
"do"
] @keyword.control.repeat
[
"return"
"sub"
"package"
"BEGIN"
"END"
] @keyword.function
"my" "our" "local"
] @keyword.storage.modifier
[
"("
")"
"["
"]"
"{"
"}"
] @punctuation.bracket
(standard_input_to_variable) @punctuation.bracket
"last" "next" "redo" "goto" "return"
] @keyword.control.return
[
"=~"
"or"
"="
"=="
"+"
"-"
"."
"//"
"||"
(arrow_operator)
(hash_arrow_operator)
(array_dereference)
(hash_dereference)
(to_reference)
(type_glob)
(hash_access_variable)
(ternary_expression)
(ternary_expression_in_hash)
] @operator
"undef"
] @constant.builtin
[
(regex_option)
(regex_option_for_substitution)
(regex_option_for_transliteration)
] @variable.parameter
(type_glob
(identifier) @variable)
(
(scalar_variable)
.
("->" @operator))
(phaser_statement phase: _ @keyword.directive)
[
(word_list_qw)
(command_qx_quoted)
(string_single_quoted)
(string_double_quoted)
(string_qq_quoted)
(bareword)
(transliteration_tr_or_y)
] @string
"or" "and"
"eq" "ne" "cmp" "lt" "le" "ge" "gt"
"isa"
] @keyword.operator
[
(regex_pattern_qr)
(patter_matcher_m)
(substitution_pattern_s)
] @string.regexp
(comment) @comment
(escape_sequence) @string.special
(eof_marker) @keyword.directive
(data_section) @comment
[
","
(semi_colon)
(start_delimiter)
(end_delimiter)
(ellipsis_statement)
] @punctuation.delimiter
(pod) @comment.block.documentation
[
(integer)
(floating_point)
(scientific_notation)
(hexadecimal)
] @constant.numeric
(number) @constant.numeric
(version) @constant
[
; (if_statement)
(unless_statement)
(if_simple_statement)
(unless_simple_statement)
] @keyword.control.conditional
(string_literal) @string
(interpolated_string_literal) @string
(quoted_word_list) @string
(command_string) @string
[(heredoc_token) (command_heredoc_token)] @string.special
(heredoc_content) @string
(heredoc_end) @string.special
[(escape_sequence) (escaped_delimiter)] @constant.character.escape
[
"if"
"elsif"
"else"
] @keyword.control.conditional
[(quoted_regexp) (match_regexp)] @string.regexp
(autoquoted_bareword _?) @string.special
[(scalar) (arraylen)] @variable
(scalar_deref_expression ["->" "$" "*"] @variable)
(array) @variable
(array_deref_expression ["->" "@" "*"] @variable)
(hash) @variable
(hash_deref_expression ["->" "%" "*"] @variable)
(array_element_expression [array:(_) "->" "[" "]"] @variable)
(slice_expression [array:(_) "->" "[" "]"] @variable)
(keyval_expression [array:(_) "->" "[" "]"] @variable)
(hash_element_expression [hash:(_) "->" "{" "}"] @variable)
(slice_expression [hash:(_) "->" "[" "]"] @variable)
(keyval_expression [hash:(_) "->" "[" "]"] @variable)
(hash_element_expression key: (bareword) @string.special)
(use_statement (package) @type)
(package_statement (package) @type)
(require_expression (bareword) @type)
(subroutine_declaration_statement name: (_) @function)
(attrlist (attribute) @attribute)
(goto_expression (label) @label)
(loopex_expression (label) @label)
(statement_label label: _ @label)
(foreach_statement) @keyword.control.repeat
(foreach_statement
.
(scope) @keyword)
(relational_expression operator: "isa" right: (bareword) @type)
(function_attribute) @label
(function_call_expression (function) @function)
(method_call_expression (method) @function.method)
(method_call_expression invocant: (bareword) @type)
(function_signature) @type
(func0op_call_expression function: _ @function.builtin)
(func1op_call_expression function: _ @function.builtin)
(function) @function

@ -1,15 +0,0 @@
[
(function)
(identifier)
(method_invocation)
(if_statement)
(unless_statement)
(if_simple_statement)
(unless_simple_statement)
(variable_declaration)
(block)
(list_item)
(word_list_qw)
] @indent
"}" @outdent

@ -1,2 +1,2 @@
((comments) @injection.content
((comment) @injection.content
(#set! injection.language "comment"))

@ -1,17 +0,0 @@
(function_definition
(identifier) (_) @function.inside) @function.around
(anonymous_function
(_) @function.inside) @function.around
(argument
(_) @parameter.inside)
[
(comments)
(pod_statement)
] @comment.inside
(comments)+ @comment.around
(pod_statement) @comment.around
Loading…
Cancel
Save