diff --git a/RustEnhanced.sublime-syntax b/RustEnhanced.sublime-syntax index 0f33dd5b..0c8685f9 100644 --- a/RustEnhanced.sublime-syntax +++ b/RustEnhanced.sublime-syntax @@ -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 diff --git a/syntax_test_rust.rs b/syntax_test_rust.rs index 2b065b1b..22d29200 100644 --- a/syntax_test_rust.rs +++ b/syntax_test_rust.rs @@ -1558,3 +1558,19 @@ type A3 = 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 +}