Browse Source

* Src/PrettyPrinter/CSharp/PrettyPrintOptions.cs:

* Src/PrettyPrinter/CSharp/CSharpOutputVisitor.cs: Added some output
  options.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/3.0@3848 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Mike Krüger 17 years ago
parent
commit
f514596684
  1. 24
      src/Libraries/NRefactory/Project/Src/PrettyPrinter/CSharp/CSharpOutputVisitor.cs
  2. 49
      src/Libraries/NRefactory/Project/Src/PrettyPrinter/CSharp/PrettyPrintOptions.cs

24
src/Libraries/NRefactory/Project/Src/PrettyPrinter/CSharp/CSharpOutputVisitor.cs

@ -551,7 +551,11 @@ namespace ICSharpCode.NRefactory.PrettyPrinter @@ -551,7 +551,11 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
outputFormatter.Indent();
OutputModifier(propertyGetRegion.Modifier);
outputFormatter.PrintText("get");
OutputBlockAllowInline(propertyGetRegion.Block, prettyPrintOptions.PropertyGetBraceStyle);
if (prettyPrintOptions.AllowPropertyGetBlockInline) {
OutputBlockAllowInline(propertyGetRegion.Block, prettyPrintOptions.PropertyGetBraceStyle);
} else {
OutputBlock(propertyGetRegion.Block, prettyPrintOptions.PropertyGetBraceStyle);
}
return null;
}
@ -561,7 +565,11 @@ namespace ICSharpCode.NRefactory.PrettyPrinter @@ -561,7 +565,11 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
outputFormatter.Indent();
OutputModifier(propertySetRegion.Modifier);
outputFormatter.PrintText("set");
OutputBlockAllowInline(propertySetRegion.Block, prettyPrintOptions.PropertySetBraceStyle);
if (prettyPrintOptions.AllowPropertySetBlockInline) {
OutputBlockAllowInline(propertySetRegion.Block, prettyPrintOptions.PropertySetBraceStyle);
} else {
OutputBlock(propertySetRegion.Block, prettyPrintOptions.PropertySetBraceStyle);
}
return null;
}
@ -606,7 +614,11 @@ namespace ICSharpCode.NRefactory.PrettyPrinter @@ -606,7 +614,11 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
VisitAttributes(eventAddRegion.Attributes, data);
outputFormatter.Indent();
outputFormatter.PrintText("add");
OutputBlockAllowInline(eventAddRegion.Block, prettyPrintOptions.EventAddBraceStyle);
if (prettyPrintOptions.AllowEventAddBlockInline) {
OutputBlockAllowInline(eventAddRegion.Block, prettyPrintOptions.EventAddBraceStyle);
} else {
OutputBlock(eventAddRegion.Block, prettyPrintOptions.EventAddBraceStyle);
}
return null;
}
@ -615,7 +627,11 @@ namespace ICSharpCode.NRefactory.PrettyPrinter @@ -615,7 +627,11 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
VisitAttributes(eventRemoveRegion.Attributes, data);
outputFormatter.Indent();
outputFormatter.PrintText("remove");
OutputBlockAllowInline(eventRemoveRegion.Block, prettyPrintOptions.EventRemoveBraceStyle);
if (prettyPrintOptions.AllowEventRemoveBlockInline) {
OutputBlockAllowInline(eventRemoveRegion.Block, prettyPrintOptions.EventRemoveBraceStyle);
} else {
OutputBlock(eventRemoveRegion.Block, prettyPrintOptions.EventRemoveBraceStyle);
}
return null;
}

49
src/Libraries/NRefactory/Project/Src/PrettyPrinter/CSharp/PrettyPrintOptions.cs

@ -31,10 +31,15 @@ namespace ICSharpCode.NRefactory.PrettyPrinter @@ -31,10 +31,15 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
BraceStyle methodBraceStyle = BraceStyle.NextLine;
BraceStyle propertyBraceStyle = BraceStyle.EndOfLine;
bool allowPropertyGetBlockInline = true;
BraceStyle propertyGetBraceStyle = BraceStyle.EndOfLine;
bool allowPropertySetBlockInline = true;
BraceStyle propertySetBraceStyle = BraceStyle.EndOfLine;
BraceStyle eventBraceStyle = BraceStyle.EndOfLine;
bool allowEventAddBlockInline = true;
BraceStyle eventAddBraceStyle = BraceStyle.EndOfLine;
bool allowEventRemoveBlockInline = true;
BraceStyle eventRemoveBraceStyle = BraceStyle.EndOfLine;
BraceStyle statementBraceStyle = BraceStyle.EndOfLine;
@ -137,6 +142,16 @@ namespace ICSharpCode.NRefactory.PrettyPrinter @@ -137,6 +142,16 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
propertyGetBraceStyle = value;
}
}
public bool AllowPropertyGetBlockInline {
get {
return allowPropertyGetBlockInline;
}
set {
allowPropertyGetBlockInline = value;
}
}
public BraceStyle PropertySetBraceStyle {
get {
return propertySetBraceStyle;
@ -145,6 +160,23 @@ namespace ICSharpCode.NRefactory.PrettyPrinter @@ -145,6 +160,23 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
propertySetBraceStyle = value;
}
}
public bool AllowPropertySetBlockInline {
get {
return allowPropertySetBlockInline;
}
set {
allowPropertySetBlockInline = value;
}
}
public BraceStyle EventBraceStyle {
get {
return eventBraceStyle;
}
set {
eventBraceStyle = value;
}
}
public BraceStyle EventAddBraceStyle {
get {
@ -154,6 +186,15 @@ namespace ICSharpCode.NRefactory.PrettyPrinter @@ -154,6 +186,15 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
eventAddBraceStyle = value;
}
}
public bool AllowEventAddBlockInline {
get {
return allowEventAddBlockInline;
}
set {
allowEventAddBlockInline = value;
}
}
public BraceStyle EventRemoveBraceStyle {
get {
return eventRemoveBraceStyle;
@ -162,6 +203,14 @@ namespace ICSharpCode.NRefactory.PrettyPrinter @@ -162,6 +203,14 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
eventRemoveBraceStyle = value;
}
}
public bool AllowEventRemoveBlockInline {
get {
return allowEventRemoveBlockInline;
}
set {
allowEventRemoveBlockInline = value;
}
}
#endregion
#region Before Parentheses

Loading…
Cancel
Save