fix the handling of module-scope imports
This commit is contained in:
parent
fa856430a3
commit
eb18a6f6d3
|
@ -105,34 +105,10 @@ struct ASTInformation
|
||||||
bool result;
|
bool result;
|
||||||
const (string)[] sortKeyA = a.importStrings;
|
const (string)[] sortKeyA = a.importStrings;
|
||||||
const (string)[] sortKeyB = b.importStrings;
|
const (string)[] sortKeyB = b.importStrings;
|
||||||
/+
|
|
||||||
if (sortKeyA.length > 2)
|
|
||||||
{
|
|
||||||
const last = a.importStrings[$ - 1];
|
|
||||||
foreach(i,s;a.importStrings[1 .. $-1])
|
|
||||||
{
|
|
||||||
sortKeyA[i + 2] = s;
|
|
||||||
}
|
|
||||||
sortKeyA[1] = last;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sortKeyB.length > 2)
|
|
||||||
{
|
|
||||||
const last = b.importStrings[$ - 1];
|
|
||||||
foreach(i,s;sortKeyB[1 .. $-1])
|
|
||||||
{
|
|
||||||
sortKeyB[i + 2] = s;
|
|
||||||
}
|
|
||||||
sortKeyB[1] = last;
|
|
||||||
}
|
|
||||||
+/
|
|
||||||
result = sortKeyA < sortKeyB;
|
result = sortKeyA < sortKeyB;
|
||||||
/*
|
|
||||||
if (moduleNameStrings.length && isCloserTo(a.importStrings, b.importStrings, moduleNameStrings)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
//TODO take the module-name of the module we are formatting into account
|
||||||
*/
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -631,7 +631,10 @@ private:
|
||||||
{
|
{
|
||||||
if (importLine.importString !is null)
|
if (importLine.importString !is null)
|
||||||
{
|
{
|
||||||
newline();
|
// for some reason newline() creates double
|
||||||
|
// newlines in module-scope
|
||||||
|
scopeOrdinal ? newline() : simpleNewline();
|
||||||
|
|
||||||
write(importLine.attribString);
|
write(importLine.attribString);
|
||||||
write("import ");
|
write("import ");
|
||||||
if (importLine.renamedAs)
|
if (importLine.renamedAs)
|
||||||
|
|
Loading…
Reference in New Issue