Skip to content

Commit

Permalink
allow new lines and comments in lambda parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
dten authored and ehuss committed Jul 30, 2018
1 parent 3663f1e commit 53ceb0f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
3 changes: 2 additions & 1 deletion RustEnhanced.sublime-syntax
Original file line number Diff line number Diff line change
Expand Up @@ -376,9 +376,10 @@ contexts:
# scope as soon as we hit something that it not a
# valid part so the whole rest of the document isn't
# highlighted using the params scope
- include: comments
- match: '(?=\()'
push: group
- match: '(?=[};)\]\n])'
- match: '(?=[};)\]])'
pop: true
- match: '\|'
scope: punctuation.definition.parameters.end.rust
Expand Down
16 changes: 16 additions & 0 deletions syntax_test_rust.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1558,3 +1558,19 @@ type A3 = dyn<<dyn as dyn>::dyn>;
// ^^^ meta.generic storage.type.trait
// ^^^ meta.generic -storage.type.trait
// ^^^ meta.generic -storage.type.trait

fn lambdas() {
let c = |foo,
// ^ meta.function.closure meta.function.parameters punctuation.definition.parameters.begin
// ^^^ meta.function.parameters variable.parameter
bar| {};
// ^^^ meta.function.parameters variable.parameter
// ^ meta.function.closure meta.function.parameters punctuation.definition.parameters.end
let c = |foo, // weird, but should work
// ^ meta.function.closure meta.function.parameters punctuation.definition.parameters.begin
// ^^^ meta.function.parameters variable.parameter
// ^^^^^^^^^^^^^^^^^^^^^^^^^ comment.line
bar| {};
// ^^^ meta.function.parameters variable.parameter
// ^ meta.function.closure meta.function.parameters punctuation.definition.parameters.end
}

0 comments on commit 53ceb0f

Please sign in to comment.