Skip to content

Commit 1d24597

Browse files
dtenunknown
authored and
unknown
committed
allow new lines and comments in lambda parameters
1 parent f653ba3 commit 1d24597

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

RustEnhanced.sublime-syntax

+2-1
Original file line numberDiff line numberDiff line change
@@ -367,9 +367,10 @@ contexts:
367367
# scope as soon as we hit something that it not a
368368
# valid part so the whole rest of the document isn't
369369
# highlighted using the params scope
370+
- include: comments
370371
- match: '(?=\()'
371372
push: group
372-
- match: '(?=[};)\]\n])'
373+
- match: '(?=[};)\]])'
373374
pop: true
374375
- match: '\|'
375376
scope: punctuation.definition.parameters.end.rust

syntax_test_rust.rs

+16
Original file line numberDiff line numberDiff line change
@@ -1352,3 +1352,19 @@ impl<A> Thing for &'a mut A {}
13521352
// ^^ meta.impl storage.modifier.lifetime
13531353
// ^^^ meta.impl storage.modifier
13541354
// ^ meta.impl entity.name.impl
1355+
1356+
fn lambdas() {
1357+
let c = |foo,
1358+
// ^ meta.function.closure meta.function.parameters punctuation.definition.parameters.begin
1359+
// ^^^ meta.function.parameters variable.parameter
1360+
bar| {};
1361+
// ^^^ meta.function.parameters variable.parameter
1362+
// ^ meta.function.closure meta.function.parameters punctuation.definition.parameters.end
1363+
let c = |foo, // weird, but should work
1364+
// ^ meta.function.closure meta.function.parameters punctuation.definition.parameters.begin
1365+
// ^^^ meta.function.parameters variable.parameter
1366+
// ^^^^^^^^^^^^^^^^^^^^^^^^^ comment.line
1367+
bar| {};
1368+
// ^^^ meta.function.parameters variable.parameter
1369+
// ^ meta.function.closure meta.function.parameters punctuation.definition.parameters.end
1370+
}

0 commit comments

Comments
 (0)