Skip to content

Commit

Permalink
fix: add regex to ignored layer configs
Browse files Browse the repository at this point in the history
  • Loading branch information
nik-rev committed Feb 3, 2025
1 parent b64af74 commit 9adb297
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
7 changes: 3 additions & 4 deletions helix-core/src/syntax.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1449,14 +1449,13 @@ impl Syntax {
if is_encompassing {
let this_gap = ts_range.end_byte - ts_range.start_byte;
if this_gap < min_gap
// ignore the "comment" language family
// as that would mean we can't uncomment anything, or
// the comments would be incorrect.
// ignore the language family for which it won't make
// sense to consider their comment.
//
// Since uncommenting would attempt to use the comment
// language's non-existing comment tokens
// TODO: add this as a language configuration key?
&& !matches!(self.layer_config(layer_id).language_name.as_ref(), "jsdoc" | "comment")
&& !matches!(self.layer_config(layer_id).language_name.as_ref(), "jsdoc" | "comment" | "regex")
{
best_fit = Some(layer_id);
min_gap = this_gap;
Expand Down
3 changes: 1 addition & 2 deletions languages.toml
Original file line number Diff line number Diff line change
Expand Up @@ -1346,8 +1346,7 @@ scope = "source.svelte"
injection-regex = "svelte"
file-types = ["svelte"]
indent = { tab-width = 2, unit = " " }
comment-token = "//"
block-comment-tokens = { start = "/*", end = "*/" }
block-comment-tokens = { start = "<!--", end = "-->" }
language-servers = [ "svelteserver" ]

[[grammar]]
Expand Down

0 comments on commit 9adb297

Please sign in to comment.