Skip to content

Commit 75b02cf

Browse files
dtenJayflux
authored andcommitted
writeln!(w) breaks formatting (#177)
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
1 parent 1e0cdcb commit 75b02cf

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

RustEnhanced.sublime-syntax

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ contexts:
173173
1: support.macro.rust
174174
2: meta.group.rust punctuation.definition.group.begin.rust
175175
push:
176-
- meta_content_scope: meta.group.rust
176+
- meta_scope: meta.group.rust
177177
- include: comments
178178
- match: ','
179179
set:
@@ -182,6 +182,7 @@ contexts:
182182
- include: format-raw-string
183183
- match: '(?=\S)'
184184
set: group-tail
185+
- include: group-tail
185186

186187
- match: '\b[[:lower:]_][[:lower:][:digit:]_]*!(?=\s*(\(|\{|\[))'
187188
scope: support.macro.rust

syntax_test_rust.rs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,28 @@ impl fmt::Display for PrintableStruct {
259259
// ^^^^ string.quoted.double
260260
// ^^ constant.other.placeholder
261261
// ^ punctuation.definition.group.end
262+
write!(get_writer(), "{}", "{}")
263+
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function
264+
// ^^^^^^ support.macro
265+
// ^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.group
266+
// ^^^^^^^^^^ support.function
267+
// ^^^^ string.quoted.double
268+
// ^^ constant.other.placeholder
269+
// ^^^^ string.quoted.double
270+
// ^ punctuation.definition.group.begin
271+
// ^ punctuation.definition.group.end
272+
writeln!(w)
273+
// ^^^^^^^^^^^^^^^^ meta.function
274+
// ^^^^^^^^ support.macro
275+
// ^^^ meta.group
276+
// ^ punctuation.definition.group.begin
277+
// ^ punctuation.definition.group.end
278+
println!()
279+
// ^^^^^^^^^^^^^^^ meta.function
280+
// ^^^^^^^^ support.macro
281+
// ^^ meta.group
282+
// ^ punctuation.definition.group.begin
283+
// ^ punctuation.definition.group.end
262284
}
263285
// ^^ meta.function meta.block
264286
// ^ punctuation.definition.block.end

0 commit comments

Comments
 (0)