summaryrefslogtreecommitdiff
path: root/src/ide
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2023-02-12 20:23:52 +0100
committerLaurenz <laurmaedje@gmail.com>2023-02-12 20:25:24 +0100
commit7b2cdb9d95331bba87f9ae54c71b7103a10faf1c (patch)
tree8b0581fd14849e6a6ceaa9527ed8534e05d2b695 /src/ide
parent77c29b36d4e8706163c8d52359577e403a15a1ae (diff)
Require colon in show rule
Diffstat (limited to 'src/ide')
-rw-r--r--src/ide/complete.rs6
-rw-r--r--src/ide/highlight.rs7
2 files changed, 10 insertions, 3 deletions
diff --git a/src/ide/complete.rs b/src/ide/complete.rs
index d6879cca..8db1bf82 100644
--- a/src/ide/complete.rs
+++ b/src/ide/complete.rs
@@ -724,6 +724,12 @@ fn code_completions(ctx: &mut CompletionContext, hashtag: bool) {
);
ctx.snippet_completion(
+ "show rule (everything)",
+ "show: ${}",
+ "Transforms everything that follows.",
+ );
+
+ ctx.snippet_completion(
"let binding",
"let ${name} = ${value}",
"Saves a value in a variable.",
diff --git a/src/ide/highlight.rs b/src/ide/highlight.rs
index c12cb87a..7827b2c9 100644
--- a/src/ide/highlight.rs
+++ b/src/ide/highlight.rs
@@ -279,9 +279,10 @@ fn highlight_ident(node: &LinkedNode) -> Option<Tag> {
ancestor = ancestor.parent()?;
}
- // Are we directly before a show rule colon?
- if next_leaf.map(|leaf| leaf.kind()) == Some(SyntaxKind::Colon)
- && ancestor.parent_kind() == Some(SyntaxKind::ShowRule)
+ // Are we directly before or behind a show rule colon?
+ if ancestor.parent_kind() == Some(SyntaxKind::ShowRule)
+ && (next_leaf.map(|leaf| leaf.kind()) == Some(SyntaxKind::Colon)
+ || node.prev_leaf().map(|leaf| leaf.kind()) == Some(SyntaxKind::Colon))
{
return Some(Tag::Function);
}