Skip to content

allow new lines and comments in lambda parameters #307

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 30, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
}