summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ide/complete.rs6
-rw-r--r--src/ide/highlight.rs7
-rw-r--r--src/syntax/parser.rs5
3 files changed, 13 insertions, 5 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);
}
diff --git a/src/syntax/parser.rs b/src/syntax/parser.rs
index 8082fd64..cd318983 100644
--- a/src/syntax/parser.rs
+++ b/src/syntax/parser.rs
@@ -852,10 +852,11 @@ fn set_rule(p: &mut Parser) {
fn show_rule(p: &mut Parser) {
let m = p.marker();
p.assert(SyntaxKind::Show);
- code_expr(p);
- if p.eat_if(SyntaxKind::Colon) {
+ if !p.at(SyntaxKind::Colon) {
code_expr(p);
}
+ p.expect(SyntaxKind::Colon);
+ code_expr(p);
p.wrap(m, SyntaxKind::ShowRule);
}