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

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

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

Loading…
Cancel
Save