Merge branch 'master' of https://github.com/dlang-community/dfmt into master
This commit is contained in:
commit
9dc690e23b
|
@ -713,13 +713,13 @@ private:
|
||||||
{
|
{
|
||||||
writeToken();
|
writeToken();
|
||||||
if (spaceAfterParens || parenDepth > 0)
|
if (spaceAfterParens || parenDepth > 0)
|
||||||
write(" ");
|
writeSpace();
|
||||||
}
|
}
|
||||||
else if ((peekIsKeyword() || peekIs(tok!"@")) && spaceAfterParens
|
else if ((peekIsKeyword() || peekIs(tok!"@")) && spaceAfterParens
|
||||||
&& !peekIs(tok!"in") && !peekIs(tok!"is") && !peekIs(tok!"if"))
|
&& !peekIs(tok!"in") && !peekIs(tok!"is") && !peekIs(tok!"if"))
|
||||||
{
|
{
|
||||||
writeToken();
|
writeToken();
|
||||||
write(" ");
|
writeSpace();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
writeToken();
|
writeToken();
|
||||||
|
@ -769,14 +769,7 @@ private:
|
||||||
|| currentIs(tok!"identifier"))
|
|| currentIs(tok!"identifier"))
|
||||||
&& !currentIsIndentedTemplateConstraint())
|
&& !currentIsIndentedTemplateConstraint())
|
||||||
{
|
{
|
||||||
if (onNextLine)
|
writeSpace();
|
||||||
{
|
|
||||||
newline();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
write(" ");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -805,6 +798,11 @@ private:
|
||||||
newline();
|
newline();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (indents.topIs(tok!"]")) // Associative array
|
||||||
|
{
|
||||||
|
write(config.dfmt_space_before_aa_colon ? " : " : ": ");
|
||||||
|
++index;
|
||||||
|
}
|
||||||
else if (peekBackIs(tok!"identifier")
|
else if (peekBackIs(tok!"identifier")
|
||||||
&& [tok!"{", tok!"}", tok!";", tok!":", tok!","]
|
&& [tok!"{", tok!"}", tok!";", tok!":", tok!","]
|
||||||
.any!((ptrdiff_t token) => peekBack2Is(cast(IdType)token, true))
|
.any!((ptrdiff_t token) => peekBack2Is(cast(IdType)token, true))
|
||||||
|
@ -838,11 +836,6 @@ private:
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const inAA = indents.topIs(tok!"]") && indents.topDetails.breakEveryItem;
|
|
||||||
|
|
||||||
if (inAA && !config.dfmt_space_before_aa_colon)
|
|
||||||
write(": ");
|
|
||||||
else
|
|
||||||
write(" : ");
|
write(" : ");
|
||||||
index++;
|
index++;
|
||||||
}
|
}
|
||||||
|
@ -1289,14 +1282,7 @@ private:
|
||||||
default:
|
default:
|
||||||
if (peekBackIs(tok!"identifier"))
|
if (peekBackIs(tok!"identifier"))
|
||||||
{
|
{
|
||||||
if (onNextLine)
|
writeSpace();
|
||||||
{
|
|
||||||
newline();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
write(" ");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (index + 1 < tokens.length)
|
if (index + 1 < tokens.length)
|
||||||
{
|
{
|
||||||
|
@ -1310,14 +1296,7 @@ private:
|
||||||
writeToken();
|
writeToken();
|
||||||
if (!currentIsIndentedTemplateConstraint())
|
if (!currentIsIndentedTemplateConstraint())
|
||||||
{
|
{
|
||||||
if (onNextLine)
|
writeSpace();
|
||||||
{
|
|
||||||
newline();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
write(" ");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1427,7 +1406,7 @@ private:
|
||||||
{
|
{
|
||||||
pushWrapIndent();
|
pushWrapIndent();
|
||||||
newline();
|
newline();
|
||||||
if (ufcsWrap)
|
if (ufcsWrap || onNextLine)
|
||||||
regenLineBreakHints(index);
|
regenLineBreakHints(index);
|
||||||
}
|
}
|
||||||
writeToken();
|
writeToken();
|
||||||
|
@ -1943,6 +1922,18 @@ private:
|
||||||
indents.push(type, detail);
|
indents.push(type, detail);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void writeSpace()
|
||||||
|
{
|
||||||
|
if (onNextLine)
|
||||||
|
{
|
||||||
|
newline();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
write(" ");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const pure @safe @nogc:
|
const pure @safe @nogc:
|
||||||
|
|
||||||
size_t expressionEndIndex(size_t i, bool matchComma = false) nothrow
|
size_t expressionEndIndex(size_t i, bool matchComma = false) nothrow
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
bool asdf(const string owner, const string mail) @safe
|
||||||
|
{
|
||||||
|
requestHTTP(url, (scope HTTPClientRequest request) {
|
||||||
|
request.writeFormBody([owner: owner, mail: mail]);
|
||||||
|
}, (scope HTTPClientResponse response) {});
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
int a;
|
||||||
|
int[int] hashmap = [a : a, a : a, a : a];
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
auto someAutoVariableName = this.firstLink.secondLink
|
||||||
|
.filter!(shouldBeProbablySomeIdentifierOrNot);
|
||||||
|
}
|
|
@ -0,0 +1,4 @@
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
auto aa = ["aaa": 1, "bbb": 2];
|
||||||
|
}
|
|
@ -0,0 +1,40 @@
|
||||||
|
deprecated("foo")
|
||||||
|
void test()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
package(foo)
|
||||||
|
void bar()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
@uda()
|
||||||
|
void baz()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
deprecated
|
||||||
|
deprecated_()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
@uda
|
||||||
|
void uda_()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
@property
|
||||||
|
void property()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
deprecated("Reason") @uda
|
||||||
|
void propertyuda()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
deprecated("Reason")
|
||||||
|
@uda
|
||||||
|
void udaproperty()
|
||||||
|
{
|
||||||
|
}
|
|
@ -0,0 +1,9 @@
|
||||||
|
bool asdf(const string owner, const string mail) @safe
|
||||||
|
{
|
||||||
|
requestHTTP(url, (scope HTTPClientRequest request) {
|
||||||
|
request.writeFormBody([owner: owner, mail:
|
||||||
|
mail]);
|
||||||
|
}, (scope HTTPClientResponse response) {});
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
|
@ -0,0 +1 @@
|
||||||
|
--space_before_aa_colon true
|
|
@ -0,0 +1,5 @@
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
int a;
|
||||||
|
int[int] hashmap = [a : a, a : a, a : a];
|
||||||
|
}
|
|
@ -0,0 +1 @@
|
||||||
|
--keep_line_breaks=true
|
|
@ -0,0 +1,5 @@
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
auto someAutoVariableName = this.firstLink.secondLink
|
||||||
|
.filter!(shouldBeProbablySomeIdentifierOrNot);
|
||||||
|
}
|
|
@ -0,0 +1,4 @@
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
auto aa = ["aaa": 1, "bbb":2];
|
||||||
|
}
|
|
@ -0,0 +1 @@
|
||||||
|
--keep_line_breaks=true
|
|
@ -0,0 +1,40 @@
|
||||||
|
deprecated("foo")
|
||||||
|
void test()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
package(foo)
|
||||||
|
void bar()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
@uda()
|
||||||
|
void baz()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
deprecated
|
||||||
|
deprecated_()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
@uda
|
||||||
|
void uda_()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
@property
|
||||||
|
void property()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
deprecated("Reason") @uda
|
||||||
|
void propertyuda()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
deprecated("Reason")
|
||||||
|
@uda
|
||||||
|
void udaproperty()
|
||||||
|
{
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
bool asdf(const string owner, const string mail) @safe {
|
||||||
|
requestHTTP(url, (scope HTTPClientRequest request) {
|
||||||
|
request.writeFormBody([owner: owner, mail: mail]);
|
||||||
|
}, (scope HTTPClientResponse response) {});
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
|
@ -0,0 +1,4 @@
|
||||||
|
void main() {
|
||||||
|
int a;
|
||||||
|
int[int] hashmap = [a : a, a : a, a : a];
|
||||||
|
}
|
|
@ -0,0 +1,4 @@
|
||||||
|
void main() {
|
||||||
|
auto someAutoVariableName = this.firstLink.secondLink
|
||||||
|
.filter!(shouldBeProbablySomeIdentifierOrNot);
|
||||||
|
}
|
|
@ -0,0 +1,3 @@
|
||||||
|
void main() {
|
||||||
|
auto aa = ["aaa": 1, "bbb": 2];
|
||||||
|
}
|
|
@ -0,0 +1,32 @@
|
||||||
|
deprecated("foo")
|
||||||
|
void test() {
|
||||||
|
}
|
||||||
|
|
||||||
|
package(foo)
|
||||||
|
void bar() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@uda()
|
||||||
|
void baz() {
|
||||||
|
}
|
||||||
|
|
||||||
|
deprecated
|
||||||
|
deprecated_() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@uda
|
||||||
|
void uda_() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@property
|
||||||
|
void property() {
|
||||||
|
}
|
||||||
|
|
||||||
|
deprecated("Reason") @uda
|
||||||
|
void propertyuda() {
|
||||||
|
}
|
||||||
|
|
||||||
|
deprecated("Reason")
|
||||||
|
@uda
|
||||||
|
void udaproperty() {
|
||||||
|
}
|
Loading…
Reference in New Issue