From 094f2c1f262707e312aee98d5c046154247e581f Mon Sep 17 00:00:00 2001 From: David Hewson Date: Mon, 24 Apr 2017 23:10:21 +0100 Subject: [PATCH] writeln!(w) breaks formatting the special case for `writeln!` expects there to always be a format string, this isn't actually required any more which breaks formatting until the next , writeln might not have format string with tests --- RustEnhanced.sublime-syntax | 3 ++- syntax_test_rust.rs | 22 ++++++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/RustEnhanced.sublime-syntax b/RustEnhanced.sublime-syntax index b2ca4a5d..7b5e7496 100644 --- a/RustEnhanced.sublime-syntax +++ b/RustEnhanced.sublime-syntax @@ -173,7 +173,7 @@ contexts: 1: support.macro.rust 2: meta.group.rust punctuation.definition.group.begin.rust push: - - meta_content_scope: meta.group.rust + - meta_scope: meta.group.rust - include: comments - match: ',' set: @@ -182,6 +182,7 @@ contexts: - include: format-raw-string - match: '(?=\S)' set: group-tail + - include: group-tail - match: '\b[[:lower:]_][[:lower:][:digit:]_]*!(?=\s*(\(|\{|\[))' scope: support.macro.rust diff --git a/syntax_test_rust.rs b/syntax_test_rust.rs index 1375de86..8239ea1f 100644 --- a/syntax_test_rust.rs +++ b/syntax_test_rust.rs @@ -259,6 +259,28 @@ impl fmt::Display for PrintableStruct { // ^^^^ string.quoted.double // ^^ constant.other.placeholder // ^ punctuation.definition.group.end + write!(get_writer(), "{}", "{}") +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function +// ^^^^^^ support.macro +// ^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.group +// ^^^^^^^^^^ support.function +// ^^^^ string.quoted.double +// ^^ constant.other.placeholder +// ^^^^ string.quoted.double +// ^ punctuation.definition.group.begin +// ^ punctuation.definition.group.end + writeln!(w) +// ^^^^^^^^^^^^^^^^ meta.function +// ^^^^^^^^ support.macro +// ^^^ meta.group +// ^ punctuation.definition.group.begin +// ^ punctuation.definition.group.end + println!() +// ^^^^^^^^^^^^^^^ meta.function +// ^^^^^^^^ support.macro +// ^^ meta.group +// ^ punctuation.definition.group.begin +// ^ punctuation.definition.group.end } // ^^ meta.function meta.block // ^ punctuation.definition.block.end