This repository has been archived by the owner on May 16, 2020. It is now read-only.
forked from Unity-Technologies/uncrustify
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request Unity-Technologies#82 from Unity-Technologies/fixe…
…s/force-string-literal-to-column-1 Fixes/force string literal to column 1
- Loading branch information
Showing
7 changed files
with
93 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,45 @@ | ||
// This has to do with the @" that opens a literal string getting aligned when we don't want it to. | ||
// Test code: | ||
// As discussed with unity updating the test case | ||
|
||
void Func() | ||
{ | ||
OtherFunc( | ||
@"multi | ||
line"); | ||
} | ||
var a = @"asdasda"; | ||
var d = | ||
@"asdasda"; | ||
|
||
// ...becomes: | ||
var d = | ||
@"asdasda"; | ||
|
||
void Func() | ||
{ | ||
OtherFunc( | ||
@"multi | ||
line"); | ||
} | ||
var b = @" | ||
line1 | ||
line2"; | ||
|
||
// (This also happens with var x = \n@"" and probably a few other scenarios.) | ||
// There's no way to keep it from indenting the first line of the string literal. We want to leave it at column 1 because it's being used for a "here doc" that doesn't want leading spaces from indentation. It's weird looking for just the first line to be indented. | ||
// This likely requires a new Uncrustify feature to support. | ||
// Workaround: start the @" on the previous line and permit the string to have an extra empty first line, like this: | ||
var c = Very(Long(Nested(Function( | ||
@"line1 | ||
line2")))); | ||
|
||
void Func() | ||
{ | ||
OtherFunc(@" | ||
multi | ||
line"); | ||
} | ||
var c = Very(Long(Nested(Function( | ||
@"line1 | ||
line2")))); | ||
|
||
var c = Function( | ||
hey, | ||
you, | ||
@"line1 | ||
line2", fubar, | ||
hmm); | ||
|
||
// That might be ok for many cases, especially here-docs that are for script source. | ||
var c = Function( | ||
hey, | ||
you, | ||
@"line1 | ||
line2", fubar, | ||
hmm); | ||
|
||
var c = Function( | ||
hey, | ||
you, | ||
@"line1 | ||
line2", | ||
fubar, | ||
hmm); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ public void F() | |
var y = @" | ||
abc" + "def"; | ||
var z = "" + | ||
@" | ||
@" | ||
"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
void Func() | ||
{ | ||
OtherFunc( | ||
@"multi | ||
@"multi | ||
line"); | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,45 @@ | ||
// This has to do with the @" that opens a literal string getting aligned when we don't want it to. | ||
// Test code: | ||
// As discussed with unity updating the test case | ||
|
||
void Func() | ||
{ | ||
OtherFunc( | ||
@"multi | ||
line"); | ||
} | ||
var a = @"asdasda"; | ||
|
||
// ...becomes: | ||
var d = | ||
@"asdasda"; | ||
|
||
void Func() | ||
{ | ||
OtherFunc( | ||
@"multi | ||
line"); | ||
} | ||
var d = | ||
@"asdasda"; | ||
|
||
// (This also happens with var x = \n@"" and probably a few other scenarios.) | ||
// There's no way to keep it from indenting the first line of the string literal. We want to leave it at column 1 because it's being used for a "here doc" that doesn't want leading spaces from indentation. It's weird looking for just the first line to be indented. | ||
// This likely requires a new Uncrustify feature to support. | ||
// Workaround: start the @" on the previous line and permit the string to have an extra empty first line, like this: | ||
var b = @" | ||
line1 | ||
line2"; | ||
|
||
void Func() | ||
{ | ||
OtherFunc(@" | ||
multi | ||
line"); | ||
} | ||
var c = Very(Long(Nested(Function( | ||
@"line1 | ||
line2")))); | ||
|
||
// That might be ok for many cases, especially here-docs that are for script source. | ||
var c = Very(Long(Nested(Function( | ||
@"line1 | ||
line2")))); | ||
|
||
var c = Function( | ||
hey, | ||
you, | ||
@"line1 | ||
line2", fubar, | ||
hmm); | ||
|
||
var c = Function( | ||
hey, | ||
you, | ||
@"line1 | ||
line2", fubar, | ||
hmm); | ||
|
||
var c = Function( | ||
hey, | ||
you, | ||
@"line1 | ||
line2", | ||
fubar, | ||
hmm); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters