Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/monodevelop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/CSharpFormattingPolicy.cs')
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/CSharpFormattingPolicy.cs1494
1 files changed, 204 insertions, 1290 deletions
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/CSharpFormattingPolicy.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/CSharpFormattingPolicy.cs
index e6d7a466f3..9b84859194 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/CSharpFormattingPolicy.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/CSharpFormattingPolicy.cs
@@ -32,14 +32,19 @@ using System.Xml;
using System.Text;
using System.Linq;
using MonoDevelop.Projects.Policies;
-using ICSharpCode.NRefactory.CSharp;
+using Microsoft.CodeAnalysis.Options;
+using MonoDevelop.Ide.TypeSystem;
+using MonoDevelop.Ide.Gui.Content;
+using Microsoft.CodeAnalysis.Formatting;
+using Microsoft.CodeAnalysis;
+using MonoDevelop.Ide.Editor;
namespace MonoDevelop.CSharp.Formatting
{
- [PolicyType ("C# formatting")]
- public class CSharpFormattingPolicy : IEquatable<CSharpFormattingPolicy>
+ [PolicyType ("C# formatting (roslyn)")]
+ public sealed class CSharpFormattingPolicy : IEquatable<CSharpFormattingPolicy>
{
- readonly CSharpFormattingOptions options = FormattingOptionsFactory.CreateMono ();
+ OptionSet options;
public string Name {
get;
@@ -53,1602 +58,507 @@ namespace MonoDevelop.CSharp.Formatting
public CSharpFormattingPolicy Clone ()
{
- return new CSharpFormattingPolicy (options.Clone ());
+ return new CSharpFormattingPolicy (options);
}
- public CSharpFormattingOptions CreateOptions ()
+ public static OptionSet Apply (OptionSet options, TextStylePolicy policy)
{
- return options;
+ var result = options;
+ if (policy != null) {
+ result = result.WithChangedOption (Microsoft.CodeAnalysis.Formatting.FormattingOptions.IndentationSize, LanguageNames.CSharp, policy.IndentWidth);
+ result = result.WithChangedOption (Microsoft.CodeAnalysis.Formatting.FormattingOptions.NewLine, LanguageNames.CSharp, policy.GetEolMarker ());
+ result = result.WithChangedOption (Microsoft.CodeAnalysis.Formatting.FormattingOptions.SmartIndent, LanguageNames.CSharp, FormattingOptions.IndentStyle.Smart);
+ result = result.WithChangedOption (Microsoft.CodeAnalysis.Formatting.FormattingOptions.TabSize, LanguageNames.CSharp, policy.TabWidth);
+ result = result.WithChangedOption (Microsoft.CodeAnalysis.Formatting.FormattingOptions.UseTabs, LanguageNames.CSharp, !policy.TabsToSpaces);
+ result = result.WithChangedOption (Microsoft.CodeAnalysis.Formatting.FormattingOptions.UseTabOnlyForIndentation, LanguageNames.CSharp, !policy.TabsToSpaces);
+ }
+ return result;
}
-
+
+ public static OptionSet Apply (OptionSet options, ITextEditorOptions policy)
+ {
+ var result = options;
+ if (policy != null) {
+ result = result.WithChangedOption (Microsoft.CodeAnalysis.Formatting.FormattingOptions.IndentationSize, LanguageNames.CSharp, policy.IndentationSize);
+ result = result.WithChangedOption (Microsoft.CodeAnalysis.Formatting.FormattingOptions.NewLine, LanguageNames.CSharp, policy.DefaultEolMarker);
+ result = result.WithChangedOption (Microsoft.CodeAnalysis.Formatting.FormattingOptions.SmartIndent, LanguageNames.CSharp, FormattingOptions.IndentStyle.Smart);
+ result = result.WithChangedOption (Microsoft.CodeAnalysis.Formatting.FormattingOptions.TabSize, LanguageNames.CSharp, policy.TabSize);
+ result = result.WithChangedOption (Microsoft.CodeAnalysis.Formatting.FormattingOptions.UseTabs, LanguageNames.CSharp, !policy.TabsToSpaces);
+ result = result.WithChangedOption (Microsoft.CodeAnalysis.Formatting.FormattingOptions.UseTabOnlyForIndentation, LanguageNames.CSharp, !policy.TabsToSpaces);
+ }
+ return result;
+ }
+
+ public OptionSet CreateOptions (TextStylePolicy policy)
+ {
+ return Apply (options, policy);
+ }
+
+ public OptionSet CreateOptions (ITextEditorOptions policy)
+ {
+ return Apply (options, policy);
+ }
+
static CSharpFormattingPolicy ()
{
if (!PolicyService.InvariantPolicies.ReadOnly)
PolicyService.InvariantPolicies.Set<CSharpFormattingPolicy> (new CSharpFormattingPolicy (), "text/x-csharp");
}
- protected CSharpFormattingPolicy (CSharpFormattingOptions options)
+ public CSharpFormattingPolicy (OptionSet options)
{
+ if (options == null)
+ throw new ArgumentNullException ("options");
this.options = options;
}
-
-
- #region Indentation
- [ItemProperty]
- public bool IndentNamespaceBody {
- get {
- return options.IndentNamespaceBody;
- }
- set {
- options.IndentNamespaceBody = value;
- }
- }
-
- [ItemProperty]
- public bool IndentClassBody {
- get {
- return options.IndentClassBody;
- }
- set {
- options.IndentClassBody = value;
- }
- }
-
- [ItemProperty]
- public bool IndentInterfaceBody {
- get {
- return options.IndentInterfaceBody;
- }
- set {
- options.IndentInterfaceBody = value;
- }
- }
-
- [ItemProperty]
- public bool IndentStructBody {
- get {
- return options.IndentStructBody;
- }
- set {
- options.IndentStructBody = value;
- }
- }
-
- [ItemProperty]
- public bool IndentEnumBody {
- get {
- return options.IndentEnumBody;
- }
- set {
- options.IndentEnumBody = value;
- }
- }
-
- [ItemProperty]
- public bool IndentMethodBody {
- get {
- return options.IndentMethodBody;
- }
- set {
- options.IndentMethodBody = value;
- }
- }
-
- [ItemProperty]
- public bool IndentPropertyBody {
- get {
- return options.IndentPropertyBody;
- }
- set {
- options.IndentPropertyBody = value;
- }
- }
-
- [ItemProperty]
- public bool IndentEventBody {
- get {
- return options.IndentEventBody;
- }
- set {
- options.IndentEventBody = value;
- }
- }
-
- [ItemProperty]
- public bool IndentBlocks {
- get {
- return options.IndentBlocks;
- }
- set {
- options.IndentBlocks = value;
- }
- }
-
- [ItemProperty]
- public bool IndentSwitchBody {
- get {
- return options.IndentSwitchBody;
- }
- set {
- options.IndentSwitchBody = value;
- }
- }
-
- [ItemProperty]
- public bool IndentCaseBody {
- get {
- return options.IndentCaseBody;
- }
- set {
- options.IndentCaseBody = value;
- }
- }
-
- [ItemProperty]
- public bool IndentBreakStatements {
- get {
- return options.IndentBreakStatements;
- }
- set {
- options.IndentBreakStatements = value;
- }
- }
+ #region Indent options
[ItemProperty]
- public bool IndentBlocksInsideExpressions {
+ public bool IndentBlock {
get {
- return options.IndentBlocksInsideExpressions;
+ return options.GetOption (Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.IndentBlock);
}
set {
- options.IndentBlocksInsideExpressions = value;
- }
- }
-
- [ItemProperty]
- public bool AlignEmbeddedStatements {
- get {
- return options.AlignEmbeddedStatements;
- }
- set {
- options.AlignEmbeddedStatements = value;
+ options = options.WithChangedOption (Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.IndentBlock, value);
}
}
[ItemProperty]
- public PropertyFormatting SimplePropertyFormatting {
+ public bool IndentBraces {
get {
- return options.SimplePropertyFormatting;
+ return options.GetOption (Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.IndentBraces);
}
set {
- options.SimplePropertyFormatting = value;
+ options = options.WithChangedOption (Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.IndentBraces, value);
}
}
[ItemProperty]
- public PropertyFormatting AutoPropertyFormatting {
+ public bool IndentSwitchSection {
get {
- return options.AutoPropertyFormatting;
+ return options.GetOption (Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.IndentSwitchSection);
}
set {
- options.AutoPropertyFormatting = value;
+ options = options.WithChangedOption (Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.IndentSwitchSection, value);
}
}
[ItemProperty]
- public bool IndentPreprocessorDirectives {
- get {
- return options.IndentPreprocessorDirectives;
- }
- set {
- options.IndentPreprocessorDirectives = value;
- }
- }
- #endregion
-
- #region Braces
- [ItemProperty]
- public BraceStyle NamespaceBraceStyle {
- get {
- return options.NamespaceBraceStyle;
- }
- set {
- options.NamespaceBraceStyle = value;
- }
- }
-
- [ItemProperty]
- public BraceStyle ClassBraceStyle {
- get {
- return options.ClassBraceStyle;
- }
- set {
- options.ClassBraceStyle = value;
- }
- }
-
- [ItemProperty]
- public BraceStyle InterfaceBraceStyle {
- get {
- return options.InterfaceBraceStyle;
- }
- set {
- options.InterfaceBraceStyle = value;
- }
- }
-
- [ItemProperty]
- public BraceStyle StructBraceStyle {
- get {
- return options.StructBraceStyle;
- }
- set {
- options.StructBraceStyle = value;
- }
- }
-
- [ItemProperty]
- public BraceStyle EnumBraceStyle {
+ public bool IndentSwitchCaseSection {
get {
- return options.EnumBraceStyle;
+ return options.GetOption (Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.IndentSwitchCaseSection);
}
set {
- options.EnumBraceStyle = value;
- }
- }
-
- [ItemProperty]
- public BraceStyle MethodBraceStyle {
- get {
- return options.MethodBraceStyle;
- }
- set {
- options.MethodBraceStyle = value;
- }
- }
-
- [ItemProperty]
- public BraceStyle AnonymousMethodBraceStyle {
- get {
- return options.AnonymousMethodBraceStyle;
- }
- set {
- options.AnonymousMethodBraceStyle = value;
- }
- }
-
- [ItemProperty]
- public BraceStyle ConstructorBraceStyle {
- get {
- return options.ConstructorBraceStyle;
- }
- set {
- options.ConstructorBraceStyle = value;
- }
- }
-
- [ItemProperty]
- public BraceStyle DestructorBraceStyle {
- get {
- return options.DestructorBraceStyle;
- }
- set {
- options.DestructorBraceStyle = value;
- }
- }
-
- [ItemProperty]
- public BraceStyle PropertyBraceStyle {
- get {
- return options.PropertyBraceStyle;
- }
- set {
- options.PropertyBraceStyle = value;
- }
- }
-
- [ItemProperty]
- public BraceStyle PropertyGetBraceStyle {
- get {
- return options.PropertyGetBraceStyle;
- }
- set {
- options.PropertyGetBraceStyle = value;
- }
- }
-
- [ItemProperty]
- public BraceStyle PropertySetBraceStyle {
- get {
- return options.PropertySetBraceStyle;
- }
- set {
- options.PropertySetBraceStyle = value;
+ options = options.WithChangedOption (Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.IndentSwitchCaseSection, value);
}
}
[ItemProperty]
- public PropertyFormatting SimpleGetBlockFormatting {
+ public Microsoft.CodeAnalysis.CSharp.Formatting.LabelPositionOptions LabelPositioning {
get {
- return options.SimpleGetBlockFormatting;
+ return options.GetOption (Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.LabelPositioning);
}
set {
- options.SimpleGetBlockFormatting = value;
+ options = options.WithChangedOption (Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.LabelPositioning, value);
}
}
+ #endregion
- [ItemProperty]
- public PropertyFormatting SimpleSetBlockFormatting {
- get {
+ #region New line options
- return options.SimpleSetBlockFormatting;
- }
- set {
- options.SimpleSetBlockFormatting = value;
- }
- }
-
- [ItemProperty]
- public BraceStyle EventBraceStyle {
- get {
- return options.EventBraceStyle;
- }
- set {
- options.EventBraceStyle = value;
- }
- }
-
[ItemProperty]
- public BraceStyle EventAddBraceStyle {
+ public bool NewLinesForBracesInTypes {
get {
- return options.EventAddBraceStyle;
+ return options.GetOption (Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.NewLinesForBracesInTypes);
}
set {
- options.EventAddBraceStyle = value;
+ options = options.WithChangedOption (Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.NewLinesForBracesInTypes, value);
}
}
-
- [ItemProperty]
- public BraceStyle EventRemoveBraceStyle {
- get {
- return options.EventRemoveBraceStyle;
- }
- set {
- options.EventRemoveBraceStyle = value;
- }
- }
-
- [ItemProperty]
- public bool AllowEventAddBlockInline {
- get {
- return options.AllowEventAddBlockInline;
- }
- set {
- options.AllowEventAddBlockInline = value;
- }
- }
-
- [ItemProperty]
- public bool AllowEventRemoveBlockInline {
- get {
- return options.AllowEventRemoveBlockInline;
- }
- set {
- options.AllowEventRemoveBlockInline = value;
- }
- }
-
- [ItemProperty]
- public BraceStyle StatementBraceStyle {
- get {
- return options.StatementBraceStyle;
- }
- set {
- options.StatementBraceStyle = value;
- }
- }
-
- [ItemProperty]
- public bool AllowIfBlockInline {
- get {
- return options.AllowIfBlockInline;
- }
- set {
- options.AllowIfBlockInline = value;
- }
- }
-
- #endregion
- #region NewLines
- [ItemProperty]
- public NewLinePlacement ElseNewLinePlacement {
- get {
- return options.ElseNewLinePlacement;
- }
- set {
- options.ElseNewLinePlacement = value;
- }
- }
-
[ItemProperty]
- public NewLinePlacement ElseIfNewLinePlacement {
+ public bool NewLinesForBracesInMethods {
get {
- return options.ElseIfNewLinePlacement;
+ return options.GetOption (Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.NewLinesForBracesInMethods);
}
set {
- options.ElseIfNewLinePlacement = value;
+ options = options.WithChangedOption (Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.NewLinesForBracesInMethods, value);
}
}
-
- [ItemProperty]
- public NewLinePlacement CatchNewLinePlacement {
- get {
- return options.CatchNewLinePlacement;
- }
- set {
- options.CatchNewLinePlacement = value;
- }
- }
-
+
[ItemProperty]
- public NewLinePlacement FinallyNewLinePlacement {
+ public bool NewLinesForBracesInAnonymousMethods {
get {
- return options.FinallyNewLinePlacement;
+ return options.GetOption (Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.NewLinesForBracesInAnonymousMethods);
}
set {
- options.FinallyNewLinePlacement = value;
+ options = options.WithChangedOption (Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.NewLinesForBracesInAnonymousMethods, value);
}
}
-
+
[ItemProperty]
- public NewLinePlacement WhileNewLinePlacement {
+ public bool NewLinesForBracesInControlBlocks {
get {
- return options.WhileNewLinePlacement;
+ return options.GetOption (Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.NewLinesForBracesInControlBlocks);
}
set {
- options.WhileNewLinePlacement = value;
+ options = options.WithChangedOption (Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.NewLinesForBracesInControlBlocks, value);
}
}
[ItemProperty]
- public NewLinePlacement EmbeddedStatementPlacement {
+ public bool NewLinesForBracesInAnonymousTypes {
get {
- return options.EmbeddedStatementPlacement;
+ return options.GetOption (Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.NewLinesForBracesInAnonymousTypes);
}
set {
- options.EmbeddedStatementPlacement = value;
+ options = options.WithChangedOption (Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.NewLinesForBracesInAnonymousTypes, value);
}
}
-
-
[ItemProperty]
- public Wrapping ArrayInitializerWrapping {
+ public bool NewLinesForBracesInObjectInitializers {
get {
- return options.ArrayInitializerWrapping;
+ return options.GetOption (Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.NewLinesForBracesInObjectInitializers);
}
set {
- options.ArrayInitializerWrapping = value;
- }
- }
-
- [ItemProperty]
- public BraceStyle ArrayInitializerBraceStyle {
- get {
- return options.ArrayInitializerBraceStyle;
- }
- set {
- options.ArrayInitializerBraceStyle = value;
+ options = options.WithChangedOption (Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.NewLinesForBracesInObjectInitializers, value);
}
}
[ItemProperty]
- public bool KeepCommentsAtFirstColumn {
+ public bool NewLinesForBracesInLambdaExpressionBody {
get {
- return options.KeepCommentsAtFirstColumn;
+ return options.GetOption (Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.NewLinesForBracesInLambdaExpressionBody);
}
set {
- options.KeepCommentsAtFirstColumn = value;
+ options = options.WithChangedOption (Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.NewLinesForBracesInLambdaExpressionBody, value);
}
}
- #endregion
-
- #region Spaces
- // Methods
- [ItemProperty]
- public bool BeforeMethodDeclarationParentheses {
- get {
- return options.SpaceBeforeMethodDeclarationParentheses;
- }
- set {
- options.SpaceBeforeMethodDeclarationParentheses = value;
- }
- }
-
- [ItemProperty]
- public bool BetweenEmptyMethodDeclarationParentheses {
- get {
- return options.SpaceBetweenEmptyMethodDeclarationParentheses;
- }
- set {
- options.SpaceBetweenEmptyMethodDeclarationParentheses = value;
- }
- }
-
- [ItemProperty]
- public bool BeforeMethodDeclarationParameterComma {
- get {
- return options.SpaceBeforeMethodDeclarationParameterComma;
- }
- set {
- options.SpaceBeforeMethodDeclarationParameterComma = value;
- }
- }
-
- [ItemProperty]
- public bool AfterMethodDeclarationParameterComma {
- get {
- return options.SpaceAfterMethodDeclarationParameterComma;
- }
- set {
- options.SpaceAfterMethodDeclarationParameterComma = value;
- }
- }
-
- [ItemProperty]
- public bool WithinMethodDeclarationParentheses {
- get {
- return options.SpaceWithinMethodDeclarationParentheses;
- }
- set {
- options.SpaceWithinMethodDeclarationParentheses = value;
- }
- }
-
- // Method calls
- [ItemProperty]
- public bool BeforeMethodCallParentheses {
- get {
- return options.SpaceBeforeMethodCallParentheses;
- }
- set {
- options.SpaceBeforeMethodCallParentheses = value;
- }
- }
-
- [ItemProperty]
- public bool BetweenEmptyMethodCallParentheses {
- get {
- return options.SpaceBetweenEmptyMethodCallParentheses;
- }
- set {
- options.SpaceBetweenEmptyMethodCallParentheses = value;
- }
- }
-
- [ItemProperty]
- public bool BeforeMethodCallParameterComma {
- get {
- return options.SpaceBeforeMethodCallParameterComma;
- }
- set {
- options.SpaceBeforeMethodCallParameterComma = value;
- }
- }
-
- [ItemProperty]
- public bool AfterMethodCallParameterComma {
- get {
- return options.SpaceAfterMethodCallParameterComma;
- }
- set {
- options.SpaceAfterMethodCallParameterComma = value;
- }
- }
-
- [ItemProperty]
- public bool WithinMethodCallParentheses {
- get {
- return options.SpaceWithinMethodCallParentheses;
- }
- set {
- options.SpaceWithinMethodCallParentheses = value;
- }
- }
-
- // fields
-
- [ItemProperty]
- public bool BeforeFieldDeclarationComma {
- get {
- return options.SpaceBeforeFieldDeclarationComma;
- }
- set {
- options.SpaceBeforeFieldDeclarationComma = value;
- }
- }
-
[ItemProperty]
- public bool AfterFieldDeclarationComma {
+ public bool NewLineForElse {
get {
- return options.SpaceAfterFieldDeclarationComma;
+ return options.GetOption (Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.NewLineForElse);
}
set {
- options.SpaceAfterFieldDeclarationComma = value;
+ options = options.WithChangedOption (Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.NewLineForElse, value);
}
}
-
- // local variables
-
+
[ItemProperty]
- public bool BeforeLocalVariableDeclarationComma {
+ public bool NewLineForCatch {
get {
- return options.SpaceBeforeLocalVariableDeclarationComma;
+ return options.GetOption (Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.NewLineForCatch);
}
set {
- options.SpaceBeforeLocalVariableDeclarationComma = value;
- }
- }
-
- [ItemProperty]
- public bool AfterLocalVariableDeclarationComma {
- get {
- return options.SpaceAfterLocalVariableDeclarationComma;
- }
- set {
- options.SpaceAfterLocalVariableDeclarationComma = value;
- }
- }
-
- // constructors
-
- [ItemProperty]
- public bool BeforeConstructorDeclarationParentheses {
- get {
- return options.SpaceBeforeConstructorDeclarationParentheses;
- }
- set {
- options.SpaceBeforeConstructorDeclarationParentheses = value;
- }
- }
-
- [ItemProperty]
- public bool BetweenEmptyConstructorDeclarationParentheses {
- get {
- return options.SpaceBetweenEmptyConstructorDeclarationParentheses;
- }
- set {
- options.SpaceBetweenEmptyConstructorDeclarationParentheses = value;
- }
- }
-
- [ItemProperty]
- public bool BeforeConstructorDeclarationParameterComma {
- get {
- return options.SpaceBeforeConstructorDeclarationParameterComma;
- }
- set {
- options.SpaceBeforeConstructorDeclarationParameterComma = value;
- }
- }
-
- [ItemProperty]
- public bool AfterConstructorDeclarationParameterComma {
- get {
- return options.SpaceAfterConstructorDeclarationParameterComma;
- }
- set {
- options.SpaceAfterConstructorDeclarationParameterComma = value;
- }
- }
-
- [ItemProperty]
- public bool WithinConstructorDeclarationParentheses {
- get {
- return options.SpaceWithinConstructorDeclarationParentheses;
- }
- set {
- options.SpaceWithinConstructorDeclarationParentheses = value;
+ options = options.WithChangedOption (Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.NewLineForCatch, value);
}
}
[ItemProperty]
- public NewLinePlacement NewLineBeforeConstructorInitializerColon {
+ public bool NewLineForFinally {
get {
- return options.NewLineBeforeConstructorInitializerColon;
+ return options.GetOption (Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.NewLineForFinally);
}
set {
- options.NewLineBeforeConstructorInitializerColon = value;
+ options = options.WithChangedOption (Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.NewLineForFinally, value);
}
}
[ItemProperty]
- public NewLinePlacement NewLineAfterConstructorInitializerColon {
+ public bool NewLineForMembersInObjectInit {
get {
- return options.NewLineAfterConstructorInitializerColon;
+ return options.GetOption (Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.NewLineForMembersInObjectInit);
}
set {
- options.NewLineAfterConstructorInitializerColon = value;
+ options = options.WithChangedOption (Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.NewLineForMembersInObjectInit, value);
}
}
- // indexer
- [ItemProperty]
- public bool BeforeIndexerDeclarationBracket {
- get {
- return options.SpaceBeforeIndexerDeclarationBracket;
- }
- set {
- options.SpaceBeforeIndexerDeclarationBracket = value;
- }
- }
-
[ItemProperty]
- public bool WithinIndexerDeclarationBracket {
+ public bool NewLineForMembersInAnonymousTypes {
get {
- return options.SpaceWithinIndexerDeclarationBracket;
+ return options.GetOption (Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.NewLineForMembersInAnonymousTypes);
}
set {
- options.SpaceWithinIndexerDeclarationBracket = value;
- }
- }
-
- [ItemProperty]
- public bool BeforeIndexerDeclarationParameterComma {
- get {
- return options.SpaceBeforeIndexerDeclarationParameterComma;
- }
- set {
- options.SpaceBeforeIndexerDeclarationParameterComma = value;
- }
- }
-
- [ItemProperty]
- public bool AfterIndexerDeclarationParameterComma {
- get {
- return options.SpaceAfterIndexerDeclarationParameterComma;
- }
- set {
- options.SpaceAfterIndexerDeclarationParameterComma = value;
- }
- }
-
- // delegates
-
- [ItemProperty]
- public bool BeforeDelegateDeclarationParentheses {
- get {
- return options.SpaceBeforeDelegateDeclarationParentheses;
- }
- set {
- options.SpaceBeforeDelegateDeclarationParentheses = value;
- }
- }
-
- [ItemProperty]
- public bool BetweenEmptyDelegateDeclarationParentheses {
- get {
- return options.SpaceBetweenEmptyDelegateDeclarationParentheses;
- }
- set {
- options.SpaceBetweenEmptyDelegateDeclarationParentheses = value;
- }
- }
-
- [ItemProperty]
- public bool BeforeDelegateDeclarationParameterComma {
- get {
- return options.SpaceBeforeDelegateDeclarationParameterComma;
- }
- set {
- options.SpaceBeforeDelegateDeclarationParameterComma = value;
- }
- }
-
- [ItemProperty]
- public bool AfterDelegateDeclarationParameterComma {
- get {
- return options.SpaceAfterDelegateDeclarationParameterComma;
- }
- set {
- options.SpaceAfterDelegateDeclarationParameterComma = value;
- }
- }
-
- [ItemProperty]
- public bool WithinDelegateDeclarationParentheses {
- get {
- return options.SpaceWithinDelegateDeclarationParentheses;
- }
- set {
- options.SpaceWithinDelegateDeclarationParentheses = value;
- }
- }
-
-
- [ItemProperty]
- public bool NewParentheses {
- get {
- return options.SpaceBeforeNewParentheses;
- }
- set {
- options.SpaceBeforeNewParentheses = value;
- }
- }
-
- [ItemProperty]
- public bool IfParentheses {
- get {
- return options.SpaceBeforeIfParentheses;
- }
- set {
- options.SpaceBeforeIfParentheses = value;
- }
- }
-
- [ItemProperty]
- public bool WhileParentheses {
- get {
- return options.SpaceBeforeWhileParentheses;
- }
- set {
- options.SpaceBeforeWhileParentheses = value;
- }
- }
-
- [ItemProperty]
- public bool ForParentheses {
- get {
- return options.SpaceBeforeForParentheses;
- }
- set {
- options.SpaceBeforeForParentheses = value;
- }
- }
-
- [ItemProperty]
- public bool ForeachParentheses {
- get {
- return options.SpaceBeforeForeachParentheses;
- }
- set {
- options.SpaceBeforeForeachParentheses = value;
- }
- }
-
- [ItemProperty]
- public bool CatchParentheses {
- get {
- return options.SpaceBeforeCatchParentheses;
- }
- set {
- options.SpaceBeforeCatchParentheses = value;
- }
- }
-
- [ItemProperty]
- public bool SwitchParentheses {
- get {
- return options.SpaceBeforeSwitchParentheses;
- }
- set {
- options.SpaceBeforeSwitchParentheses = value;
- }
- }
-
- [ItemProperty]
- public bool LockParentheses {
- get {
- return options.SpaceBeforeLockParentheses;
- }
- set {
- options.SpaceBeforeLockParentheses = value;
- }
- }
-
- [ItemProperty]
- public bool UsingParentheses {
- get {
- return options.SpaceBeforeUsingParentheses;
- }
- set {
- options.SpaceBeforeUsingParentheses = value;
- }
- }
-
- [ItemProperty]
- public bool AroundAssignmentParentheses {
- get {
- return options.SpaceAroundAssignment;
- }
- set {
- options.SpaceAroundAssignment = value;
- }
- }
-
- [ItemProperty]
- public bool AroundLogicalOperatorParentheses {
- get {
- return options.SpaceAroundLogicalOperator;
- }
- set {
- options.SpaceAroundLogicalOperator = value;
- }
- }
-
- [ItemProperty]
- public bool AroundEqualityOperatorParentheses {
- get {
- return options.SpaceAroundEqualityOperator;
- }
- set {
- options.SpaceAroundEqualityOperator = value;
- }
- }
-
- [ItemProperty]
- public bool AroundRelationalOperatorParentheses {
- get {
- return options.SpaceAroundRelationalOperator;
- }
- set {
- options.SpaceAroundRelationalOperator = value;
- }
- }
-
- [ItemProperty]
- public bool AroundBitwiseOperatorParentheses {
- get {
- return options.SpaceAroundBitwiseOperator;
- }
- set {
- options.SpaceAroundBitwiseOperator = value;
- }
- }
-
- [ItemProperty]
- public bool AroundAdditiveOperatorParentheses {
- get {
- return options.SpaceAroundAdditiveOperator;
- }
- set {
- options.SpaceAroundAdditiveOperator = value;
- }
- }
-
- [ItemProperty]
- public bool AroundMultiplicativeOperatorParentheses {
- get {
- return options.SpaceAroundMultiplicativeOperator;
- }
- set {
- options.SpaceAroundMultiplicativeOperator = value;
- }
- }
-
- [ItemProperty]
- public bool AroundShiftOperatorParentheses {
- get {
- return options.SpaceAroundShiftOperator;
- }
- set {
- options.SpaceAroundShiftOperator = value;
- }
- }
-
- [ItemProperty]
- public bool AroundNullCoalescingOperator {
- get {
- return options.SpaceAroundNullCoalescingOperator;
- }
- set {
- options.SpaceAroundNullCoalescingOperator = value;
+ options = options.WithChangedOption (Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.NewLineForMembersInAnonymousTypes, value);
}
}
[ItemProperty]
- public bool SpaceAfterUnsafeAddressOfOperator {
+ public bool NewLineForClausesInQuery {
get {
- return options.SpaceAfterUnsafeAddressOfOperator;
+ return options.GetOption (Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.NewLineForClausesInQuery);
}
set {
- options.SpaceAfterUnsafeAddressOfOperator = value;
+ options = options.WithChangedOption (Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.NewLineForClausesInQuery, value);
}
}
+ #endregion
+ #region Spacing options
[ItemProperty]
- public bool SpaceAfterUnsafeAsteriskOfOperator {
+ public bool SpacingAfterMethodDeclarationName {
get {
- return options.SpaceAfterUnsafeAsteriskOfOperator;
+ return options.GetOption (Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.SpacingAfterMethodDeclarationName);
}
set {
- options.SpaceAfterUnsafeAsteriskOfOperator = value;
+ options = options.WithChangedOption (Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.SpacingAfterMethodDeclarationName, value);
}
}
[ItemProperty]
- public bool SpaceAroundUnsafeArrowOperator {
+ public bool SpaceWithinMethodDeclarationParenthesis {
get {
- return options.SpaceAroundUnsafeArrowOperator;
+ return options.GetOption (Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.SpaceWithinMethodDeclarationParenthesis);
}
set {
- options.SpaceAroundUnsafeArrowOperator = value;
+ options = options.WithChangedOption (Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.SpaceWithinMethodDeclarationParenthesis, value);
}
}
[ItemProperty]
- public bool WithinParentheses {
- get {
- return options.SpacesWithinParentheses;
- }
- set {
- options.SpacesWithinParentheses = value;
- }
- }
-
-
- [ItemProperty]
- public bool WithinIfParentheses {
- get {
- return options.SpacesWithinIfParentheses;
- }
- set {
- options.SpacesWithinIfParentheses = value;
- }
- }
-
- [ItemProperty]
- public bool WithinWhileParentheses {
- get {
- return options.SpacesWithinWhileParentheses;
- }
- set {
- options.SpacesWithinWhileParentheses = value;
- }
- }
-
- [ItemProperty]
- public bool WithinForParentheses {
- get {
- return options.SpacesWithinForParentheses;
- }
- set {
- options.SpacesWithinForParentheses = value;
- }
- }
-
- [ItemProperty]
- public bool WithinForEachParentheses {
- get {
- return options.SpacesWithinForeachParentheses;
- }
- set {
- options.SpacesWithinForeachParentheses = value;
- }
- }
-
- [ItemProperty]
- public bool WithinCatchParentheses {
- get {
- return options.SpacesWithinCatchParentheses;
- }
- set {
- options.SpacesWithinCatchParentheses = value;
- }
- }
-
- [ItemProperty]
- public bool WithinSwitchParentheses {
- get {
- return options.SpacesWithinSwitchParentheses;
- }
- set {
- options.SpacesWithinSwitchParentheses = value;
- }
- }
-
- [ItemProperty]
- public bool WithinLockParentheses {
- get {
- return options.SpacesWithinLockParentheses;
- }
- set {
- options.SpacesWithinLockParentheses = value;
- }
- }
-
- [ItemProperty]
- public bool WithinUsingParentheses {
- get {
- return options.SpacesWithinUsingParentheses;
- }
- set {
- options.SpacesWithinUsingParentheses = value;
- }
- }
-
- [ItemProperty]
- public bool WithinCastParentheses {
- get {
- return options.SpacesWithinCastParentheses;
- }
- set {
- options.SpacesWithinCastParentheses = value;
- }
- }
-
- [ItemProperty]
- public bool WithinSizeOfParentheses {
- get {
- return options.SpacesWithinSizeOfParentheses;
- }
- set {
- options.SpacesWithinSizeOfParentheses = value;
- }
- }
-
- [ItemProperty]
- public bool BeforeSizeOfParentheses {
- get {
- return options.SpaceBeforeSizeOfParentheses;
- }
- set {
- options.SpaceBeforeSizeOfParentheses = value;
- }
- }
-
- [ItemProperty]
- public bool WithinTypeOfParentheses {
- get {
- return options.SpacesWithinTypeOfParentheses;
- }
- set {
- options.SpacesWithinTypeOfParentheses = value;
- }
- }
-
- [ItemProperty]
- public bool WithinNewParentheses {
- get {
- return options.SpacesWithinNewParentheses;
- }
- set {
- options.SpacesWithinNewParentheses = value;
- }
- }
-
- [ItemProperty]
- public bool BetweenEmptyNewParentheses {
- get {
- return options.SpacesBetweenEmptyNewParentheses;
- }
- set {
- options.SpacesBetweenEmptyNewParentheses = value;
- }
- }
-
- [ItemProperty]
- public bool BeforeNewParameterComma {
- get {
- return options.SpaceBeforeNewParameterComma;
- }
- set {
- options.SpaceBeforeNewParameterComma = value;
- }
- }
-
- [ItemProperty]
- public bool AfterNewParameterComma {
- get {
- return options.SpaceAfterNewParameterComma;
- }
- set {
- options.SpaceAfterNewParameterComma = value;
- }
- }
-
- [ItemProperty]
- public bool BeforeTypeOfParentheses {
- get {
- return options.SpaceBeforeTypeOfParentheses;
- }
- set {
- options.SpaceBeforeTypeOfParentheses = value;
- }
- }
-
- [ItemProperty]
- public bool WithinCheckedExpressionParantheses {
- get {
- return options.SpacesWithinCheckedExpressionParantheses;
- }
- set {
- options.SpacesWithinCheckedExpressionParantheses = value;
- }
- }
-
- [ItemProperty]
- public bool ConditionalOperatorBeforeConditionSpace {
- get {
- return options.SpaceBeforeConditionalOperatorCondition;
- }
- set {
- options.SpaceBeforeConditionalOperatorCondition = value;
- }
- }
-
- [ItemProperty]
- public bool ConditionalOperatorAfterConditionSpace {
- get {
- return options.SpaceAfterConditionalOperatorCondition;
- }
- set {
- options.SpaceAfterConditionalOperatorCondition = value;
- }
- }
-
- [ItemProperty]
- public bool ConditionalOperatorBeforeSeparatorSpace {
- get {
- return options.SpaceBeforeConditionalOperatorSeparator;
- }
- set {
- options.SpaceBeforeConditionalOperatorSeparator = value;
- }
- }
-
- [ItemProperty]
- public bool ConditionalOperatorAfterSeparatorSpace {
- get {
- return options.SpaceAfterConditionalOperatorSeparator;
- }
- set {
- options.SpaceAfterConditionalOperatorSeparator = value;
- }
- }
-
- // brackets
- [ItemProperty]
- public bool SpacesWithinBrackets {
- get {
- return options.SpacesWithinBrackets;
- }
- set {
- options.SpacesWithinBrackets = value;
- }
- }
- [ItemProperty]
- public bool SpacesBeforeBrackets {
- get {
- return options.SpacesBeforeBrackets;
- }
- set {
- options.SpacesBeforeBrackets = value;
- }
- }
- [ItemProperty]
- public bool BeforeBracketComma {
- get {
- return options.SpaceBeforeBracketComma;
- }
- set {
- options.SpaceBeforeBracketComma = value;
- }
- }
- [ItemProperty]
- public bool AfterBracketComma {
- get {
- return options.SpaceAfterBracketComma;
- }
- set {
- options.SpaceAfterBracketComma = value;
- }
- }
-
-
- [ItemProperty]
- public bool SpacesBeforeForSemicolon {
+ public bool SpaceBetweenEmptyMethodDeclarationParentheses {
get {
- return options.SpaceBeforeForSemicolon;
+ return options.GetOption (Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.SpaceBetweenEmptyMethodDeclarationParentheses);
}
set {
- options.SpaceBeforeForSemicolon = value;
+ options = options.WithChangedOption (Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.SpaceBetweenEmptyMethodDeclarationParentheses, value);
}
}
[ItemProperty]
- public bool SpaceBeforeSemicolon {
- get {
- return options.SpaceBeforeSemicolon;
- }
- set {
- options.SpaceBeforeSemicolon = value;
- }
- }
-
- [ItemProperty]
- public bool SpacesAfterForSemicolon {
+ public bool SpaceAfterMethodCallName {
get {
- return options.SpaceAfterForSemicolon;
+ return options.GetOption (Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.SpaceAfterMethodCallName);
}
set {
- options.SpaceAfterForSemicolon = value;
+ options = options.WithChangedOption (Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.SpaceAfterMethodCallName, value);
}
}
-
- [ItemProperty]
- public bool SpacesAfterTypecast {
- get {
- return options.SpaceAfterTypecast;
- }
- set {
- options.SpaceAfterTypecast = value;
- }
- }
-
- [ItemProperty]
- public bool SpacesBeforeArrayDeclarationBrackets {
- get {
- return options.SpaceBeforeArrayDeclarationBrackets;
- }
- set {
- options.SpaceBeforeArrayDeclarationBrackets = value;
- }
- }
- #endregion
-
- #region Blank Lines
- [ItemProperty]
- public int BlankLinesBeforeUsings {
- get {
- return options.MinimumBlankLinesBeforeUsings;
- }
- set {
- options.MinimumBlankLinesBeforeUsings = value;
- }
- }
-
- [ItemProperty]
- public int BlankLinesAfterUsings {
- get {
- return options.MinimumBlankLinesAfterUsings;
- }
- set {
- options.MinimumBlankLinesAfterUsings = value;
- }
- }
-
- [ItemProperty]
- public int BlankLinesBeforeFirstDeclaration {
- get {
- return options.MinimumBlankLinesBeforeFirstDeclaration;
- }
- set {
- options.MinimumBlankLinesBeforeFirstDeclaration = value;
- }
- }
-
+
[ItemProperty]
- public int BlankLinesBetweenTypes {
+ public bool SpaceWithinMethodCallParentheses {
get {
- return options.MinimumBlankLinesBetweenTypes;
+ return options.GetOption (Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.SpaceWithinMethodCallParentheses);
}
set {
- options.MinimumBlankLinesBetweenTypes = value;
+ options = options.WithChangedOption (Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.SpaceWithinMethodCallParentheses, value);
}
}
-
+
[ItemProperty]
- public int BlankLinesBetweenFields {
+ public bool SpaceBetweenEmptyMethodCallParentheses {
get {
- return options.MinimumBlankLinesBetweenFields;
+ return options.GetOption (Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.SpaceBetweenEmptyMethodCallParentheses);
}
set {
- options.MinimumBlankLinesBetweenFields = value;
+ options = options.WithChangedOption (Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.SpaceBetweenEmptyMethodCallParentheses, value);
}
}
-
+
[ItemProperty]
- public int BlankLinesBetweenEventFields {
+ public bool SpaceAfterControlFlowStatementKeyword {
get {
- return options.MinimumBlankLinesBetweenEventFields;
+ return options.GetOption (Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.SpaceAfterControlFlowStatementKeyword);
}
set {
- options.MinimumBlankLinesBetweenEventFields = value;
+ options = options.WithChangedOption (Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.SpaceAfterControlFlowStatementKeyword, value);
}
}
-
+
[ItemProperty]
- public int BlankLinesBetweenMembers {
+ public bool SpaceWithinExpressionParentheses {
get {
- return options.MinimumBlankLinesBetweenMembers;
+ return options.GetOption (Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.SpaceWithinExpressionParentheses);
}
set {
- options.MinimumBlankLinesBetweenMembers = value;
+ options = options.WithChangedOption (Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.SpaceWithinExpressionParentheses, value);
}
}
[ItemProperty]
- public int BlankLinesAroundRegion {
+ public bool SpaceWithinCastParentheses {
get {
- return options.MinimumBlankLinesAroundRegion;
+ return options.GetOption (Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.SpaceWithinCastParentheses);
}
set {
- options.MinimumBlankLinesAroundRegion = value;
+ options = options.WithChangedOption (Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.SpaceWithinCastParentheses, value);
}
}
[ItemProperty]
- public int BlankLinesInsideRegion {
+ public bool SpaceWithinOtherParentheses {
get {
- return options.MinimumBlankLinesInsideRegion;
+ return options.GetOption (Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.SpaceWithinOtherParentheses);
}
set {
- options.MinimumBlankLinesInsideRegion = value;
+ options = options.WithChangedOption (Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.SpaceWithinOtherParentheses, value);
}
}
- #endregion
- #region Wrapping
[ItemProperty]
- public Wrapping MethodCallArgumentWrapping {
+ public bool SpaceAfterCast {
get {
- return options.MethodCallArgumentWrapping;
+ return options.GetOption (Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.SpaceAfterCast);
}
set {
- options.MethodCallArgumentWrapping = value;
+ options = options.WithChangedOption (Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.SpaceAfterCast, value);
}
}
[ItemProperty]
- public NewLinePlacement NewLineAferMethodCallOpenParentheses {
+ public bool SpacesIgnoreAroundVariableDeclaration {
get {
- return options.NewLineAferMethodCallOpenParentheses;
+ return options.GetOption (Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.SpacesIgnoreAroundVariableDeclaration);
}
set {
- options.NewLineAferMethodCallOpenParentheses = value;
+ options = options.WithChangedOption (Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.SpacesIgnoreAroundVariableDeclaration, value);
}
}
[ItemProperty]
- public NewLinePlacement MethodCallClosingParenthesesOnNewLine {
+ public bool SpaceBeforeOpenSquareBracket {
get {
- return options.MethodCallClosingParenthesesOnNewLine;
+ return options.GetOption (Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.SpaceBeforeOpenSquareBracket);
}
set {
- options.MethodCallClosingParenthesesOnNewLine = value;
+ options = options.WithChangedOption (Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.SpaceBeforeOpenSquareBracket, value);
}
}
[ItemProperty]
- public bool AlignToFirstMethodCallArgument {
+ public bool SpaceBetweenEmptySquareBrackets {
get {
- return options.AlignToFirstMethodCallArgument;
+ return options.GetOption (Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.SpaceBetweenEmptySquareBrackets);
}
set {
- options.AlignToFirstMethodCallArgument = value;
+ options = options.WithChangedOption (Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.SpaceBetweenEmptySquareBrackets, value);
}
}
[ItemProperty]
- public Wrapping MethodDeclarationParameterWrapping {
+ public bool SpaceWithinSquareBrackets {
get {
- return options.MethodDeclarationParameterWrapping;
+ return options.GetOption (Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.SpaceWithinSquareBrackets);
}
set {
- options.MethodDeclarationParameterWrapping = value;
+ options = options.WithChangedOption (Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.SpaceWithinSquareBrackets, value);
}
}
[ItemProperty]
- public NewLinePlacement NewLineAferMethodDeclarationOpenParentheses {
+ public bool SpaceAfterColonInBaseTypeDeclaration {
get {
- return options.NewLineAferMethodDeclarationOpenParentheses;
+ return options.GetOption (Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.SpaceAfterColonInBaseTypeDeclaration);
}
set {
- options.NewLineAferMethodDeclarationOpenParentheses = value;
+ options = options.WithChangedOption (Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.SpaceAfterColonInBaseTypeDeclaration, value);
}
}
[ItemProperty]
- public NewLinePlacement MethodDeclarationClosingParenthesesOnNewLine {
+ public bool SpaceAfterComma {
get {
- return options.MethodDeclarationClosingParenthesesOnNewLine;
+ return options.GetOption (Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.SpaceAfterComma);
}
set {
- options.MethodDeclarationClosingParenthesesOnNewLine = value;
+ options = options.WithChangedOption (Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.SpaceAfterComma, value);
}
}
[ItemProperty]
- public bool AlignToFirstMethodDeclarationParameter {
+ public bool SpaceAfterDot {
get {
- return options.AlignToFirstMethodDeclarationParameter;
+ return options.GetOption (Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.SpaceAfterDot);
}
set {
- options.AlignToFirstMethodDeclarationParameter = value;
+ options = options.WithChangedOption (Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.SpaceAfterDot, value);
}
}
-
+
[ItemProperty]
- public Wrapping IndexerDeclarationParameterWrapping {
+ public bool SpaceAfterSemicolonsInForStatement {
get {
- return options.IndexerDeclarationParameterWrapping;
+ return options.GetOption (Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.SpaceAfterSemicolonsInForStatement);
}
set {
- options.IndexerDeclarationParameterWrapping = value;
+ options = options.WithChangedOption (Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.SpaceAfterSemicolonsInForStatement, value);
}
}
[ItemProperty]
- public NewLinePlacement NewLineAferIndexerDeclarationOpenBracket {
+ public bool SpaceBeforeColonInBaseTypeDeclaration {
get {
- return options.NewLineAferIndexerDeclarationOpenBracket;
+ return options.GetOption (Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.SpaceBeforeColonInBaseTypeDeclaration);
}
set {
- options.NewLineAferIndexerDeclarationOpenBracket = value;
+ options = options.WithChangedOption (Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.SpaceBeforeColonInBaseTypeDeclaration, value);
}
}
[ItemProperty]
- public NewLinePlacement IndexerDeclarationClosingBracketOnNewLine {
+ public bool SpaceBeforeComma {
get {
- return options.IndexerDeclarationClosingBracketOnNewLine;
+ return options.GetOption (Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.SpaceBeforeComma);
}
set {
- options.IndexerDeclarationClosingBracketOnNewLine = value;
+ options = options.WithChangedOption (Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.SpaceBeforeComma, value);
}
}
[ItemProperty]
- public bool AlignToFirstIndexerDeclarationParameter {
+ public bool SpaceBeforeDot {
get {
- return options.AlignToFirstIndexerDeclarationParameter;
+ return options.GetOption (Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.SpaceBeforeDot);
}
set {
- options.AlignToFirstIndexerDeclarationParameter = value;
+ options = options.WithChangedOption (Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.SpaceBeforeDot, value);
}
}
[ItemProperty]
- public Wrapping IndexerArgumentWrapping {
+ public bool SpaceBeforeSemicolonsInForStatement {
get {
- return options.IndexerArgumentWrapping;
+ return options.GetOption (Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.SpaceBeforeSemicolonsInForStatement);
}
set {
- options.IndexerArgumentWrapping = value;
+ options = options.WithChangedOption (Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.SpaceBeforeSemicolonsInForStatement, value);
}
}
[ItemProperty]
- public NewLinePlacement NewLineAferIndexerOpenBracket {
+ public Microsoft.CodeAnalysis.CSharp.Formatting.BinaryOperatorSpacingOptions SpacingAroundBinaryOperator {
get {
- return options.NewLineAferIndexerOpenBracket;
+ return options.GetOption (Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.SpacingAroundBinaryOperator);
}
set {
- options.NewLineAferIndexerOpenBracket = value;
+ options = options.WithChangedOption (Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.SpacingAroundBinaryOperator, value);
}
}
+ #endregion
+
+ #region Wrapping options
[ItemProperty]
- public NewLinePlacement IndexerClosingBracketOnNewLine {
+ public bool WrappingPreserveSingleLine {
get {
- return options.IndexerClosingBracketOnNewLine;
+ return options.GetOption (Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.WrappingPreserveSingleLine);
}
set {
- options.IndexerClosingBracketOnNewLine = value;
+ options = options.WithChangedOption (Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.WrappingPreserveSingleLine, value);
}
}
[ItemProperty]
- public bool AlignToFirstIndexerArgument {
+ public bool WrappingKeepStatementsOnSingleLine {
get {
- return options.AlignToFirstIndexerArgument;
+ return options.GetOption (Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.WrappingKeepStatementsOnSingleLine);
}
set {
- options.AlignToFirstIndexerArgument = value;
+ options = options.WithChangedOption (Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.WrappingKeepStatementsOnSingleLine, value);
}
}
@@ -1656,7 +566,7 @@ namespace MonoDevelop.CSharp.Formatting
public CSharpFormattingPolicy ()
{
- this.options = FormattingOptionsFactory.CreateMono ();
+ this.options = TypeSystemService.Workspace.Options;
}
public static CSharpFormattingPolicy Load (FilePath selectedFile)
@@ -1707,10 +617,14 @@ namespace MonoDevelop.CSharp.Formatting
writer.WriteAttributeString ("name", Name);
foreach (PropertyInfo info in typeof (CSharpFormattingPolicy).GetProperties ()) {
if (info.GetCustomAttributes (false).Any (o => o.GetType () == typeof(ItemPropertyAttribute))) {
- writer.WriteStartElement ("Property");
+ writer.WriteStartElement (info.Name);
+ writer.WriteValue (info.GetValue (this, null).ToString ());
+ writer.WriteEndElement ();
+
+ /* writer.WriteStartElement ("Property");
writer.WriteAttributeString ("name", info.Name);
writer.WriteAttributeString ("value", info.GetValue (this, null).ToString ());
- writer.WriteEndElement ();
+ writer.WriteEndElement ();*/
}
}
writer.WriteEndElement ();