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')
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/CSharpFormatter.cs92
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/CSharpFormattingPolicy.cs1494
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/CSharpFormattingPolicyPanel.cs3
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/CSharpFormattingPolicyPanelWidget.cs28
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/CSharpFormattingProfileDialog.cs1174
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/CSharpIndentVirtualSpaceManager.cs52
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/CSharpTextEditorIndentation.cs520
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/CSharpTextPasteHandler.cs90
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/NewFormattingProfileDialog.cs4
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/OnTheFlyFormatter.cs274
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/policies/AllmanCSharpPolicy.xml178
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/policies/GNUCSharpPolicy.xml163
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/policies/GNUTextStylePolicy.xml37
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/policies/KRCSharpPolicy.xml178
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/policies/MonoCSharpPolicy.xml180
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/policies/SharpDevelopCSharpPolicy.xml164
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/policies/WhitesmithsCSharpPolicy.xml164
17 files changed, 1111 insertions, 3684 deletions
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/CSharpFormatter.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/CSharpFormatter.cs
index fd3d5506ed..65120bbf3b 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/CSharpFormatter.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/CSharpFormatter.cs
@@ -27,15 +27,20 @@ using System;
using System.Collections.Generic;
-using Mono.TextEditor;
using MonoDevelop.CSharp.Formatting;
using MonoDevelop.Ide.Gui.Content;
using MonoDevelop.Projects.Policies;
using System.Linq;
using MonoDevelop.Ide.CodeFormatting;
-using ICSharpCode.NRefactory.CSharp;
using MonoDevelop.Core;
using MonoDevelop.CSharp.Refactoring;
+using MonoDevelop.Ide.Editor;
+using Microsoft.CodeAnalysis.CSharp;
+using Microsoft.CodeAnalysis.Text;
+using Microsoft.CodeAnalysis.Formatting;
+using MonoDevelop.Ide.TypeSystem;
+using ICSharpCode.NRefactory6.CSharp;
+using MonoDevelop.Ide;
namespace MonoDevelop.CSharp.Formatting
{
@@ -48,100 +53,53 @@ namespace MonoDevelop.CSharp.Formatting
public override bool SupportsCorrectingIndent { get { return true; } }
public override void CorrectIndenting (PolicyContainer policyParent, IEnumerable<string> mimeTypeChain,
- TextEditorData data, int line)
+ TextEditor data, int line)
{
- DocumentLine lineSegment = data.Document.GetLine (line);
+ var lineSegment = data.GetLine (line);
if (lineSegment == null)
return;
try {
var policy = policyParent.Get<CSharpFormattingPolicy> (mimeTypeChain);
- var tracker = new CSharpIndentEngine (data.Document, data.CreateNRefactoryTextEditorOptions (), policy.CreateOptions ());
+ var textpolicy = policyParent.Get<TextStylePolicy> (mimeTypeChain);
+ var tracker = new CSharpIndentEngine (policy.CreateOptions (textpolicy));
- tracker.Update (lineSegment.Offset);
+ tracker.Update (IdeApp.Workbench.ActiveDocument.Editor, lineSegment.Offset);
for (int i = lineSegment.Offset; i < lineSegment.Offset + lineSegment.Length; i++) {
- tracker.Push (data.Document.GetCharAt (i));
+ tracker.Push (data.GetCharAt (i));
}
- string curIndent = lineSegment.GetIndentation (data.Document);
+ string curIndent = lineSegment.GetIndentation (data);
int nlwsp = curIndent.Length;
- if (!tracker.LineBeganInsideMultiLineComment || (nlwsp < lineSegment.LengthIncludingDelimiter && data.Document.GetCharAt (lineSegment.Offset + nlwsp) == '*')) {
+ if (!tracker.LineBeganInsideMultiLineComment || (nlwsp < lineSegment.LengthIncludingDelimiter && data.GetCharAt (lineSegment.Offset + nlwsp) == '*')) {
// Possibly replace the indent
string newIndent = tracker.ThisLineIndent;
if (newIndent != curIndent)
- data.Replace (lineSegment.Offset, nlwsp, newIndent);
+ data.ReplaceText (lineSegment.Offset, nlwsp, newIndent);
}
} catch (Exception e) {
LoggingService.LogError ("Error while indenting", e);
}
}
- public override void OnTheFlyFormat (MonoDevelop.Ide.Gui.Document doc, int startOffset, int endOffset)
+ public override void OnTheFlyFormat (TextEditor editor, DocumentContext context, int startOffset, int endOffset)
{
- OnTheFlyFormatter.Format (doc, startOffset, endOffset);
+ OnTheFlyFormatter.Format (editor, context, startOffset, endOffset);
}
public static string FormatText (CSharpFormattingPolicy policy, TextStylePolicy textPolicy, string mimeType, string input, int startOffset, int endOffset)
{
- var data = new TextEditorData ();
- data.Document.SuppressHighlightUpdate = true;
- data.Document.MimeType = mimeType;
- data.Document.FileName = "toformat.cs";
- if (textPolicy != null) {
- data.Options.TabsToSpaces = textPolicy.TabsToSpaces;
- data.Options.TabSize = textPolicy.TabWidth;
- data.Options.IndentationSize = textPolicy.IndentWidth;
- data.Options.IndentStyle = textPolicy.RemoveTrailingWhitespace ? IndentStyle.Virtual : IndentStyle.Smart;
- }
- data.Text = input;
-
- // System.Console.WriteLine ("-----");
- // System.Console.WriteLine (data.Text.Replace (" ", ".").Replace ("\t", "->"));
- // System.Console.WriteLine ("-----");
+ var inputTree = CSharpSyntaxTree.ParseText (SourceText.From (input));
- var parser = new CSharpParser ();
- var compilationUnit = parser.Parse (data);
- bool hadErrors = parser.HasErrors;
+ var root = inputTree.GetRoot ();
+ var doc = Formatter.Format (root, new TextSpan (startOffset, endOffset - startOffset), TypeSystemService.Workspace, policy.CreateOptions (textPolicy));
+ var result = doc.ToFullString ();
+ if (textPolicy.GetEolMarker () != "\r\n")
+ result = result.Replace ("\r", "");
- if (hadErrors) {
- // foreach (var e in parser.ErrorReportPrinter.Errors)
- // Console.WriteLine (e.Message);
- return input.Substring (startOffset, Math.Max (0, Math.Min (endOffset, input.Length) - startOffset));
- }
-
- var originalVersion = data.Document.Version;
-
- var textEditorOptions = data.CreateNRefactoryTextEditorOptions ();
- var formattingVisitor = new ICSharpCode.NRefactory.CSharp.CSharpFormatter (
- policy.CreateOptions (),
- textEditorOptions
- ) {
- FormattingMode = FormattingMode.Intrusive
- };
-
- var changes = formattingVisitor.AnalyzeFormatting (data.Document, compilationUnit);
- try {
- changes.ApplyChanges (startOffset, endOffset - startOffset);
- } catch (Exception e) {
- LoggingService.LogError ("Error in code formatter", e);
- return input.Substring (startOffset, Math.Max (0, Math.Min (endOffset, input.Length) - startOffset));
- }
-
- // check if the formatter has produced errors
- parser = new CSharpParser ();
- parser.Parse (data);
- if (parser.HasErrors) {
- LoggingService.LogError ("C# formatter produced source code errors. See console for output.");
- return input.Substring (startOffset, Math.Max (0, Math.Min (endOffset, input.Length) - startOffset));
- }
-
- var currentVersion = data.Document.Version;
-
- string result = data.GetTextBetween (startOffset, originalVersion.MoveOffsetTo (currentVersion, endOffset));
- data.Dispose ();
- return result;
+ return result.Substring (startOffset, endOffset + result.Length - input.Length - startOffset);
}
public override string FormatText (PolicyContainer policyParent, IEnumerable<string> mimeTypeChain, string input, int startOffset, int endOffset)
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 ();
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/CSharpFormattingPolicyPanel.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/CSharpFormattingPolicyPanel.cs
index e4475c07f3..c11aad0a58 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/CSharpFormattingPolicyPanel.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/CSharpFormattingPolicyPanel.cs
@@ -27,6 +27,7 @@
using Gtk;
using MonoDevelop.Ide.Gui.Dialogs;
using MonoDevelop.Ide.Gui.Content;
+using MonoDevelop.Ide.Editor;
namespace MonoDevelop.CSharp.Formatting
{
@@ -37,7 +38,7 @@ namespace MonoDevelop.CSharp.Formatting
static CSharpFormattingPolicyPanel ()
{
// ensure that custom text editor shemes are loaded.
- MonoDevelop.SourceEditor.SourceEditorDisplayBinding.InitSourceEditor ();
+ TextEditorDisplayBinding.InitSourceEditor ();
}
public override Widget CreatePanelWidget ()
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/CSharpFormattingPolicyPanelWidget.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/CSharpFormattingPolicyPanelWidget.cs
index 614ba73928..3a892fa547 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/CSharpFormattingPolicyPanelWidget.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/CSharpFormattingPolicyPanelWidget.cs
@@ -26,6 +26,7 @@
using System;
using MonoDevelop.Ide;
using MonoDevelop.Ide.Gui.Content;
+using MonoDevelop.Ide.Editor;
namespace MonoDevelop.CSharp.Formatting
@@ -33,7 +34,8 @@ namespace MonoDevelop.CSharp.Formatting
[System.ComponentModel.ToolboxItem(true)]
partial class CSharpFormattingPolicyPanelWidget : Gtk.Bin
{
- readonly Mono.TextEditor.TextEditor texteditor = new Mono.TextEditor.TextEditor ();
+ readonly TextEditor texteditor = TextEditorFactory.CreateNewEditor ();
+
// Gtk.ListStore model = new Gtk.ListStore (typeof(string));
// List<CSharpFormattingPolicy> policies = new List<CSharpFormattingPolicy> ();
const string example = @"using System;
@@ -50,14 +52,14 @@ namespace Example {
}";
TextStylePolicy textStylePolicy;
CSharpFormattingPolicy policy;
- public CSharpFormattingPolicy Policy {
+ internal CSharpFormattingPolicy Policy {
get {
return policy;
}
}
- public void SetPolicy (CSharpFormattingPolicy formattingPolicy, TextStylePolicy textStylePolicy)
+ internal void SetPolicy (CSharpFormattingPolicy formattingPolicy, TextStylePolicy textStylePolicy)
{
policy = formattingPolicy;
this.textStylePolicy = textStylePolicy;
@@ -77,26 +79,18 @@ namespace Example {
policy = new CSharpFormattingPolicy ();
buttonEdit.Clicked += HandleButtonEditClicked;
- var options = MonoDevelop.SourceEditor.DefaultSourceEditorOptions.Instance;
- texteditor.Options.FontName = options.FontName;
- texteditor.Options.ColorScheme = options.ColorScheme;
- texteditor.Options.ShowFoldMargin = false;
- texteditor.Options.ShowIconMargin = false;
- texteditor.Options.ShowLineNumberMargin = false;
- texteditor.Document.ReadOnly = true;
- texteditor.Document.MimeType = CSharpFormatter.MimeType;
+ texteditor.Options = DefaultSourceEditorOptions.PlainEditor;
+ texteditor.IsReadOnly = true;
+ texteditor.MimeType = CSharpFormatter.MimeType;
scrolledwindow1.Child = texteditor;
ShowAll ();
}
public void FormatSample ()
{
- if (textStylePolicy != null) {
- texteditor.Options.IndentationSize = textStylePolicy.IndentWidth;
- texteditor.Options.TabSize = textStylePolicy.TabWidth;
- texteditor.Options.TabsToSpaces = textStylePolicy.TabsToSpaces;
- }
- texteditor.Document.Text = CSharpFormatter.FormatText (policy, textStylePolicy, CSharpFormatter.MimeType, example, 0, example.Length);
+ texteditor.Options = DefaultSourceEditorOptions.Instance.WithTextStyle (textStylePolicy);
+
+ texteditor.Text = CSharpFormatter.FormatText (policy, textStylePolicy, CSharpFormatter.MimeType, example, 0, example.Length);
}
void HandleButtonEditClicked (object sender, EventArgs e)
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/CSharpFormattingProfileDialog.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/CSharpFormattingProfileDialog.cs
index 346dad4f94..7f08f7dae2 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/CSharpFormattingProfileDialog.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/CSharpFormattingProfileDialog.cs
@@ -30,391 +30,51 @@ using MonoDevelop.Ide;
using System.Reflection;
using System.Collections.Generic;
using System.Linq;
-using ICSharpCode.NRefactory.CSharp;
using MonoDevelop.Components;
+using MonoDevelop.Ide.Editor;
+using MonoDevelop.Ide.Gui.Content;
namespace MonoDevelop.CSharp.Formatting
{
partial class CSharpFormattingProfileDialog : Dialog
{
- readonly Mono.TextEditor.TextEditor texteditor = new Mono.TextEditor.TextEditor ();
+ readonly TextEditor texteditor = TextEditorFactory.CreateNewEditor ();
readonly CSharpFormattingPolicy profile;
- TreeStore indentOptions, bacePositionOptions, newLineOptions, whiteSpaceOptions, wrappingOptions;
-
- static readonly Dictionary<Wrapping, string> arrayInitializerTranslationDictionary = new Dictionary<Wrapping, string> ();
- static readonly Dictionary<BraceStyle, string> braceStyleTranslationDictionary = new Dictionary<BraceStyle, string> ();
- //static Dictionary<BraceForcement, string> braceForcementTranslationDictionary = new Dictionary<BraceForcement, string> ();
- static readonly Dictionary<PropertyFormatting, string> propertyFormattingTranslationDictionary = new Dictionary<PropertyFormatting, string> ();
- static readonly Dictionary<NewLinePlacement, string> newLinePlacementTranslationDictionary = new Dictionary<NewLinePlacement, string> ();
-
+ TreeStore indentationOptions, newLineOptions, spacingOptions, styleOptions, wrappingOptions;
+ static readonly Dictionary<Microsoft.CodeAnalysis.CSharp.Formatting.LabelPositionOptions, string> labelPositionOptionsTranslationDictionary = new Dictionary<Microsoft.CodeAnalysis.CSharp.Formatting.LabelPositionOptions, string> ();
+ static readonly Dictionary<Microsoft.CodeAnalysis.CSharp.Formatting.BinaryOperatorSpacingOptions, string> binaryOperatorSpacingOptionsDictionary = new Dictionary<Microsoft.CodeAnalysis.CSharp.Formatting.BinaryOperatorSpacingOptions, string> ();
+
+
static CSharpFormattingProfileDialog ()
{
- braceStyleTranslationDictionary [BraceStyle.DoNotChange] = GettextCatalog.GetString ("Do not change");
- braceStyleTranslationDictionary [BraceStyle.EndOfLine] = GettextCatalog.GetString ("End of line");
- braceStyleTranslationDictionary [BraceStyle.EndOfLineWithoutSpace] = GettextCatalog.GetString ("End of line without space");
- braceStyleTranslationDictionary [BraceStyle.NextLine] = GettextCatalog.GetString ("Next line");
- braceStyleTranslationDictionary [BraceStyle.NextLineShifted] = GettextCatalog.GetString ("Next line shifted");
- braceStyleTranslationDictionary [BraceStyle.NextLineShifted2] = GettextCatalog.GetString ("Next line shifted2");
- braceStyleTranslationDictionary [BraceStyle.BannerStyle] = GettextCatalog.GetString ("Banner style");
-
- propertyFormattingTranslationDictionary [PropertyFormatting.AllowOneLine] = GettextCatalog.GetString ("Allow one line");
- propertyFormattingTranslationDictionary [PropertyFormatting.ForceOneLine] = GettextCatalog.GetString ("Force one line");
- propertyFormattingTranslationDictionary [PropertyFormatting.ForceNewLine] = GettextCatalog.GetString ("Force new line");
-
- arrayInitializerTranslationDictionary [Wrapping.DoNotChange] = GettextCatalog.GetString ("Do not change");
- arrayInitializerTranslationDictionary [Wrapping.DoNotWrap] = GettextCatalog.GetString ("Do not Wrap");
- arrayInitializerTranslationDictionary [Wrapping.WrapAlways] = GettextCatalog.GetString ("Wrap always");
- arrayInitializerTranslationDictionary [Wrapping.WrapIfTooLong] = GettextCatalog.GetString ("Wrap if too long");
+ labelPositionOptionsTranslationDictionary [Microsoft.CodeAnalysis.CSharp.Formatting.LabelPositionOptions.LeftMost] = GettextCatalog.GetString ("leftmost column");
+ labelPositionOptionsTranslationDictionary [Microsoft.CodeAnalysis.CSharp.Formatting.LabelPositionOptions.NoIndent] = GettextCatalog.GetString ("normal placement");
+ labelPositionOptionsTranslationDictionary [Microsoft.CodeAnalysis.CSharp.Formatting.LabelPositionOptions.OneLess] = GettextCatalog.GetString ("one indent less");
- newLinePlacementTranslationDictionary [NewLinePlacement.DoNotCare] = GettextCatalog.GetString ("Allow both");
- newLinePlacementTranslationDictionary [NewLinePlacement.NewLine] = GettextCatalog.GetString ("Always new line");
- newLinePlacementTranslationDictionary [NewLinePlacement.SameLine] = GettextCatalog.GetString ("Always same line");
+ binaryOperatorSpacingOptionsDictionary [Microsoft.CodeAnalysis.CSharp.Formatting.BinaryOperatorSpacingOptions.Ignore] = GettextCatalog.GetString ("ignore");
+ binaryOperatorSpacingOptionsDictionary [Microsoft.CodeAnalysis.CSharp.Formatting.BinaryOperatorSpacingOptions.Remove] = GettextCatalog.GetString ("remove");
+ binaryOperatorSpacingOptionsDictionary [Microsoft.CodeAnalysis.CSharp.Formatting.BinaryOperatorSpacingOptions.Single] = GettextCatalog.GetString ("single");
}
public static string TranslateValue (object value)
{
- if (value is BraceStyle)
- return braceStyleTranslationDictionary [(BraceStyle)value];
-// if (value is BraceForcement)
-// return braceForcementTranslationDictionary [(BraceForcement)value];
- if (value is PropertyFormatting)
- return propertyFormattingTranslationDictionary [(PropertyFormatting)value];
- if (value is Wrapping)
- return arrayInitializerTranslationDictionary [(Wrapping)value];
- if (value is NewLinePlacement)
- return newLinePlacementTranslationDictionary [(NewLinePlacement)value];
+ if (value is Microsoft.CodeAnalysis.CSharp.Formatting.LabelPositionOptions)
+ return labelPositionOptionsTranslationDictionary [(Microsoft.CodeAnalysis.CSharp.Formatting.LabelPositionOptions)value];
+ if (value is Microsoft.CodeAnalysis.CSharp.Formatting.BinaryOperatorSpacingOptions)
+ return binaryOperatorSpacingOptionsDictionary [(Microsoft.CodeAnalysis.CSharp.Formatting.BinaryOperatorSpacingOptions)value];
throw new Exception ("unknown property type: " + value);
}
-
+
public static object ConvertProperty (Type propertyType, string newText)
{
- if (propertyType == typeof(BraceStyle))
- return braceStyleTranslationDictionary.First (p => p.Value == newText).Key;
-// if (propertyType == typeof(BraceForcement))
-// return braceForcementTranslationDictionary.First (p => p.Value == newText).Key;
- if (propertyType == typeof(PropertyFormatting))
- return propertyFormattingTranslationDictionary.First (p => p.Value == newText).Key;
- if (propertyType == typeof(Wrapping))
- return arrayInitializerTranslationDictionary.First (p => p.Value == newText).Key;
- if (propertyType == typeof(NewLinePlacement))
- return newLinePlacementTranslationDictionary.First (p => p.Value == newText).Key;
+ if (propertyType == typeof(Microsoft.CodeAnalysis.CSharp.Formatting.LabelPositionOptions))
+ return labelPositionOptionsTranslationDictionary.First (p => p.Value == newText).Key;
+ if (propertyType == typeof(Microsoft.CodeAnalysis.CSharp.Formatting.BinaryOperatorSpacingOptions))
+ return binaryOperatorSpacingOptionsDictionary.First (p => p.Value == newText).Key;
throw new Exception ("unknown property type: " + propertyType);
}
-
- #region Examples
- const string methodSpaceExample = @"class ClassDeclaration {
- public static void Main (string[] args)
- {
- Console.WriteLine (""Hello World!"");
- }
- }";
-
- const string propertyExample = @"class ClassDeclaration {
- int myProperty;
- int MyProperty {
- get { return myProperty;}
- set { myProperty = value;}
- }
-
- string Simple { get { ; } set { ; } }
-
- int myOtherProperty;
- int MyOtherProperty {
- get {
- Console.WriteLine (""get myOtherProperty"");
- return myOtherProperty;
- }
- set {
- if (myOtherProperty != value)
- myOtherProperty = value;
- }
- }
-
- int MyAutoProperty {
- get;
- set;
- }
-
- int MyOtherAutoProperty { get; set; }
- }";
-
- const string spaceExample = @"class ClassDeclaration {
- public void TestMethod ()
- {
- try {
- TestMethod ("""");
- } catch (Exception e) {
- // Do something
- } finally {
- // Do something
- }
- }
-
- public void TestMethod (string test)
- {
- lock (this) {
- switch (test) {
- case ""A"":
- Console.WriteLine (""was A"");
- break;
- case ""B"":
- Console.WriteLine (""was B"");
- break;
- }
- }
- }
-
- public void Calculate (int a, int b)
- {
- if (a < b) {
- for (int i = a; i < b; i++) {
- Console.WriteLine (i);
- }
- } else {
- using (object o = new object ()) {
- while (b < a) {
- ConentryNamesole.WriteLine (b++);
- }
- }
- }
- }
- }";
- const string eventExample = @"class ClassDeclaration {
- EventHandler<EventArgs> onAction;
- public event EventHandler<EventArgs> Action {
- add { onAction = (EventHandler<EventArgs>)Delegate.Combine(onAction, value); }
- remove { onAction = (EventHandler<EventArgs>)Delegate.Remove(onAction, value);}
- }
- EventHandler<EventArgs> onAnotherAction;
- public event EventHandler<EventArgs> AnotherAction {
- add { if (value != null)
- onAnotherAction = (EventHandler<EventArgs>)Delegate.Combine(onAnotherAction, value); }
- remove { if (value != null)
- onAnotherAction = (EventHandler<EventArgs>)Delegate.Remove(onAnotherAction, value);}
- }
- }";
-
- const string simpleUsingStatement = @"class ClassDeclaration {
- public void Test ()
- {
- using (object o = new object ()) {
- Console.WriteLine (""Hello World!"");
- }
- }
- }";
-
- const string simpleFixedStatement = @"class ClassDeclaration {
- public void Test (Point pt)
- {
- fixed (int* p = &pt.x) {
- *p = 10;
- }
- }
- }";
-
- const string simpleIf = @"class ClassDeclaration {
- public void Test (int i)
- {
- if (i == 5) {
- Console.WriteLine (""== 5"");
- } else if (i > 0) {
- Console.WriteLine ("">0"");
- } else if (i < 0) {
- Console.WriteLine (""<0"");
- } else {
- Console.WriteLine (""== 0"");
- }
- }
- }";
- const string longMethodCall = @"class ClassDeclaration {
- public void Test (int test)
- {
- LongMethodCallInSameLine (""Hello"", 1, test);
- LongMethodCallInMultiple (
-""Hello"",
- 1,
- test);
- LongMethodCallInMultipleCase2 (""Hello"",
- 1,
- test);
- }
-}";
- const string longMethodDeclaration = @"class ClassDeclaration {
- public void LongMethodCallInSameLine (int test, string foo, double bar)
- {
- }
- public void LongMethodCallInMultiple (
-int test,
-string foo,
-double bar)
- {
- }
- public void LongMethodCallInMultipleCase2 (int test,
-string foo,
-double bar)
- {
- }
-}";
- const string longIndexerDeclaration = @"class ClassDeclaration {
- public int this [int test, string foo, double bar]
- {
- get {}
- }
- public int this [
-int test,
-string foo,
-double bar]
- {
- get {}
- }
- public int this [int test,
-string foo,
-double bar]
- {
- get {}
- }
-}";
- const string longIndexer = @"class ClassDeclaration {
- public void Test (int test)
- {
- this [""Hello"", 1, test] = 0;
- this [
-""Hello"",
- 1,
- test] = 0;
-
- this [""Hello"",
- 1,
- test] = 0;
- }
-}";
- const string simpleWhile = @"class ClassDeclaration {
- public void Test ()
- {
- while (true) {
- Console.WriteLine (""Hello World!"");
- }
- }
- }";
- const string simpleCatch = @"class ClassDeclaration {
- public void Test ()
- {
- try {
- Console.WriteLine (""Hello World!"");
- } catch (Exception) {
- Console.WriteLine (""Got exception!!"");
- } finally {
- Console.WriteLine (""finally done."");
- }
- }
- }";
-
- const string simpleDoWhile = @"class ClassDeclaration {
- public void Test ()
- {
- int i = 0;
- do {
- Console.WriteLine (""Hello World!"");
- } while (i++ < 10);
- }
- }";
-
- const string simpleArrayInitializer = @"class ClassDeclaration {
- public void Test (object o)
- {
- int[] i = new int[] { 1, 3, 3, 7 };
- }
- }";
- const string condOpExample = @"class ClassDeclaration {
- public string GetSign (int i)
- {
- return i < 0 ? ""-"" : ""+"";
- }
- }";
- const string switchExample = @"class ClassDeclaration {
- public void Test (int i)
- {
- switch (i) {
- case 0:
- Console.WriteLine (""was zero"");
- break;
- case 1:
- Console.WriteLine (""was one"");
- break;
- default:
- Console.WriteLine (""was "" + i);
- break;
- }
- }
- }";
- const string simpleFor = @"class ClassDeclaration {
- public void Test ()
- {
- for (int i = 0; i < 10; i++) {
- Console.WriteLine (""Hello World!"");
- }
- }
- }";
- const string simpleForeach = @"class ClassDeclaration : ArrayList {
- public void Test ()
- {
- foreach (object o in this) {
- Console.WriteLine (""Hello World!"");
- }
- }
- }";
- const string simpleLock = @"class ClassDeclaration {
- public void Test ()
- {
- lock (this) {
- Console.WriteLine (""Hello World!"");
- }
- }
- }";
- const string operatorExample = @"class ClassDeclaration {
- public void TestMethod ()
- {
- int a = 5 << 5;
- int b = (a + 5 - 3) * 6 / 2;
- a += b;
- a = a & ~255;
- if (a == b || b < a >> 1) {
- b -= a;
- }
- }
- object Test (object a, object b)
- {
- return a ?? b;
- }
- }";
- const string blankLineExample = @"// Example
-using System;
-using System.Collections;
-namespace TestSpace {
- using MyNamespace;
- class Test
- {
- int a;
- string b;
- public Test (int a, string b)
- {
- this.a = a;
- this.b = b;
- }
- void Print ()
- {
- Console.WriteLine (""a: {0} b : {1}"", a, b);
- }
- }
- class MyTest
- {
- }
-}
-";
- #endregion
-
const int propertyColumn = 0;
const int displayTextColumn = 1;
const int exampleTextColumn = 2;
@@ -437,15 +97,13 @@ namespace TestSpace {
treeView = treeviewIndentOptions;
break;
case 1:
- treeView = treeviewBracePositions;
+ treeView = treeviewNewLines;
break;
case 2: // Blank lines
- UpdateExample (blankLineExample);
- return;
- case 3: // white spaces
- return;
- case 4:
- treeView = treeviewNewLines;
+ treeView = treeviewSpacing;
+ break;
+ case 3:
+ treeView = treeviewWrapping;
break;
default:
return;
@@ -458,30 +116,25 @@ namespace TestSpace {
};
notebookCategories.ShowTabs = false;
comboboxCategories.AppendText (GettextCatalog.GetString ("Indentation"));
- comboboxCategories.AppendText (GettextCatalog.GetString ("Braces"));
- comboboxCategories.AppendText (GettextCatalog.GetString ("Blank lines"));
- comboboxCategories.AppendText (GettextCatalog.GetString ("Wrapping"));
- comboboxCategories.AppendText (GettextCatalog.GetString ("White Space"));
comboboxCategories.AppendText (GettextCatalog.GetString ("New Lines"));
+ comboboxCategories.AppendText (GettextCatalog.GetString ("Spacing"));
+// comboboxCategories.AppendText (GettextCatalog.GetString ("Style"));
+ comboboxCategories.AppendText (GettextCatalog.GetString ("Wrapping"));
comboboxCategories.Changed += delegate {
texteditor.Text = "";
notebookCategories.Page = comboboxCategories.Active;
};
comboboxCategories.Active = 0;
- var options = MonoDevelop.SourceEditor.DefaultSourceEditorOptions.Instance;
- texteditor.Options.FontName = options.FontName;
- texteditor.Options.ColorScheme = options.ColorScheme;
- texteditor.Options.ShowFoldMargin = false;
- texteditor.Options.ShowIconMargin = false;
- texteditor.Options.ShowLineNumberMargin = false;
- texteditor.Document.ReadOnly = true;
- texteditor.Document.MimeType = CSharpFormatter.MimeType;
+ var options = DefaultSourceEditorOptions.Instance;
+ texteditor.Options = DefaultSourceEditorOptions.PlainEditor;
+ texteditor.IsReadOnly = true;
+ texteditor.MimeType = CSharpFormatter.MimeType;
scrolledwindow.Child = texteditor;
ShowAll ();
#region Indent options
- indentOptions = new TreeStore (typeof(string), typeof(string), typeof(string), typeof(bool), typeof(bool));
+ indentationOptions = new TreeStore (typeof(string), typeof(string), typeof(string), typeof(bool), typeof(bool));
var column = new TreeViewColumn ();
// pixbuf column
@@ -495,7 +148,7 @@ namespace TestSpace {
column.PackStart (cellRendererText, true);
column.SetAttributes (cellRendererText, "text", 1);
- treeviewIndentOptions.Model = indentOptions;
+ treeviewIndentOptions.Model = indentationOptions;
treeviewIndentOptions.HeadersVisible = false;
treeviewIndentOptions.Selection.Changed += TreeSelectionChanged;
treeviewIndentOptions.AppendColumn (column);
@@ -509,7 +162,7 @@ namespace TestSpace {
cellRendererCombo.HasEntry = false;
cellRendererCombo.Editable = !profile.IsBuiltIn;
- cellRendererCombo.Edited += new ComboboxEditedHandler (this, indentOptions).ComboboxEdited;
+ cellRendererCombo.Edited += new ComboboxEditedHandler (this, indentationOptions).ComboboxEdited;
column.PackStart (cellRendererCombo, false);
column.SetAttributes (cellRendererCombo, "visible", comboVisibleColumn);
@@ -518,58 +171,23 @@ namespace TestSpace {
var cellRendererToggle = new CellRendererToggle ();
cellRendererToggle.Ypad = 1;
cellRendererToggle.Activatable = !profile.IsBuiltIn;
- cellRendererToggle.Toggled += new CellRendererToggledHandler (this, treeviewIndentOptions, indentOptions).Toggled;
+ cellRendererToggle.Toggled += new CellRendererToggledHandler (this, treeviewIndentOptions, indentationOptions).Toggled;
column.PackStart (cellRendererToggle, false);
column.SetAttributes (cellRendererToggle, "visible", toggleVisibleColumn);
column.SetCellDataFunc (cellRendererToggle, ToggleDataFunc);
-
treeviewIndentOptions.AppendColumn (column);
- var category = AddOption (indentOptions, null, GettextCatalog.GetString ("Declarations"), null);
- AddOption (indentOptions, category, "IndentNamespaceBody", GettextCatalog.GetString ("within namespaces"), "namespace Test { class AClass {} }");
-
- AddOption (indentOptions, category, "IndentClassBody", GettextCatalog.GetString ("within classes"), "class AClass { int aField; void AMethod () {}}");
- AddOption (indentOptions, category, "IndentInterfaceBody", GettextCatalog.GetString ("within interfaces"), "interface IAInterfaces { int AProperty {get;set;} void AMethod ();}");
- AddOption (indentOptions, category, "IndentStructBody", GettextCatalog.GetString ("within structs"), "struct AStruct { int aField; void AMethod () {}}");
- AddOption (indentOptions, category, "IndentEnumBody", GettextCatalog.GetString ("within enums"), "enum AEnum { A, B, C }");
-
- AddOption (indentOptions, category, "IndentMethodBody", GettextCatalog.GetString ("within methods"), methodSpaceExample);
- AddOption (indentOptions, category, "IndentPropertyBody", GettextCatalog.GetString ("within properties"), propertyExample);
- AddOption (indentOptions, category, "IndentEventBody", GettextCatalog.GetString ("within events"), eventExample);
-
- category = AddOption (indentOptions, null, GettextCatalog.GetString ("Statements"), null);
- AddOption (indentOptions, category, "IndentBlocks", GettextCatalog.GetString ("within blocks"), spaceExample);
- AddOption (indentOptions, category, "IndentSwitchBody", GettextCatalog.GetString ("Indent 'switch' body"), spaceExample);
- AddOption (indentOptions, category, "IndentCaseBody", GettextCatalog.GetString ("Indent 'case' body"), spaceExample);
- AddOption (indentOptions, category, "IndentBreakStatements", GettextCatalog.GetString ("Indent 'break' statements"), spaceExample);
- AddOption (indentOptions, category, "IndentPreprocessorDirectives", GettextCatalog.GetString ("Indent pre processor directives"),
- @"#define DEBUG
-class Test {
- #if DEBUG
- void Example ()
- {
- }
- #endif
-}
-");
- AddOption (indentOptions, category, "IndentBlocksInsideExpressions", GettextCatalog.GetString ("Indent blocks inside expressions"),
- @"
-class Test
-{
- void Example ()
- {
- Test(delegate {
- Call ();
- });
- }
-}
-");
- AddOption (indentOptions, category, "AlignEmbeddedStatements", GettextCatalog.GetString ("Align embedded statements"), "class AClass { void AMethod () { if (a) if (b) { int c; } } } ");
+
+ AddOption (indentationOptions, "IndentBlock", GettextCatalog.GetString ("Indent block contents"), "namespace Test { class AClass { void Method () { int x; int y; } } }");
+ AddOption (indentationOptions, "IndentBraces", GettextCatalog.GetString ("Indent open and close braces"), "class AClass { int aField; void AMethod () {}}");
+ AddOption (indentationOptions, "IndentSwitchSection", GettextCatalog.GetString ("Indent case contents"), "class AClass { void Method (int x) { switch (x) { case 1: break; } } }");
+ AddOption (indentationOptions, "IndentSwitchCaseSection", GettextCatalog.GetString ("Indent case labels"), "class AClass { void Method (int x) { switch (x) { case 1: break; } } }");
+ AddOption (indentationOptions, "LabelPositioning", GettextCatalog.GetString ("Label indentation"), "enum AEnum { A, B, C }");
treeviewIndentOptions.ExpandAll ();
#endregion
- #region Brace options
- bacePositionOptions = new TreeStore (typeof(string), typeof(string), typeof(string), typeof(bool), typeof(bool));
+ #region New line options
+ newLineOptions = new TreeStore (typeof(string), typeof(string), typeof(string), typeof(bool), typeof(bool));
column = new TreeViewColumn ();
// pixbuf column
@@ -582,10 +200,10 @@ class Test
column.PackStart (cellRendererText, true);
column.SetAttributes (cellRendererText, "text", 1);
- treeviewBracePositions.Model = bacePositionOptions;
- treeviewBracePositions.HeadersVisible = false;
- treeviewBracePositions.Selection.Changed += TreeSelectionChanged;
- treeviewBracePositions.AppendColumn (column);
+ treeviewNewLines.Model = newLineOptions;
+ treeviewNewLines.HeadersVisible = false;
+ treeviewNewLines.Selection.Changed += TreeSelectionChanged;
+ treeviewNewLines.AppendColumn (column);
column = new TreeViewColumn ();
cellRendererCombo = new CellRendererCombo ();
@@ -595,7 +213,7 @@ class Test
cellRendererCombo.Model = ComboBoxStore;
cellRendererCombo.HasEntry = false;
cellRendererCombo.Editable = !profile.IsBuiltIn;
- cellRendererCombo.Edited += new ComboboxEditedHandler (this, bacePositionOptions).ComboboxEdited;
+ cellRendererCombo.Edited += new ComboboxEditedHandler (this, newLineOptions).ComboboxEdited;
column.PackStart (cellRendererCombo, false);
column.SetAttributes (cellRendererCombo, "visible", comboVisibleColumn);
@@ -604,49 +222,103 @@ class Test
cellRendererToggle = new CellRendererToggle ();
cellRendererToggle.Activatable = !profile.IsBuiltIn;
cellRendererToggle.Ypad = 1;
- cellRendererToggle.Toggled += new CellRendererToggledHandler (this, treeviewBracePositions, bacePositionOptions).Toggled;
+ cellRendererToggle.Toggled += new CellRendererToggledHandler (this, treeviewNewLines, newLineOptions).Toggled;
column.PackStart (cellRendererToggle, false);
column.SetAttributes (cellRendererToggle, "visible", toggleVisibleColumn);
column.SetCellDataFunc (cellRendererToggle, ToggleDataFunc);
- treeviewBracePositions.AppendColumn (column);
-
- AddOption (bacePositionOptions, "NamespaceBraceStyle", GettextCatalog.GetString ("Namespace declaration"), "namespace TestNameSpace {}");
-
- AddOption (bacePositionOptions, "ClassBraceStyle", GettextCatalog.GetString ("Class declaration"), "class ClassDeclaration {}");
- AddOption (bacePositionOptions, "InterfaceBraceStyle", GettextCatalog.GetString ("Interface declaration"), "interface InterfaceDeclaraction {}");
- AddOption (bacePositionOptions, "StructBraceStyle", GettextCatalog.GetString ("Struct declaration"), "struct StructDeclaration {}");
- AddOption (bacePositionOptions, "EnumBraceStyle", GettextCatalog.GetString ("Enum declaration"), "enum EnumDeclaration { A, B, C}");
-
- AddOption (bacePositionOptions, "MethodBraceStyle", GettextCatalog.GetString ("Method declaration"), "class ClassDeclaration { void MyMethod () {} }");
- AddOption (bacePositionOptions, "AnonymousMethodBraceStyle", GettextCatalog.GetString ("Anonymous methods"), "class ClassDeclaration { void MyMethod () { MyEvent += delegate (object sender, EventArgs e) { if (true) Console.WriteLine (\"Hello World\"); }; } }");
- AddOption (bacePositionOptions, "ConstructorBraceStyle", GettextCatalog.GetString ("Constructor declaration"), "class ClassDeclaration { public ClassDeclaration () {} }");
- AddOption (bacePositionOptions, "DestructorBraceStyle", GettextCatalog.GetString ("Destructor declaration"), "class ClassDeclaration { ~ClassDeclaration () {} }");
-
- AddOption (bacePositionOptions, "StatementBraceStyle", GettextCatalog.GetString ("Statements"), spaceExample);
-
- category = AddOption (bacePositionOptions, "PropertyBraceStyle", GettextCatalog.GetString ("Property declaration"), propertyExample);
- AddOption (bacePositionOptions, category, "AutoPropertyFormatting", GettextCatalog.GetString ("Allow automatic property in one line"), propertyExample);
- AddOption (bacePositionOptions, category, "SimplePropertyFormatting", GettextCatalog.GetString ("Allow simple property in one line"), propertyExample);
+ treeviewNewLines.AppendColumn (column);
+ var category = AddOption (newLineOptions, null, GettextCatalog.GetString ("New line options for braces"), null);
+ AddOption (newLineOptions, category, "NewLinesForBracesInTypes", GettextCatalog.GetString ("Place open brace on new line for types"), @"class Example
+{
+}");
+ AddOption (newLineOptions, category, "NewLinesForBracesInMethods", GettextCatalog.GetString ("Place open brace on new line for methods"), @"void Example()
+{
+}");
+ AddOption (newLineOptions, category, "NewLinesForBracesInAnonymousMethods", GettextCatalog.GetString ("Place open brace on new line for anonymous methods"), @"void Example()
+{
+ var del = new delegate (int i, int j) {
+ };
+}");
+ AddOption (newLineOptions, category, "NewLinesForBracesInControlBlocks", GettextCatalog.GetString ("Place open brace on new line for control blocks"), @"void Example()
+{
+ if (true)
+ {
+ }
+}");
+ AddOption (newLineOptions, category, "NewLinesForBracesInAnonymousTypes", GettextCatalog.GetString ("Place open brace on new line for anonymous types"), @"void Example()
+{
+ var c = new
+ {
+ A = 1,
+ B = 2
+ };
+}");
+ AddOption (newLineOptions, category, "NewLinesForBracesInObjectInitializers", GettextCatalog.GetString ("Place open brace on new line for object initializers"), @"void Example()
+{
+ new MyObject
+ {
+ A = 1,
+ B = 2
+ };
+}");
+ AddOption (newLineOptions, category, "NewLinesForBracesInLambdaExpressionBody", GettextCatalog.GetString ("Place open brace on new line for lambda expression"), @"void Example()
+{
+ Action act = () =>
+ {
+ };
+}");
- AddOption (bacePositionOptions, category, "PropertyGetBraceStyle", GettextCatalog.GetString ("Get declaration"), propertyExample);
- AddOption (bacePositionOptions, category, "SimpleGetBlockFormatting", GettextCatalog.GetString ("Allow one line get"), propertyExample);
- AddOption (bacePositionOptions, category, "PropertySetBraceStyle", GettextCatalog.GetString ("Set declaration"), propertyExample);
- AddOption (bacePositionOptions, category, "SimpleSetBlockFormatting", GettextCatalog.GetString ("Allow one line set"), propertyExample);
-
-
- category = AddOption (bacePositionOptions, "EventBraceStyle", GettextCatalog.GetString ("Event declaration"), eventExample);
- AddOption (bacePositionOptions, category, "EventAddBraceStyle", GettextCatalog.GetString ("Add declaration"), eventExample);
- AddOption (bacePositionOptions, category, "AllowEventAddBlockInline", GettextCatalog.GetString ("Allow one line add"), eventExample);
- AddOption (bacePositionOptions, category, "EventRemoveBraceStyle", GettextCatalog.GetString ("Remove declaration"), eventExample);
- AddOption (bacePositionOptions, category, "AllowEventRemoveBlockInline", GettextCatalog.GetString ("Allow one line remove"), eventExample);
-
- treeviewBracePositions.ExpandAll ();
+ category = AddOption (newLineOptions, null, GettextCatalog.GetString ("New line options for keywords"), null);
+ AddOption (newLineOptions, category, "NewLineForElse", GettextCatalog.GetString ("Place \"else\" on new line"), @"void Example()
+{
+ if (true) {
+ // ...
+ } else {
+ // ...
+ }
+}");
+ AddOption (newLineOptions, category, "NewLineForCatch", GettextCatalog.GetString ("Place \"catch\" on new line"), @"void Example()
+{
+ try {
+ } catch {
+ } finally {
+ }
+}");
+ AddOption (newLineOptions, category, "NewLineForFinally", GettextCatalog.GetString ("Place \"finally\" on new line"), @"void Example()
+{
+ try {
+ } catch {
+ } finally {
+ }
+}");
+
+ category = AddOption (newLineOptions, null, GettextCatalog.GetString ("New line options for expressions"), null);
+ AddOption (newLineOptions, category, "NewLineForMembersInObjectInit", GettextCatalog.GetString ("Place members in object initializers on new line"), @"void Example()
+{
+ new MyObject {
+ A = 1,
+ B = 2
+ };
+}");
+ AddOption (newLineOptions, category, "NewLineForMembersInAnonymousTypes", GettextCatalog.GetString ("Place members in anonymous types on new line"), @"void Example()
+{
+ var c = new
+ {
+ A = 1,
+ B = 2
+ };
+}");
+ AddOption (newLineOptions, category, "NewLineForClausesInQuery", GettextCatalog.GetString ("Place query expression clauses on new line"), @"void Example()
+{
+ from o in col select o.Foo;
+}");
+ treeviewNewLines.ExpandAll ();
#endregion
- #region New line options
- newLineOptions = new TreeStore (typeof(string), typeof(string), typeof(string), typeof(bool), typeof(bool));
+ #region Spacing options
+ spacingOptions = new TreeStore (typeof(string), typeof(string), typeof(string), typeof(bool), typeof(bool));
column = new TreeViewColumn ();
// pixbuf column
@@ -658,10 +330,10 @@ class Test
column.PackStart (cellRendererText, true);
column.SetAttributes (cellRendererText, "text", 1);
- treeviewNewLines.Model = newLineOptions;
- treeviewNewLines.HeadersVisible = false;
- treeviewNewLines.Selection.Changed += TreeSelectionChanged;
- treeviewNewLines.AppendColumn (column);
+ treeviewSpacing.Model = spacingOptions;
+ treeviewSpacing.HeadersVisible = false;
+ treeviewSpacing.Selection.Changed += TreeSelectionChanged;
+ treeviewSpacing.AppendColumn (column);
column = new TreeViewColumn ();
cellRendererCombo = new CellRendererCombo ();
@@ -671,7 +343,7 @@ class Test
cellRendererCombo.Model = ComboBoxStore;
cellRendererCombo.HasEntry = false;
cellRendererCombo.Editable = !profile.IsBuiltIn;
- cellRendererCombo.Edited += new ComboboxEditedHandler (this, newLineOptions).ComboboxEdited;
+ cellRendererCombo.Edited += new ComboboxEditedHandler (this, spacingOptions).ComboboxEdited;
column.PackStart (cellRendererCombo, false);
column.SetAttributes (cellRendererCombo, "visible", comboVisibleColumn);
@@ -680,63 +352,137 @@ class Test
cellRendererToggle = new CellRendererToggle ();
cellRendererToggle.Activatable = !profile.IsBuiltIn;
cellRendererToggle.Ypad = 1;
- cellRendererToggle.Toggled += new CellRendererToggledHandler (this, treeviewNewLines, newLineOptions).Toggled;
+ cellRendererToggle.Toggled += new CellRendererToggledHandler (this, treeviewSpacing, spacingOptions).Toggled;
column.PackStart (cellRendererToggle, false);
column.SetAttributes (cellRendererToggle, "visible", toggleVisibleColumn);
column.SetCellDataFunc (cellRendererToggle, ToggleDataFunc);
- treeviewNewLines.AppendColumn (column);
+ treeviewSpacing.AppendColumn (column);
- AddOption (newLineOptions, "ElseNewLinePlacement", GettextCatalog.GetString ("Place 'else' on new line"), simpleIf);
- AddOption (newLineOptions, "ElseIfNewLinePlacement", GettextCatalog.GetString ("Place 'else if' on new line"), simpleIf);
- AddOption (newLineOptions, "CatchNewLinePlacement", GettextCatalog.GetString ("Place 'catch' on new line"), simpleCatch);
- AddOption (newLineOptions, "FinallyNewLinePlacement", GettextCatalog.GetString ("Place 'finally' on new line"), simpleCatch);
- AddOption (newLineOptions, "WhileNewLinePlacement", GettextCatalog.GetString ("Place 'while' on new line"), simpleDoWhile);
- AddOption (newLineOptions, "ArrayInitializerWrapping", GettextCatalog.GetString ("Place array initializers on new line"), simpleArrayInitializer);
- AddOption (newLineOptions, "EmbeddedStatementPlacement", GettextCatalog.GetString ("Place embedded statements on new line"), @"class Test
+ category = AddOption (spacingOptions, null, GettextCatalog.GetString ("Set spacing for method declarations"), null);
+ AddOption (spacingOptions, category, "SpacingAfterMethodDeclarationName", GettextCatalog.GetString ("Insert space between method name and its opening parenthesis"),
+ @"void Example()
{
- public void Example ()
- {
- if (true)
- Call ();
-
- foreach (var o in col) DoSomething (o);
- }
}");
- string constructorInitializer=@"class Test
+
+ AddOption (spacingOptions, category, "SpaceWithinMethodDeclarationParenthesis", GettextCatalog.GetString ("Insert space withing argument list parentheses"),
+ @"void Example(int i, int j)
{
+}");
+ AddOption (spacingOptions, category, "SpaceBetweenEmptyMethodDeclarationParentheses", GettextCatalog.GetString ("Insert space within empty argument list parentheses"), @"void Example()
+{
+}");
- public Test () : base ()
- {
+ category = AddOption (spacingOptions, null, GettextCatalog.GetString ("Set spacing for method calls"), null);
+ AddOption (spacingOptions, category, "SpaceAfterMethodCallName", GettextCatalog.GetString ("Insert space between method name and its opening parenthesis"), @"void Example()
+{
+ Test();
+}");
+ AddOption (spacingOptions, category, "SpaceWithinMethodCallParentheses", GettextCatalog.GetString ("Insert space withing argument list parentheses"), @"void Example()
+{
+ Test(1, 2);
+}");
+ AddOption (spacingOptions, category, "SpaceBetweenEmptyMethodCallParentheses", GettextCatalog.GetString ("Insert space within empty argument list parentheses"), @"void Example()
+{
+ Test();
+}");
+ category = AddOption (spacingOptions, null, GettextCatalog.GetString ("Set other spacing options"), null);
+ AddOption (spacingOptions, category, "SpaceAfterControlFlowStatementKeyword", GettextCatalog.GetString ("Insert space after keywords in control flow statements"), @"void Example()
+{
+ if (condition)
+ {
}
+}");
- public Test ()
- : base ()
+ AddOption (spacingOptions, category, "SpaceWithinExpressionParentheses", GettextCatalog.GetString ("Insert space within parentheses of expressions"), @"void Example()
+{
+ i = (5 + 3) * 2;
+}");
+ AddOption (spacingOptions, category, "SpaceWithinCastParentheses", GettextCatalog.GetString ("Insert space within parentheses of type casts"), @"void Example()
+{
+ test = (ITest)o;
+}");
+ AddOption (spacingOptions, category, "SpaceWithinOtherParentheses", GettextCatalog.GetString ("Insert space within parentheses of control flow statements"), @"void Example()
+{
+ if (condition)
{
-
}
+}");
- public Test () :
- base ()
- {
+ AddOption (spacingOptions, category, "SpaceAfterCast", GettextCatalog.GetString ("Insert space after casts"), @"void Example()
+{
+ test = (ITest)o;
+}");
+ AddOption (spacingOptions, category, "SpacesIgnoreAroundVariableDeclaration", GettextCatalog.GetString ("Ignore spaces in declaration statements"), @"void Example()
+{
+ int x=5;
+}");
- }
+ category = AddOption (spacingOptions, null, GettextCatalog.GetString ("Set spacing for brackets"), null);
+ AddOption (spacingOptions, category, "SpaceBeforeOpenSquareBracket", GettextCatalog.GetString ("Insert space before open square bracket"), @"void Example()
+{
+ i[5] = 3;
+}");
+ AddOption (spacingOptions, category, "SpaceBetweenEmptySquareBrackets", GettextCatalog.GetString ("Insert space within empty square brackets"), @"void Example()
+{
+ new int[] {1, 2};
+}");
+ AddOption (spacingOptions, category, "SpaceWithinSquareBrackets", GettextCatalog.GetString ("Insert space within square brackets"), @"void Example()
+{
+ i[5] = 3;
+}");
- public Test ()
- :
- base ()
+ category = AddOption (spacingOptions, null, GettextCatalog.GetString ("Set spacing for brackets"), null);
+ AddOption (spacingOptions, category, "SpaceAfterColonInBaseTypeDeclaration", GettextCatalog.GetString ("Insert space after colon for base or interface in type declaration"), @"class Foo : Bar
+{
+}");
+ AddOption (spacingOptions, category, "SpaceAfterComma", GettextCatalog.GetString ("Insert space after comma"), @"void Example()
+{
+ for (int i =0; i < 10, i >5;i++)
{
-
}
-}";
- AddOption (newLineOptions, "NewLineBeforeConstructorInitializerColon", GettextCatalog.GetString("Place constructor initializer ':' on new line"), constructorInitializer);
- AddOption (newLineOptions, "NewLineAfterConstructorInitializerColon", GettextCatalog.GetString("Place constructor initializer 'base/this' on new line"), constructorInitializer);
- treeviewNewLines.ExpandAll ();
+}");
+ AddOption (spacingOptions, category, "SpaceAfterDot", GettextCatalog.GetString ("Insert space after dot"), @"void Example()
+{
+ Foo.Bar.Test();
+}");
+ AddOption (spacingOptions, category, "SpaceAfterSemicolonsInForStatement", GettextCatalog.GetString ("Insert space after semicolon in \"for\" statement"), @"void Example()
+{
+ for (int i = 0; i< 10; i++)
+ {
+ }
+}");
+ AddOption (spacingOptions, category, "SpaceBeforeColonInBaseTypeDeclaration", GettextCatalog.GetString ("Insert space before colon for base or interface in type declaration"), @"class Foo : Bar
+{
+}");
+ AddOption (spacingOptions, category, "SpaceBeforeComma", GettextCatalog.GetString ("Insert space before comma"), @"void Example()
+{
+ for (int i =0; i < 10, i >5;i++)
+ {
+ }
+}");
+ AddOption (spacingOptions, category, "SpaceBeforeDot", GettextCatalog.GetString ("Insert space before dot"), @"void Example()
+{
+ Foo.Bar.Test();
+}");
+ AddOption (spacingOptions, category, "SpaceBeforeSemicolonsInForStatement", GettextCatalog.GetString ("Insert space before semicolon in \"for\" statement"), @"void Example()
+{
+ for (int i = 0; i< 10; i++)
+ {
+ }
+}");
+
+ AddOption (spacingOptions, category, "SpacingAroundBinaryOperator", GettextCatalog.GetString ("Set spacing for operators"), @"void Example()
+{
+ i = (5 + 3) * 2;
+}");
+
+ treeviewSpacing.ExpandAll ();
#endregion
-
- #region Wrapping options
- wrappingOptions = new TreeStore (typeof(string), typeof(string), typeof(string), typeof(bool), typeof(bool));
+
+ #region Style options
+ styleOptions = new TreeStore (typeof(string), typeof(string), typeof(string), typeof(bool), typeof(bool));
column = new TreeViewColumn ();
// pixbuf column
@@ -749,10 +495,10 @@ class Test
column.SetAttributes (cellRendererText, "text", 1);
- treeviewWrappingCategory.Model = wrappingOptions;
- treeviewWrappingCategory.HeadersVisible = false;
- treeviewWrappingCategory.Selection.Changed += TreeSelectionChanged;
- treeviewWrappingCategory.AppendColumn (column);
+ treeviewStyle.Model = styleOptions;
+ treeviewStyle.HeadersVisible = false;
+ treeviewStyle.Selection.Changed += TreeSelectionChanged;
+ treeviewStyle.AppendColumn (column);
column = new TreeViewColumn ();
cellRendererCombo = new CellRendererCombo ();
@@ -762,7 +508,7 @@ class Test
cellRendererCombo.Model = ComboBoxStore;
cellRendererCombo.HasEntry = false;
cellRendererCombo.Editable = !profile.IsBuiltIn;
- cellRendererCombo.Edited += new ComboboxEditedHandler (this, wrappingOptions).ComboboxEdited;
+ cellRendererCombo.Edited += new ComboboxEditedHandler (this, styleOptions).ComboboxEdited;
column.PackStart (cellRendererCombo, false);
column.SetAttributes (cellRendererCombo, "visible", comboVisibleColumn);
@@ -771,59 +517,37 @@ class Test
cellRendererToggle = new CellRendererToggle ();
cellRendererToggle.Activatable = !profile.IsBuiltIn;
cellRendererToggle.Ypad = 1;
- cellRendererToggle.Toggled += new CellRendererToggledHandler (this, treeviewNewLines, wrappingOptions).Toggled;
+ cellRendererToggle.Toggled += new CellRendererToggledHandler (this, treeviewSpacing, styleOptions).Toggled;
column.PackStart (cellRendererToggle, false);
column.SetAttributes (cellRendererToggle, "visible", toggleVisibleColumn);
column.SetCellDataFunc (cellRendererToggle, ToggleDataFunc);
- treeviewWrappingCategory.AppendColumn (column);
-
- category = AddOption (wrappingOptions, null, GettextCatalog.GetString ("Method declarations"), null);
- AddOption (wrappingOptions, category, "MethodDeclarationParameterWrapping", GettextCatalog.GetString ("Parameters"), longMethodDeclaration);
- AddOption (wrappingOptions, category, "NewLineAferMethodDeclarationOpenParentheses", GettextCatalog.GetString ("New line after open parentheses"), longMethodDeclaration);
- AddOption (wrappingOptions, category, "MethodDeclarationClosingParenthesesOnNewLine", GettextCatalog.GetString ("New line before closing parentheses"), longMethodDeclaration);
- AddOption (wrappingOptions, category, "AlignToFirstMethodDeclarationParameter", GettextCatalog.GetString ("Align to first parameter"), longMethodDeclaration);
-
- category = AddOption (wrappingOptions, null, GettextCatalog.GetString ("Method calls"), null);
- AddOption (wrappingOptions, category, "MethodCallArgumentWrapping", GettextCatalog.GetString ("Arguments"), longMethodCall);
- AddOption (wrappingOptions, category, "NewLineAferMethodCallOpenParentheses", GettextCatalog.GetString ("New line after open parentheses"), longMethodCall);
- AddOption (wrappingOptions, category, "MethodCallClosingParenthesesOnNewLine", GettextCatalog.GetString ("New line before closing parentheses"), longMethodCall);
- AddOption (wrappingOptions, category, "AlignToFirstMethodCallArgument", GettextCatalog.GetString ("Align to first argument"), longMethodCall);
-
- category = AddOption (wrappingOptions, null, GettextCatalog.GetString ("Indexer declarations"), null);
- AddOption (wrappingOptions, category, "IndexerDeclarationParameterWrapping", GettextCatalog.GetString ("Parameters"), longIndexerDeclaration);
- AddOption (wrappingOptions, category, "NewLineAferIndexerDeclarationOpenBracket", GettextCatalog.GetString ("New line after open parentheses"), longIndexerDeclaration);
- AddOption (wrappingOptions, category, "IndexerDeclarationClosingBracketOnNewLine", GettextCatalog.GetString ("New line before closing parentheses"), longIndexerDeclaration);
- AddOption (wrappingOptions, category, "AlignToFirstIndexerDeclarationParameter", GettextCatalog.GetString ("Align to first parameter"), longIndexerDeclaration);
+ treeviewStyle.AppendColumn (column);
- category = AddOption (wrappingOptions, null, GettextCatalog.GetString ("Indexer usage"), null);
- AddOption (wrappingOptions, category, "IndexerArgumentWrapping", GettextCatalog.GetString ("Arguments"), longIndexer);
- AddOption (wrappingOptions, category, "NewLineAferIndexerOpenBracket", GettextCatalog.GetString ("New line after open bracket"), longIndexer);
- AddOption (wrappingOptions, category, "IndexerClosingBracketOnNewLine", GettextCatalog.GetString ("New line before closing bracket"), longIndexer);
- AddOption (wrappingOptions, category, "AlignToFirstIndexerArgument", GettextCatalog.GetString ("Align to first parameter"), longIndexer);
+ AddOption (styleOptions, category, null, GettextCatalog.GetString ("Qualify member access with 'this'"), null);
+ AddOption (styleOptions, category, null, GettextCatalog.GetString ("Use 'var' when generating locals"), null);
- treeviewWrappingCategory.ExpandAll ();
+ treeviewStyle.ExpandAll ();
#endregion
- #region White space options
- whiteSpaceOptions = new TreeStore (typeof (string), typeof (string), typeof (string), typeof(bool), typeof(bool));
-
-
+ #region Wrapping options
+ wrappingOptions = new TreeStore (typeof(string), typeof(string), typeof(string), typeof(bool), typeof(bool));
+
column = new TreeViewColumn ();
// pixbuf column
column.PackStart (pixbufCellRenderer, false);
column.SetCellDataFunc (pixbufCellRenderer, RenderIcon);
-
+
// text column
cellRendererText.Ypad = 1;
column.PackStart (cellRendererText, true);
column.SetAttributes (cellRendererText, "text", 1);
-
- treeviewInsertWhiteSpaceCategory.Model = whiteSpaceOptions;
- treeviewInsertWhiteSpaceCategory.HeadersVisible = false;
- treeviewInsertWhiteSpaceCategory.Selection.Changed += TreeSelectionChanged;
- treeviewInsertWhiteSpaceCategory.AppendColumn (column);
-
+
+ treeviewWrapping.Model = wrappingOptions;
+ treeviewWrapping.HeadersVisible = false;
+ treeviewWrapping.Selection.Changed += TreeSelectionChanged;
+ treeviewWrapping.AppendColumn (column);
+
column = new TreeViewColumn ();
cellRendererCombo = new CellRendererCombo ();
cellRendererCombo.Ypad = 1;
@@ -832,334 +556,26 @@ class Test
cellRendererCombo.Model = ComboBoxStore;
cellRendererCombo.HasEntry = false;
cellRendererCombo.Editable = !profile.IsBuiltIn;
- cellRendererCombo.Edited += new ComboboxEditedHandler (this, whiteSpaceOptions).ComboboxEdited;
+ cellRendererCombo.Edited += new ComboboxEditedHandler (this, wrappingOptions).ComboboxEdited;
column.PackStart (cellRendererCombo, false);
column.SetAttributes (cellRendererCombo, "visible", comboVisibleColumn);
column.SetCellDataFunc (cellRendererCombo, ComboboxDataFunc);
-
+
cellRendererToggle = new CellRendererToggle ();
cellRendererToggle.Activatable = !profile.IsBuiltIn;
cellRendererToggle.Ypad = 1;
- cellRendererToggle.Toggled += new CellRendererToggledHandler (this, treeviewInsertWhiteSpaceCategory, whiteSpaceOptions).Toggled;
+ cellRendererToggle.Toggled += new CellRendererToggledHandler (this, treeviewSpacing, wrappingOptions).Toggled;
column.PackStart (cellRendererToggle, false);
column.SetAttributes (cellRendererToggle, "visible", toggleVisibleColumn);
column.SetCellDataFunc (cellRendererToggle, ToggleDataFunc);
-
- treeviewInsertWhiteSpaceCategory.AppendColumn (column);
-
- string example = @"class Example {
- void Test ()
- {
- }
-
- void Test (int a, int b, int c)
- {
- }
-}";
- category = AddOption (whiteSpaceOptions, null, GettextCatalog.GetString ("Declarations"), example);
- AddOption (whiteSpaceOptions, category, "BeforeMethodDeclarationParentheses", GettextCatalog.GetString ("before opening parenthesis"), example);
- AddOption (whiteSpaceOptions, category, "WithinMethodDeclarationParentheses", GettextCatalog.GetString ("within parenthesis"), example);
- AddOption (whiteSpaceOptions, category, "BetweenEmptyMethodDeclarationParentheses", GettextCatalog.GetString ("between empty parenthesis"), example);
- AddOption (whiteSpaceOptions, category, "BeforeMethodDeclarationParameterComma", GettextCatalog.GetString ("before comma in parenthesis"), example);
- AddOption (whiteSpaceOptions, category, "AfterMethodDeclarationParameterComma", GettextCatalog.GetString ("after comma in parenthesis"), example);
-
- example = @"class Example {
- int a, b, c;
-}";
- category = AddOption (whiteSpaceOptions, null, GettextCatalog.GetString ("Fields"), example);
- AddOption (whiteSpaceOptions, category, "BeforeFieldDeclarationComma", GettextCatalog.GetString ("before comma in multiple field declarations"), example);
- AddOption (whiteSpaceOptions, category, "AfterFieldDeclarationComma", GettextCatalog.GetString ("after comma in multiple field declarations"), example);
-
- example = @"class Example {
- Example ()
- {
- }
-
- Example (int a, int b, int c)
- {
- }
-}";
- category = AddOption (whiteSpaceOptions, null, GettextCatalog.GetString ("Constructors"), example);
- AddOption (whiteSpaceOptions, category, "BeforeConstructorDeclarationParentheses", GettextCatalog.GetString ("before opening parenthesis"), example);
- AddOption (whiteSpaceOptions, category, "WithinConstructorDeclarationParentheses", GettextCatalog.GetString ("within parenthesis"), example);
- AddOption (whiteSpaceOptions, category, "BetweenEmptyConstructorDeclarationParentheses", GettextCatalog.GetString ("between empty parenthesis"), example);
- AddOption (whiteSpaceOptions, category, "BeforeConstructorDeclarationParameterComma", GettextCatalog.GetString ("before comma in parenthesis"), example);
- AddOption (whiteSpaceOptions, category, "AfterConstructorDeclarationParameterComma", GettextCatalog.GetString ("after comma in parenthesis"), example);
-
- example = @"class Example {
- public int this[int a, int b] {
- get {
- return a + b;
- }
- }
-}";
- category = AddOption (whiteSpaceOptions, null, GettextCatalog.GetString ("Indexer"), example);
- AddOption (whiteSpaceOptions, category, "BeforeIndexerDeclarationBracket", GettextCatalog.GetString ("before opening bracket"), example);
- AddOption (whiteSpaceOptions, category, "WithinIndexerDeclarationBracket", GettextCatalog.GetString ("within brackets"), example);
- AddOption (whiteSpaceOptions, category, "BeforeIndexerDeclarationParameterComma", GettextCatalog.GetString ("before comma in brackets"), example);
- AddOption (whiteSpaceOptions, category, "AfterIndexerDeclarationParameterComma", GettextCatalog.GetString ("after comma in brackets"), example);
-
- example = @"delegate void FooBar (int a, int b, int c);
-delegate void BarFoo ();
-";
-
- category = AddOption (whiteSpaceOptions, null, GettextCatalog.GetString ("Delegates"), example);
- AddOption (whiteSpaceOptions, category, "BeforeDelegateDeclarationParentheses", GettextCatalog.GetString ("before opening parenthesis"), example);
- AddOption (whiteSpaceOptions, category, "WithinDelegateDeclarationParentheses", GettextCatalog.GetString ("within parenthesis"), example);
- AddOption (whiteSpaceOptions, category, "BetweenEmptyDelegateDeclarationParentheses", GettextCatalog.GetString ("between empty parenthesis"), example);
- AddOption (whiteSpaceOptions, category, "BeforeDelegateDeclarationParameterComma", GettextCatalog.GetString ("before comma in parenthesis"), example);
- AddOption (whiteSpaceOptions, category, "AfterDelegateDeclarationParameterComma", GettextCatalog.GetString ("after comma in parenthesis"), example);
-
- var upperCategory = AddOption (whiteSpaceOptions, null, GettextCatalog.GetString ("Statements"), null);
-
- category = AddOption (whiteSpaceOptions, upperCategory, null, GettextCatalog.GetString ("'if'"), simpleIf);
- AddOption (whiteSpaceOptions, category, "IfParentheses", GettextCatalog.GetString ("before opening parenthesis"), simpleIf);
- AddOption (whiteSpaceOptions, category, "WithinIfParentheses", GettextCatalog.GetString ("within parenthesis"), simpleIf);
-
- category = AddOption (whiteSpaceOptions, upperCategory, null, GettextCatalog.GetString ("'while'"), simpleWhile);
- AddOption (whiteSpaceOptions, category, "WhileParentheses", GettextCatalog.GetString ("before opening parenthesis"), simpleWhile);
- AddOption (whiteSpaceOptions, category, "WithinWhileParentheses", GettextCatalog.GetString ("within parenthesis"), simpleWhile);
-
- category = AddOption (whiteSpaceOptions, upperCategory, null, GettextCatalog.GetString ("'for'"), simpleFor);
- AddOption (whiteSpaceOptions, category, "ForParentheses", GettextCatalog.GetString ("before opening parenthesis"), simpleFor);
- AddOption (whiteSpaceOptions, category, "WithinForParentheses", GettextCatalog.GetString ("within parenthesis"), simpleFor);
- AddOption (whiteSpaceOptions, category, "SpacesBeforeForSemicolon", GettextCatalog.GetString ("before semicolon"), simpleFor);
- AddOption (whiteSpaceOptions, category, "SpacesAfterForSemicolon", GettextCatalog.GetString ("after semicolon"), simpleFor);
-
- category = AddOption (whiteSpaceOptions, upperCategory, null, GettextCatalog.GetString ("'foreach'"), simpleForeach);
- AddOption (whiteSpaceOptions, category, "ForeachParentheses", GettextCatalog.GetString ("before opening parenthesis"), simpleForeach);
- AddOption (whiteSpaceOptions, category, "WithinForEachParentheses", GettextCatalog.GetString ("within parenthesis"), simpleForeach);
-
- category = AddOption (whiteSpaceOptions, upperCategory, null, GettextCatalog.GetString ("'catch'"), simpleCatch);
- AddOption (whiteSpaceOptions, category, "CatchParentheses", GettextCatalog.GetString ("before opening parenthesis"), simpleCatch);
- AddOption (whiteSpaceOptions, category, "WithinCatchParentheses", GettextCatalog.GetString ("within parenthesis"), simpleCatch);
-
- category = AddOption (whiteSpaceOptions, upperCategory, null, GettextCatalog.GetString ("'switch'"), switchExample);
- AddOption (whiteSpaceOptions, category, "SwitchParentheses", GettextCatalog.GetString ("before opening parenthesis"), switchExample);
- AddOption (whiteSpaceOptions, category, "WithinSwitchParentheses", GettextCatalog.GetString ("within parenthesis"), switchExample);
-
- category = AddOption (whiteSpaceOptions, upperCategory, null, GettextCatalog.GetString ("'lock'"), simpleLock);
- AddOption (whiteSpaceOptions, category, "LockParentheses", GettextCatalog.GetString ("before opening parenthesis"), simpleLock);
- AddOption (whiteSpaceOptions, category, "WithinLockParentheses", GettextCatalog.GetString ("within parenthesis"), simpleLock);
-
- category = AddOption (whiteSpaceOptions, upperCategory, null, GettextCatalog.GetString ("'using'"), simpleUsingStatement);
- AddOption (whiteSpaceOptions, category, "UsingParentheses", GettextCatalog.GetString ("before opening parenthesis"), simpleUsingStatement);
- AddOption (whiteSpaceOptions, category, "WithinUsingParentheses", GettextCatalog.GetString ("within parenthesis"), simpleUsingStatement);
-
-
- upperCategory = AddOption (whiteSpaceOptions, null, GettextCatalog.GetString ("Expressions"), null);
-
- example = @"class Example {
- void Test ()
- {
- Console.WriteLine();
- Console.WriteLine(""{0} {1}!"", ""Hello"", ""World"");
- }
-}";
-
- category = AddOption (whiteSpaceOptions, upperCategory, null, GettextCatalog.GetString ("Method invocations"), example);
- AddOption (whiteSpaceOptions, category, "BeforeMethodCallParentheses", GettextCatalog.GetString ("before opening parenthesis"), example);
- AddOption (whiteSpaceOptions, category, "WithinMethodCallParentheses", GettextCatalog.GetString ("within parenthesis"), example);
- AddOption (whiteSpaceOptions, category, "BetweenEmptyMethodCallParentheses", GettextCatalog.GetString ("between empty parenthesis"), example);
- AddOption (whiteSpaceOptions, category, "BeforeMethodCallParameterComma", GettextCatalog.GetString ("before comma in parenthesis"), example);
- AddOption (whiteSpaceOptions, category, "AfterMethodCallParameterComma", GettextCatalog.GetString ("after comma in parenthesis"), example);
-
- category = AddOption (whiteSpaceOptions, upperCategory, null, GettextCatalog.GetString ("Object creation"), example);
- example = @"partial class Example {
- void Test ()
- {
- var anExample = new Example (1, 2, 3);
- var emptyExample = new Example ();
- }
-}";
- AddOption (whiteSpaceOptions, category, "NewParentheses", GettextCatalog.GetString ("before opening parenthesis"), example);
- AddOption (whiteSpaceOptions, category, "WithinNewParentheses", GettextCatalog.GetString ("within parenthesis"), example);
- AddOption (whiteSpaceOptions, category, "BetweenEmptyNewParentheses", GettextCatalog.GetString ("between empty parenthesis"), example);
- AddOption (whiteSpaceOptions, category, "BeforeNewParameterComma", GettextCatalog.GetString ("before comma in parenthesis"), example);
- AddOption (whiteSpaceOptions, category, "AfterNewParameterComma", GettextCatalog.GetString ("after comma in parenthesis"), example);
-
-
- example = @"class Example {
- void Test ()
- {
- a[1,2] = b[3];
- }
-}";
- category = AddOption (whiteSpaceOptions, upperCategory, null, GettextCatalog.GetString ("Element access"), example);
- AddOption (whiteSpaceOptions, category, "SpacesBeforeBrackets", GettextCatalog.GetString ("before opening bracket"), example);
- AddOption (whiteSpaceOptions, category, "SpacesWithinBrackets", GettextCatalog.GetString ("within brackets"), example);
- AddOption (whiteSpaceOptions, category, "BeforeBracketComma", GettextCatalog.GetString ("before comma in brackets"), example);
- AddOption (whiteSpaceOptions, category, "AfterBracketComma", GettextCatalog.GetString ("after comma in brackets"), example);
-
- category = AddOption (whiteSpaceOptions, upperCategory, null, GettextCatalog.GetString ("Parentheses"), operatorExample);
- AddOption (whiteSpaceOptions, category, "WithinParentheses", GettextCatalog.GetString ("within parenthesis"), operatorExample);
-
- example = @"class ClassDeclaration {
- public void Test (object o)
- {
- int i = (int)o;
- }
- }";
- category = AddOption (whiteSpaceOptions, upperCategory, null, GettextCatalog.GetString ("Type cast"), example);
- AddOption (whiteSpaceOptions, category, "WithinCastParentheses", GettextCatalog.GetString ("within parenthesis"), example);
- AddOption (whiteSpaceOptions, category, "SpacesAfterTypecast", GettextCatalog.GetString ("after type cast"), example);
-
- example = @"class ClassDeclaration {
- public void Test ()
- {
- int i = sizeof (ClassDeclaration);
- }
- }";
- category = AddOption (whiteSpaceOptions, upperCategory, null, GettextCatalog.GetString ("'sizeof'"), example);
- AddOption (whiteSpaceOptions, category, "BeforeSizeOfParentheses", GettextCatalog.GetString ("before opening parenthesis"), example);
- AddOption (whiteSpaceOptions, category, "WithinSizeOfParentheses", GettextCatalog.GetString ("within parenthesis"), example);
-
- example = @"class ClassDeclaration {
- public void Test ()
- {
- Type t = typeof (ClassDeclaration);
- }
- }";
- category = AddOption (whiteSpaceOptions, upperCategory, null, GettextCatalog.GetString ("'typeof'"), example);
- AddOption (whiteSpaceOptions, category, "BeforeTypeOfParentheses", GettextCatalog.GetString ("before opening parenthesis"), example);
- AddOption (whiteSpaceOptions, category, "WithinTypeOfParentheses", GettextCatalog.GetString ("within parenthesis"), example);
-
- category = AddOption (whiteSpaceOptions, upperCategory, null, GettextCatalog.GetString ("Around Operators"), operatorExample);
- AddOption (whiteSpaceOptions, category, "AroundAssignmentParentheses", GettextCatalog.GetString ("Assignment (=, +=, -=, ...)"), operatorExample);
- AddOption (whiteSpaceOptions, category, "AroundLogicalOperatorParentheses", GettextCatalog.GetString ("Logical (&&, ||) operators"), operatorExample);
- AddOption (whiteSpaceOptions, category, "AroundEqualityOperatorParentheses", GettextCatalog.GetString ("Equality (==, !=) operators"), operatorExample);
- AddOption (whiteSpaceOptions, category, "AroundRelationalOperatorParentheses", GettextCatalog.GetString ("Relational (<, >, <=, >=) operators"), operatorExample);
- AddOption (whiteSpaceOptions, category, "AroundBitwiseOperatorParentheses", GettextCatalog.GetString ("Bitwise &, |, ^, ~() operators"), operatorExample);
- AddOption (whiteSpaceOptions, category, "AroundAdditiveOperatorParentheses", GettextCatalog.GetString ("Additive (+, -) operators"), operatorExample);
- AddOption (whiteSpaceOptions, category, "AroundMultiplicativeOperatorParentheses", GettextCatalog.GetString ("Multiplicative (*, /, %) operators"), operatorExample);
- AddOption (whiteSpaceOptions, category, "AroundShiftOperatorParentheses", GettextCatalog.GetString ("Shift (<<, >>) operators"), operatorExample);
- AddOption (whiteSpaceOptions, category, "AroundNullCoalescingOperator", GettextCatalog.GetString ("Null coalescing (??) operator"), operatorExample);
- AddOption (whiteSpaceOptions, category, "SpaceAfterUnsafeAddressOfOperator", GettextCatalog.GetString ("Unsafe addressof operator (&)"), @"unsafe class ClassDeclaration {
- public void TestMethod ()
- {
- int* a = &x;
- }
-}");
- AddOption (whiteSpaceOptions, category, "SpaceAfterUnsafeAsteriskOfOperator", GettextCatalog.GetString ("Unsafe asterisk operator (*)"), @"unsafe class ClassDeclaration {
- public void TestMethod ()
- {
- int a = *x;
- }
-}");
- AddOption (whiteSpaceOptions, category, "SpaceAroundUnsafeArrowOperator", GettextCatalog.GetString ("Unsafe arrow operator (->)"), @"unsafe class ClassDeclaration {
- public void TestMethod ()
- {
- x->Foo();
- }
-}");
- category = AddOption (whiteSpaceOptions, upperCategory, null, GettextCatalog.GetString ("Conditional Operator (?:)"), condOpExample);
- AddOption (whiteSpaceOptions, category, "ConditionalOperatorBeforeConditionSpace", GettextCatalog.GetString ("before '?'"), condOpExample);
- AddOption (whiteSpaceOptions, category, "ConditionalOperatorAfterConditionSpace", GettextCatalog.GetString ("after '?'"), condOpExample);
- AddOption (whiteSpaceOptions, category, "ConditionalOperatorBeforeSeparatorSpace", GettextCatalog.GetString ("before ':'"), condOpExample);
- AddOption (whiteSpaceOptions, category, "ConditionalOperatorAfterSeparatorSpace", GettextCatalog.GetString ("after ':'"), condOpExample);
-
- example = @"class ClassDeclaration {
- string[][] field;
- int[] test;
- }";
- category = AddOption (whiteSpaceOptions, upperCategory, null, GettextCatalog.GetString ("Array Declarations"), example);
- AddOption (whiteSpaceOptions, category, "SpacesBeforeArrayDeclarationBrackets", GettextCatalog.GetString ("before opening bracket"), example);
+ treeviewWrapping.AppendColumn (column);
- category = AddOption (whiteSpaceOptions, upperCategory, null, GettextCatalog.GetString ("Other"), example);
- AddOption (whiteSpaceOptions, category, "SpaceBeforeSemicolon", GettextCatalog.GetString ("before semicolon"), example);
+ AddOption (wrappingOptions, "WrappingPreserveSingleLine", GettextCatalog.GetString ("Leave block on single line"), "");
+ AddOption (wrappingOptions, "WrappingKeepStatementsOnSingleLine", GettextCatalog.GetString ("Leave statements and member declarations on the same line"), "");
- /*
- whiteSpaceOptions= new ListStore (typeof (Option), typeof (bool), typeof (bool));
- column = new TreeViewColumn ();
- // text column
- column.PackStart (cellRendererText, true);
- column.SetCellDataFunc (cellRendererText, delegate (TreeViewColumn col, CellRenderer cell, TreeModel model, TreeIter iter) {
- ((CellRendererText)cell).Text = ((Option)model.GetValue (iter, 0)).DisplayName;
- });
- treeviewInsertWhiteSpaceOptions.AppendColumn (column);
-
- column = new TreeViewColumn ();
- cellRendererCombo = new CellRendererCombo ();
- cellRendererCombo.Ypad = 1;
- cellRendererCombo.Mode = CellRendererMode.Editable;
- cellRendererCombo.TextColumn = 1;
- cellRendererCombo.Model = comboBoxStore;
- cellRendererCombo.HasEntry = false;
- cellRendererCombo.Editable = !profile.IsBuiltIn;
-
- cellRendererCombo.Edited += delegate(object o, EditedArgs args) {
- TreeIter iter;
- var model = whiteSpaceOptions;
- if (model.GetIterFromString (out iter, args.Path)) {
- var option = (Option)model.GetValue (iter, 0);
- PropertyInfo info = GetPropertyByName (option.PropertyName);
- if (info == null)
- return;
- var value = Enum.Parse (info.PropertyType, args.NewText);
- info.SetValue (profile, value, null);
- UpdateExample (texteditor.Document.Text);
- }
- };
-
- column.PackStart (cellRendererCombo, false);
- column.SetAttributes (cellRendererCombo, "visible", 2);
- column.SetCellDataFunc (cellRendererCombo, delegate (TreeViewColumn col, CellRenderer cell, TreeModel model, TreeIter iter) {
- ((CellRendererCombo)cell).Text = GetValue (((Option)model.GetValue (iter, 0)).PropertyName).ToString ();
- });
-
- cellRendererToggle = new CellRendererToggle ();
- cellRendererToggle.Activatable = !profile.IsBuiltIn;
- cellRendererToggle.Ypad = 1;
- cellRendererToggle.Toggled += delegate(object o, ToggledArgs args) {
- TreeIter iter;
- var model = whiteSpaceOptions;
- if (model.GetIterFromString (out iter, args.Path)) {
- var option = (Option)model.GetValue (iter, 0);
- PropertyInfo info = GetPropertyByName (option.PropertyName);
- if (info == null || info.PropertyType != typeof(bool))
- return;
- bool value = (bool)info.GetValue (this.profile, null);
- info.SetValue (profile, !value, null);
- UpdateExample (texteditor.Document.Text);
- }
- };
-
- column.PackStart (cellRendererToggle, false);
- column.SetAttributes (cellRendererToggle, "visible", 1);
- column.SetCellDataFunc (cellRendererToggle, delegate (TreeViewColumn col, CellRenderer cell, TreeModel model, TreeIter iter) {
- ((CellRendererToggle)cell).Active = (bool)GetValue (((Option)model.GetValue (iter, 0)).PropertyName);
- });
-
- treeviewInsertWhiteSpaceOptions.AppendColumn (column);
-
- treeviewInsertWhiteSpaceOptions.Model = whiteSpaceOptions;*/
- treeviewInsertWhiteSpaceCategory.ExpandAll ();
- #endregion
-
- #region Blank line options
- entryBeforUsings.Text = profile.BlankLinesBeforeUsings.ToString ();
- entryAfterUsings.Text = profile.BlankLinesAfterUsings.ToString ();
-
- entryBeforeFirstDeclaration.Text = profile.BlankLinesBeforeFirstDeclaration.ToString ();
- entryBetweenTypes.Text = profile.BlankLinesBetweenTypes.ToString ();
-
- entryBetweenFields.Text = profile.BlankLinesBetweenFields.ToString ();
- entryBetweenEvents.Text = profile.BlankLinesBetweenEventFields.ToString ();
- entryBetweenMembers.Text = profile.BlankLinesBetweenMembers.ToString ();
- entryInsideRegion.Text = profile.BlankLinesInsideRegion.ToString ();
- entryAroundRegion.Text = profile.BlankLinesAroundRegion.ToString ();
-
- entryBeforUsings.Changed += HandleEntryBeforUsingsChanged;
- entryAfterUsings.Changed += HandleEntryBeforUsingsChanged;
- entryBeforeFirstDeclaration.Changed += HandleEntryBeforUsingsChanged;
- entryBetweenTypes.Changed += HandleEntryBeforUsingsChanged;
- entryBetweenFields.Changed += HandleEntryBeforUsingsChanged;
- entryBetweenEvents.Changed += HandleEntryBeforUsingsChanged;
- entryBetweenMembers.Changed += HandleEntryBeforUsingsChanged;
- entryAroundRegion.Changed += HandleEntryBeforUsingsChanged;
- entryInsideRegion.Changed += HandleEntryBeforUsingsChanged;
+ treeviewWrapping.ExpandAll ();
#endregion
}
@@ -1169,20 +585,6 @@ delegate void BarFoo ();
return int.TryParse (entry.Text, out newValue) ? newValue : oldValue;
}
- void HandleEntryBeforUsingsChanged (object sender, EventArgs e)
- {
- profile.BlankLinesBeforeUsings = SetFlag (entryBeforUsings, profile.BlankLinesBeforeUsings);
- profile.BlankLinesAfterUsings = SetFlag (entryAfterUsings, profile.BlankLinesAfterUsings);
- profile.BlankLinesBeforeFirstDeclaration = SetFlag (entryBeforeFirstDeclaration, profile.BlankLinesBeforeFirstDeclaration);
- profile.BlankLinesBetweenTypes = SetFlag (entryBetweenTypes, profile.BlankLinesBetweenTypes);
- profile.BlankLinesBetweenFields = SetFlag (entryBetweenFields, profile.BlankLinesBetweenFields);
- profile.BlankLinesBetweenMembers = SetFlag (entryBetweenMembers, profile.BlankLinesBetweenMembers);
- profile.BlankLinesBetweenEventFields = SetFlag (entryBetweenEvents, profile.BlankLinesBetweenMembers);
- profile.BlankLinesAroundRegion = SetFlag (entryAroundRegion, profile.BlankLinesAroundRegion);
- profile.BlankLinesInsideRegion = SetFlag (entryInsideRegion, profile.BlankLinesInsideRegion);
- UpdateExample (blankLineExample);
- }
-
static PropertyInfo GetPropertyByName (string name)
{
PropertyInfo info = typeof(CSharpFormattingPolicy).GetProperty (name);
@@ -1190,8 +592,7 @@ delegate void BarFoo ();
throw new Exception (name + " property not found");
return info;
}
-
-
+
static TreeIter AddOption (TreeStore model, string propertyName, string displayName, string example)
{
bool isBool = false;
@@ -1247,7 +648,10 @@ delegate void BarFoo ();
} else {
text = "";
}
- texteditor.Document.Text = CSharpFormatter.FormatText (profile, null, CSharpFormatter.MimeType, text, 0, text.Length);
+
+ var types = DesktopService.GetMimeTypeInheritanceChain (MonoDevelop.CSharp.Formatting.CSharpFormatter.MimeType);
+ var textPolicy = MonoDevelop.Projects.Policies.PolicyService.GetDefaultPolicy<TextStylePolicy> (types);
+ texteditor.Text = CSharpFormatter.FormatText (profile, textPolicy, CSharpFormatter.MimeType, text, 0, text.Length);
}
static PropertyInfo GetProperty (TreeModel model, TreeIter iter)
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/CSharpIndentVirtualSpaceManager.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/CSharpIndentVirtualSpaceManager.cs
index 0782defa74..2970e88724 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/CSharpIndentVirtualSpaceManager.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/CSharpIndentVirtualSpaceManager.cs
@@ -24,62 +24,44 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-using Mono.TextEditor;
-using ICSharpCode.NRefactory.CSharp;
using System;
using MonoDevelop.Core;
+using MonoDevelop.Ide.Editor;
+using MonoDevelop.Ide.Editor.Extension;
+using ICSharpCode.NRefactory6.CSharp;
namespace MonoDevelop.CSharp.Formatting
{
- class IndentVirtualSpaceManager : IIndentationTracker
+ class IndentVirtualSpaceManager : IndentationTracker
{
- readonly TextEditorData data;
- readonly CacheIndentEngine stateTracker;
-
- public IndentVirtualSpaceManager(TextEditorData data, CacheIndentEngine stateTracker)
+ readonly TextEditor data;
+ readonly CacheIndentEngine stateTracker;
+
+ public IndentVirtualSpaceManager(TextEditor data, CacheIndentEngine stateTracker)
{
this.data = data;
this.stateTracker = stateTracker;
}
- string GetIndentationString (DocumentLocation loc)
+ #region IndentationTracker implementation
+ public override string GetIndentationString (int lineNumber)
{
- var line = data.Document.GetLine (loc.Line);
+ var line = data.GetLine (lineNumber);
if (line == null)
return "";
// Get context to the end of the line w/o changing the main engine's state
var offset = line.Offset;
- string curIndent = line.GetIndentation (data.Document);
+ string curIndent = line.GetIndentation (data);
try {
- stateTracker.Update (Math.Min (data.Length, offset + Math.Min (line.Length, loc.Column - 1)));
+ stateTracker.Update (data, Math.Min (data.Length, offset + line.Length));
int nlwsp = curIndent.Length;
- if (!stateTracker.LineBeganInsideMultiLineComment || (nlwsp < line.LengthIncludingDelimiter && data.Document.GetCharAt (offset + nlwsp) == '*'))
+ if (!stateTracker.LineBeganInsideMultiLineComment || (nlwsp < line.LengthIncludingDelimiter && data.GetCharAt (offset + nlwsp) == '*'))
return stateTracker.ThisLineIndent;
} catch (Exception e) {
- LoggingService.LogError ("Error while indenting at "+ loc, e);
+ LoggingService.LogError ("Error while indenting at line " + lineNumber, e);
}
return curIndent;
}
-
- public string GetIndentationString (int lineNumber, int column)
- {
- return GetIndentationString (new DocumentLocation (lineNumber, column));
- }
-
- public string GetIndentationString (int offset)
- {
- return GetIndentationString (data.OffsetToLocation (offset));
- }
-
- public int GetVirtualIndentationColumn (int offset)
- {
- return 1 + GetIndentationString (offset).Length;
- }
-
- public int GetVirtualIndentationColumn (int lineNumber, int column)
- {
- return 1 + GetIndentationString (lineNumber, column).Length;
- }
+ #endregion
}
-}
-
+} \ No newline at end of file
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/CSharpTextEditorIndentation.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/CSharpTextEditorIndentation.cs
index fce4666569..8e289dfa3f 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/CSharpTextEditorIndentation.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/CSharpTextEditorIndentation.cs
@@ -31,37 +31,32 @@ using MonoDevelop.Core;
using MonoDevelop.Ide.Gui.Content;
using MonoDevelop.Ide.CodeCompletion;
using MonoDevelop.CSharp.Formatting;
-using MonoDevelop.CSharp.Refactoring;
-using Mono.TextEditor;
using MonoDevelop.Ide.CodeTemplates;
-using MonoDevelop.SourceEditor;
-using ICSharpCode.NRefactory.CSharp.Completion;
-using ICSharpCode.NRefactory.Editor;
using System.Linq;
using System.Text;
-using ICSharpCode.NRefactory.CSharp;
using MonoDevelop.Ide;
-using ICSharpCode.NRefactory;
+using MonoDevelop.Ide.Editor;
+using MonoDevelop.Ide.Editor.Extension;
+using MonoDevelop.Projects;
+using MonoDevelop.Core.Text;
+using ICSharpCode.NRefactory6.CSharp;
+using System.Threading;
+using Microsoft.CodeAnalysis.CSharp;
+using Microsoft.CodeAnalysis;
namespace MonoDevelop.CSharp.Formatting
{
class CSharpTextEditorIndentation : TextEditorExtension
{
- CacheIndentEngine stateTracker;
+ internal ICSharpCode.NRefactory6.CSharp.CacheIndentEngine stateTracker;
int cursorPositionBeforeKeyPress;
- TextEditorData textEditorData {
- get {
- return document.Editor;
- }
- }
-
readonly IEnumerable<string> types = DesktopService.GetMimeTypeInheritanceChain (CSharpFormatter.MimeType);
CSharpFormattingPolicy Policy {
get {
- if (Document != null && Document.Project != null && Document.Project.Policies != null) {
- return Document.Project.Policies.Get<CSharpFormattingPolicy> (types);
+ if (DocumentContext != null && DocumentContext.Project != null && DocumentContext.Project.Policies != null) {
+ return DocumentContext.Project.Policies.Get<CSharpFormattingPolicy> (types);
}
return MonoDevelop.Projects.Policies.PolicyService.GetDefaultPolicy<CSharpFormattingPolicy> (types);
}
@@ -69,8 +64,8 @@ namespace MonoDevelop.CSharp.Formatting
TextStylePolicy TextStylePolicy {
get {
- if (Document != null && Document.Project != null && Document.Project.Policies != null) {
- return Document.Project.Policies.Get<TextStylePolicy> (types);
+ if (DocumentContext != null && DocumentContext.Project != null && DocumentContext.Project.Policies != null) {
+ return DocumentContext.Project.Policies.Get<TextStylePolicy> (types);
}
return MonoDevelop.Projects.Policies.PolicyService.GetDefaultPolicy<TextStylePolicy> (types);
}
@@ -81,17 +76,13 @@ namespace MonoDevelop.CSharp.Formatting
static CSharpTextEditorIndentation ()
{
CompletionWindowManager.WordCompleted += delegate(object sender, CodeCompletionContextEventArgs e) {
- var editor = e.Widget as IExtensibleTextEditor;
+ var editor = e.Widget as IServiceProvider;
if (editor == null)
return;
- var textEditorExtension = editor.Extension;
- while (textEditorExtension != null && !(textEditorExtension is CSharpTextEditorIndentation)) {
- textEditorExtension = textEditorExtension.Next;
- }
- var extension = textEditorExtension as CSharpTextEditorIndentation;
+ var extension = editor.GetService (typeof(CSharpTextEditorIndentation)) as CSharpTextEditorIndentation;
if (extension == null)
return;
- extension.SafeUpdateIndentEngine (extension.textEditorData.Caret.Offset);
+ extension.SafeUpdateIndentEngine (extension.Editor.CaretOffset);
if (extension.stateTracker.NeedsReindent)
extension.DoReSmartIndent ();
};
@@ -100,44 +91,12 @@ namespace MonoDevelop.CSharp.Formatting
internal void SafeUpdateIndentEngine (int offset)
{
try {
- stateTracker.Update (offset);
+ stateTracker.Update (Editor, offset);
} catch (Exception e) {
LoggingService.LogError ("Error while updating the indentation engine", e);
}
}
- void HandleTextPaste (int insertionOffset, string text, int insertedChars)
- {
- if (document.Editor.Options.IndentStyle == IndentStyle.None ||
- document.Editor.Options.IndentStyle == IndentStyle.Auto)
- return;
-
- // Just correct the start line of the paste operation - the text is already indented.
- var curLine = Editor.GetLineByOffset (insertionOffset);
- var curLineOffset = curLine.Offset;
- SafeUpdateIndentEngine (curLineOffset);
- if (!stateTracker.IsInsideOrdinaryCommentOrString) {
- int pos = curLineOffset;
- string curIndent = curLine.GetIndentation (textEditorData.Document);
- int nlwsp = curIndent.Length;
-
- if (!stateTracker.LineBeganInsideMultiLineComment || (nlwsp < curLine.LengthIncludingDelimiter && textEditorData.Document.GetCharAt (curLineOffset + nlwsp) == '*')) {
- // Possibly replace the indent
- SafeUpdateIndentEngine (curLineOffset + curLine.Length);
- string newIndent = stateTracker.ThisLineIndent;
- if (newIndent != curIndent) {
- if (CompletionWindowManager.IsVisible) {
- if (pos < CompletionWindowManager.CodeCompletionContext.TriggerOffset)
- CompletionWindowManager.CodeCompletionContext.TriggerOffset -= nlwsp;
- }
- textEditorData.Replace (pos, nlwsp, newIndent);
- textEditorData.Document.CommitLineUpdate (textEditorData.Caret.Line);
- }
- }
- }
- textEditorData.FixVirtualIndentation ();
- }
-
public static bool OnTheFlyFormatting {
get {
return PropertyService.Get ("OnTheFlyFormatting", true);
@@ -147,24 +106,23 @@ namespace MonoDevelop.CSharp.Formatting
}
}
- void RunFormatter (DocumentLocation location)
+ void RunFormatter (MonoDevelop.Ide.Editor.DocumentLocation location)
{
- if (OnTheFlyFormatting && textEditorData != null && !(textEditorData.CurrentMode is TextLinkEditMode) && !(textEditorData.CurrentMode is InsertionCursorEditMode)) {
- OnTheFlyFormatter.Format (Document, location);
- }
+ if (!OnTheFlyFormatting || Editor == null || Editor.EditMode != EditMode.Edit)
+ return;
+ var offset = Editor.LocationToOffset (location);
+ OnTheFlyFormatter.Format (Editor, DocumentContext, offset, offset);
}
- public override void Initialize ()
+ protected override void Initialize ()
{
base.Initialize ();
-
- if (textEditorData != null) {
- textEditorData.Options.Changed += HandleTextOptionsChanged;
+ if (Editor != null) {
+ Editor.OptionsChanged += HandleTextOptionsChanged;
HandleTextOptionsChanged (this, EventArgs.Empty);
- textEditorData.Document.TextReplacing += HandleTextReplacing;
- textEditorData.Document.TextReplaced += HandleTextReplaced;
- textEditorData.Paste += HandleTextPaste;
+ Editor.TextChanging += HandleTextReplacing;
+ Editor.TextChanged += HandleTextReplaced;
}
if (IdeApp.Workspace != null)
IdeApp.Workspace.ActiveConfigurationChanged += HandleTextOptionsChanged;
@@ -172,47 +130,61 @@ namespace MonoDevelop.CSharp.Formatting
bool indentationDisabled;
+ public static IEnumerable<string> GetDefinedSymbols (MonoDevelop.Projects.Project project)
+ {
+ var workspace = IdeApp.Workspace;
+ if (workspace == null || project == null)
+ yield break;
+ var configuration = project.GetConfiguration (workspace.ActiveConfiguration) as DotNetProjectConfiguration;
+ if (configuration != null) {
+ foreach (string s in configuration.GetDefineSymbols ())
+ yield return s;
+ // Workaround for mcs defined symbol
+ if (configuration.TargetRuntime.RuntimeId == "Mono")
+ yield return "__MonoCS__";
+ }
+ }
+
void HandleTextOptionsChanged (object sender, EventArgs e)
{
- var policy = Policy.CreateOptions ();
- var options = Editor.CreateNRefactoryTextEditorOptions ();
- options.IndentBlankLines = true;
- IStateMachineIndentEngine indentEngine;
+ //var options = Editor.CreateNRefactoryTextEditorOptions ();
+ var policy = Policy.CreateOptions (Editor.Options);
+ //options.IndentBlankLines = true;
+ ICSharpCode.NRefactory6.CSharp.IStateMachineIndentEngine indentEngine;
try {
- var csharpIndentEngine = new CSharpIndentEngine (textEditorData.Document, options, policy);
+ var csharpIndentEngine = new ICSharpCode.NRefactory6.CSharp.CSharpIndentEngine (policy);
//csharpIndentEngine.EnableCustomIndentLevels = true;
- foreach (var symbol in MonoDevelop.CSharp.Highlighting.CSharpSyntaxMode.GetDefinedSymbols (document.Project)) {
+ foreach (var symbol in GetDefinedSymbols (DocumentContext.Project)) {
csharpIndentEngine.DefineSymbol (symbol);
}
indentEngine = csharpIndentEngine;
} catch (Exception ex) {
LoggingService.LogError ("Error while creating the c# indentation engine", ex);
- indentEngine = new NullIStateMachineIndentEngine (textEditorData.Document);
+ indentEngine = new ICSharpCode.NRefactory6.CSharp.NullIStateMachineIndentEngine ();
}
- stateTracker = new CacheIndentEngine (indentEngine);
+ stateTracker = new ICSharpCode.NRefactory6.CSharp.CacheIndentEngine (indentEngine);
if (DefaultSourceEditorOptions.Instance.IndentStyle == IndentStyle.Auto) {
- textEditorData.IndentationTracker = new DefaultIndentationTracker (textEditorData.Document);
+ Editor.SetIndentationTracker (null);
} else {
- textEditorData.IndentationTracker = new IndentVirtualSpaceManager (textEditorData, stateTracker);
+ Editor.SetIndentationTracker (new IndentVirtualSpaceManager (Editor, stateTracker));
}
indentationDisabled = DefaultSourceEditorOptions.Instance.IndentStyle == IndentStyle.Auto || DefaultSourceEditorOptions.Instance.IndentStyle == IndentStyle.None;
if (indentationDisabled) {
- textEditorData.TextPasteHandler = null;
+ Editor.SetTextPasteHandler (null);
} else {
- textEditorData.TextPasteHandler = new TextPasteIndentEngine (stateTracker, options, policy);
+ Editor.SetTextPasteHandler (new CSharpTextPasteHandler (this, stateTracker, policy));
}
}
public override void Dispose ()
{
- if (textEditorData != null) {
- textEditorData.TextPasteHandler = null;
- textEditorData.Paste -= HandleTextPaste;
- textEditorData.Options.Changed -= HandleTextOptionsChanged;
- textEditorData.IndentationTracker = null;
- textEditorData.Document.TextReplacing -= HandleTextReplacing;
- textEditorData.Document.TextReplaced -= HandleTextReplaced;
+ if (Editor != null) {
+ Editor.SetTextPasteHandler (null);
+ Editor.OptionsChanged -= HandleTextOptionsChanged;
+ Editor.SetIndentationTracker (null);
+ Editor.TextChanging -= HandleTextReplacing;
+ Editor.TextChanged -= HandleTextReplaced;
}
IdeApp.Workspace.ActiveConfigurationChanged -= HandleTextOptionsChanged;
stateTracker = null;
@@ -221,31 +193,31 @@ namespace MonoDevelop.CSharp.Formatting
bool? wasInVerbatimString;
- void HandleTextReplaced (object sender, DocumentChangeEventArgs e)
+ void HandleTextReplaced (object sender, MonoDevelop.Core.Text.TextChangeEventArgs e)
{
- stateTracker.ResetEngineToPosition (e.Offset);
+ stateTracker.ResetEngineToPosition (Editor, e.Offset);
if (wasInVerbatimString == null)
return;
- if (e.RemovalLength != 1 || textEditorData.Document.CurrentAtomicUndoOperationType == OperationType.Format)
+ if (e.RemovalLength != 1 /*|| textEditorData.Document.CurrentAtomicUndoOperationType == OperationType.Format*/)
return;
- SafeUpdateIndentEngine (Math.Min (textEditorData.Document.TextLength, e.Offset + e.InsertionLength + 1));
+ SafeUpdateIndentEngine (Math.Min (Editor.Length, e.Offset + e.InsertionLength + 1));
if (wasInVerbatimString == true && !stateTracker.IsInsideVerbatimString) {
- textEditorData.Document.TextReplacing -= HandleTextReplacing;
- textEditorData.Document.TextReplaced -= HandleTextReplaced;
- ConvertVerbatimStringToNormal (textEditorData, e.Offset + e.InsertionLength + 1);
- textEditorData.Document.TextReplacing += HandleTextReplacing;
- textEditorData.Document.TextReplaced += HandleTextReplaced;
+ Editor.TextChanging -= HandleTextReplacing;
+ Editor.TextChanged -= HandleTextReplaced;
+ ConvertVerbatimStringToNormal (Editor, e.Offset + e.InsertionLength + 1);
+ Editor.TextChanging += HandleTextReplacing;
+ Editor.TextChanged += HandleTextReplaced;
}
}
- void HandleTextReplacing (object sender, DocumentChangeEventArgs e)
+ void HandleTextReplacing (object sender, MonoDevelop.Core.Text.TextChangeEventArgs e)
{
wasInVerbatimString = null;
var o = e.Offset + e.RemovalLength;
- if (o < 0 || o + 1 > textEditorData.Length || e.RemovalLength != 1 || textEditorData.Document.IsInUndo) {
+ if (o < 0 || o + 1 > Editor.Length || e.RemovalLength != 1/* || textEditorData.Document.IsInUndo*/) {
return;
}
- if (textEditorData.GetCharAt (o) != '"')
+ if (Editor.GetCharAt (o) != '"')
return;
SafeUpdateIndentEngine (o + 1);
wasInVerbatimString = stateTracker.IsInsideVerbatimString;
@@ -279,7 +251,7 @@ namespace MonoDevelop.CSharp.Formatting
return result.ToString ();
}
- static void ConvertNormalToVerbatimString (TextEditorData textEditorData, int offset)
+ static void ConvertNormalToVerbatimString (ITextDocument textEditorData, int offset)
{
var endOffset = offset;
while (endOffset < textEditorData.Length) {
@@ -301,10 +273,10 @@ namespace MonoDevelop.CSharp.Formatting
return;
var plainText = TextPasteUtils.StringLiteralPasteStrategy.Instance.Decode (textEditorData.GetTextAt (offset, endOffset - offset));
var newText = TextPasteUtils.VerbatimStringStrategy.Encode (plainText);
- textEditorData.Replace (offset, endOffset - offset, newText);
+ textEditorData.ReplaceText (offset, endOffset - offset, newText);
}
- static void ConvertVerbatimStringToNormal (TextEditorData textEditorData, int offset)
+ static void ConvertVerbatimStringToNormal (ITextDocument textEditorData, int offset)
{
var endOffset = offset;
while (endOffset < textEditorData.Length) {
@@ -320,14 +292,12 @@ namespace MonoDevelop.CSharp.Formatting
}
var plainText = TextPasteUtils.VerbatimStringStrategy.Decode (textEditorData.GetTextAt (offset, endOffset - offset));
var newText = TextPasteUtils.StringLiteralPasteStrategy.Instance.Encode (plainText);
- textEditorData.Replace (offset, endOffset - offset, newText);
+ textEditorData.ReplaceText (offset, endOffset - offset, newText);
}
- internal IStateMachineIndentEngine StateTracker { get { return stateTracker; } }
-
public bool DoInsertTemplate ()
{
- string word = CodeTemplate.GetWordBeforeCaret (textEditorData);
+ string word = CodeTemplate.GetWordBeforeCaret (Editor);
foreach (CodeTemplate template in CodeTemplateService.GetCodeTemplates (CSharpFormatter.MimeType)) {
if (template.Shortcut == word)
return true;
@@ -340,8 +310,8 @@ namespace MonoDevelop.CSharp.Formatting
void CheckXmlCommentCloseTag (char keyChar)
{
if (keyChar == '>' && stateTracker.IsInsideDocLineComment) {
- var location = Editor.Caret.Location;
- string lineText = Editor.GetLineText (Editor.Caret.Line);
+ var location = Editor.CaretLocation;
+ string lineText = Editor.GetLineText (Editor.CaretLine);
int startIndex = Math.Min (location.Column - 2, lineText.Length - 1);
while (startIndex >= 0 && lineText [startIndex] != '<') {
--startIndex;
@@ -357,8 +327,10 @@ namespace MonoDevelop.CSharp.Formatting
endIndex++;
}
string tag = endIndex - startIndex > 0 ? lineText.Substring (startIndex + 1, endIndex - startIndex - 1) : null;
- if (!string.IsNullOrEmpty (tag) && CSharpCompletionEngine.CommentTags.Any (t => t == tag)) {
- Editor.Document.Insert (Editor.Caret.Offset, "</" + tag + ">", AnchorMovementType.BeforeInsertion);
+ if (!string.IsNullOrEmpty (tag) && ICSharpCode.NRefactory.CSharp.Completion.CSharpCompletionEngine.CommentTags.Any (t => t == tag)) {
+ var caretOffset = Editor.CaretOffset;
+ Editor.InsertText (caretOffset, "</" + tag + ">");
+ Editor.CaretOffset = caretOffset;
}
}
}
@@ -366,99 +338,96 @@ namespace MonoDevelop.CSharp.Formatting
internal void ReindentOnTab ()
{
- int cursor = textEditorData.Caret.Offset;
- if (stateTracker.IsInsideVerbatimString && cursor > 0 && cursor < textEditorData.Document.TextLength && textEditorData.GetCharAt (cursor - 1) == '"')
+ int cursor = Editor.CaretOffset;
+ if (stateTracker.IsInsideVerbatimString && cursor > 0 && cursor < Editor.Length && Editor.GetCharAt (cursor - 1) == '"')
SafeUpdateIndentEngine (cursor + 1);
if (stateTracker.IsInsideVerbatimString) {
// insert normal tab inside @" ... "
- if (textEditorData.IsSomethingSelected) {
- textEditorData.SelectedText = "\t";
+ if (Editor.IsSomethingSelected) {
+ Editor.SelectedText = "\t";
}
else {
- textEditorData.Insert (cursor, "\t");
+ Editor.InsertText (cursor, "\t");
}
- textEditorData.Document.CommitLineUpdate (textEditorData.Caret.Line);
+ // textEditorData.Document.CommitLineUpdate (textEditorData.CaretLine);
}
else if (cursor >= 1) {
- if (textEditorData.Caret.Column > 1) {
+ if (Editor.CaretColumn > 1) {
int delta = cursor - cursorPositionBeforeKeyPress;
if (delta < 2 && delta > 0) {
- textEditorData.Remove (cursor - delta, delta);
- textEditorData.Caret.Offset = cursor - delta;
- textEditorData.Document.CommitLineUpdate (textEditorData.Caret.Line);
+ Editor.RemoveText (cursor - delta, delta);
+ Editor.CaretOffset = cursor - delta;
+ // textEditorData.Document.CommitLineUpdate (textEditorData.CaretLine);
}
}
- SafeUpdateIndentEngine (textEditorData.Caret.Offset);
+ SafeUpdateIndentEngine (Editor.CaretOffset);
DoReSmartIndent ();
}
}
- public override bool KeyPress (Gdk.Key key, char keyChar, Gdk.ModifierType modifier)
+ public override bool KeyPress (KeyDescriptor descriptor)
{
- bool skipFormatting = StateTracker.IsInsideOrdinaryCommentOrString ||
- StateTracker.IsInsidePreprocessorDirective;
-
- cursorPositionBeforeKeyPress = textEditorData.Caret.Offset;
- bool isSomethingSelected = textEditorData.IsSomethingSelected;
- if (key == Gdk.Key.BackSpace && textEditorData.Caret.Offset == lastInsertedSemicolon) {
- textEditorData.Document.Undo ();
+ cursorPositionBeforeKeyPress = Editor.CaretOffset;
+ bool isSomethingSelected = Editor.IsSomethingSelected;
+ if (descriptor.SpecialKey == SpecialKey.BackSpace && Editor.CaretOffset == lastInsertedSemicolon) {
+ EditActions.Undo (Editor);
lastInsertedSemicolon = -1;
return false;
}
lastInsertedSemicolon = -1;
- if (keyChar == ';' && !(textEditorData.CurrentMode is TextLinkEditMode) && !DoInsertTemplate () && !isSomethingSelected && PropertyService.Get (
+ if (descriptor.KeyChar == ';' && Editor.EditMode == EditMode.Edit && !DoInsertTemplate () && !isSomethingSelected && PropertyService.Get (
"SmartSemicolonPlacement",
false
) && !(stateTracker.IsInsideComment || stateTracker.IsInsideString)) {
- bool retval = base.KeyPress (key, keyChar, modifier);
- DocumentLine curLine = textEditorData.Document.GetLine (textEditorData.Caret.Line);
- string text = textEditorData.Document.GetTextAt (curLine);
+ bool retval = base.KeyPress (descriptor);
+ var curLine = Editor.GetLine (Editor.CaretLine);
+ string text = Editor.GetTextAt (curLine);
if (!(text.EndsWith (";", StringComparison.Ordinal) || text.Trim ().StartsWith ("for", StringComparison.Ordinal))) {
int guessedOffset;
- if (GuessSemicolonInsertionOffset (textEditorData, curLine, textEditorData.Caret.Offset, out guessedOffset)) {
- using (var undo = textEditorData.OpenUndoGroup ()) {
- textEditorData.Remove (textEditorData.Caret.Offset - 1, 1);
- textEditorData.Caret.Offset = guessedOffset;
- lastInsertedSemicolon = textEditorData.Caret.Offset + 1;
- retval = base.KeyPress (key, keyChar, modifier);
+ if (GuessSemicolonInsertionOffset (Editor, curLine, Editor.CaretOffset, out guessedOffset)) {
+ using (var undo = Editor.OpenUndoGroup ()) {
+ Editor.RemoveText (Editor.CaretOffset - 1, 1);
+ Editor.CaretOffset = guessedOffset;
+ lastInsertedSemicolon = Editor.CaretOffset + 1;
+ retval = base.KeyPress (descriptor);
}
}
}
- using (var undo = textEditorData.OpenUndoGroup ()) {
- if (OnTheFlyFormatting && textEditorData != null && !(textEditorData.CurrentMode is TextLinkEditMode) && !(textEditorData.CurrentMode is InsertionCursorEditMode)) {
- OnTheFlyFormatter.FormatStatmentAt (Document, textEditorData.Caret.Location);
+ using (var undo = Editor.OpenUndoGroup ()) {
+ if (OnTheFlyFormatting && Editor != null && Editor.EditMode == EditMode.Edit) {
+ OnTheFlyFormatter.FormatStatmentAt (Editor, DocumentContext, Editor.CaretLocation);
}
}
return retval;
}
- if (key == Gdk.Key.Tab) {
- SafeUpdateIndentEngine (textEditorData.Caret.Offset);
- if (stateTracker.IsInsideStringLiteral && !textEditorData.IsSomethingSelected) {
- var lexer = new CSharpCompletionEngineBase.MiniLexer (textEditorData.Document.GetTextAt (0, textEditorData.Caret.Offset));
+ if (descriptor.SpecialKey == SpecialKey.Tab) {
+ SafeUpdateIndentEngine (Editor.CaretOffset);
+ if (stateTracker.IsInsideStringLiteral && !Editor.IsSomethingSelected) {
+ var lexer = new ICSharpCode.NRefactory.CSharp.Completion.CSharpCompletionEngineBase.MiniLexer (Editor.GetTextAt (0, Editor.CaretOffset));
lexer.Parse ();
if (lexer.IsInString) {
- textEditorData.InsertAtCaret ("\\t");
+ Editor.InsertAtCaret ("\\t");
return false;
}
}
}
- if (key == Gdk.Key.Tab && DefaultSourceEditorOptions.Instance.TabIsReindent && !CompletionWindowManager.IsVisible && !(textEditorData.CurrentMode is TextLinkEditMode) && !DoInsertTemplate () && !isSomethingSelected) {
+ if (descriptor.SpecialKey == SpecialKey.Tab && DefaultSourceEditorOptions.Instance.TabIsReindent && !CompletionWindowManager.IsVisible && Editor.EditMode == EditMode.Edit && !DoInsertTemplate () && !isSomethingSelected) {
ReindentOnTab ();
return false;
}
- SafeUpdateIndentEngine (textEditorData.Caret.Offset);
+ SafeUpdateIndentEngine (Editor.CaretOffset);
if (!stateTracker.IsInsideOrdinaryCommentOrString) {
- if (keyChar == '@') {
- var retval = base.KeyPress (key, keyChar, modifier);
- int cursor = textEditorData.Caret.Offset;
- if (cursor < textEditorData.Length && textEditorData.GetCharAt (cursor) == '"')
- ConvertNormalToVerbatimString (textEditorData, cursor + 1);
+ if (descriptor.KeyChar == '@') {
+ var retval = base.KeyPress (descriptor);
+ int cursor = Editor.CaretOffset;
+ if (cursor < Editor.Length && Editor.GetCharAt (cursor) == '"')
+ ConvertNormalToVerbatimString (Editor, cursor + 1);
return retval;
}
}
@@ -468,34 +437,34 @@ namespace MonoDevelop.CSharp.Formatting
if (!indentationDisabled) {
bool retval;
//capture some of the current state
- int oldBufLen = textEditorData.Length;
- int oldLine = textEditorData.Caret.Line + 1;
+ int oldBufLen = Editor.Length;
+ int oldLine = Editor.CaretLine + 1;
bool reIndent = false;
//pass through to the base class, which actually inserts the character
//and calls HandleCodeCompletion etc to handles completion
- using (var undo = textEditorData.OpenUndoGroup ()) {
- DoPreInsertionSmartIndent (key);
+ using (var undo = Editor.OpenUndoGroup ()) {
+ DoPreInsertionSmartIndent (descriptor.SpecialKey);
}
wasInStringLiteral = stateTracker.IsInsideStringLiteral;
bool automaticReindent;
// need to be outside of an undo group - otherwise it interferes with other text editor extension
// esp. the documentation insertion undo steps.
- retval = base.KeyPress (key, keyChar, modifier);
+ retval = base.KeyPress (descriptor);
//handle inserted characters
- if (textEditorData.Caret.Offset <= 0 || textEditorData.IsSomethingSelected)
+ if (Editor.CaretOffset <= 0 || Editor.IsSomethingSelected)
return retval;
- lastCharInserted = TranslateKeyCharForIndenter (key, keyChar, textEditorData.GetCharAt (textEditorData.Caret.Offset - 1));
+ lastCharInserted = TranslateKeyCharForIndenter (descriptor.SpecialKey, descriptor.KeyChar, Editor.GetCharAt (Editor.CaretOffset - 1));
if (lastCharInserted == '\0')
return retval;
- using (var undo = textEditorData.OpenUndoGroup ()) {
- SafeUpdateIndentEngine (textEditorData.Caret.Offset);
+ using (var undo = Editor.OpenUndoGroup ()) {
+ SafeUpdateIndentEngine (Editor.CaretOffset);
- if (key == Gdk.Key.Return && modifier == Gdk.ModifierType.ControlMask) {
- FixLineStart (textEditorData, stateTracker, textEditorData.Caret.Line + 1);
+ if (descriptor.SpecialKey == SpecialKey.Return && descriptor.ModifierKeys == ModifierKeys.Control) {
+ FixLineStart (Editor, stateTracker, Editor.CaretLine + 1);
} else {
- if (!(oldLine == textEditorData.Caret.Line + 1 && lastCharInserted == '\n') && (oldBufLen != textEditorData.Length || lastCharInserted != '\0')) {
+ if (!(oldLine == Editor.CaretLine + 1 && lastCharInserted == '\n') && (oldBufLen != Editor.Length || lastCharInserted != '\0')) {
DoPostInsertionSmartIndent (lastCharInserted, out reIndent);
} else {
reIndent = lastCharInserted == '\n';
@@ -505,67 +474,121 @@ namespace MonoDevelop.CSharp.Formatting
//N.B. if the engine says we need to reindent, make sure that it's because a char was
//inserted rather than just updating the stack due to moving around
- SafeUpdateIndentEngine (textEditorData.Caret.Offset);
+ SafeUpdateIndentEngine (Editor.CaretOffset);
// Automatically reindent in text link mode will cause the mode exiting, therefore we need to prevent that.
- automaticReindent = (stateTracker.NeedsReindent && lastCharInserted != '\0') && !(textEditorData.CurrentMode is TextLinkEditMode);
- if (key == Gdk.Key.Return && (reIndent || automaticReindent)) {
- if (textEditorData.Options.IndentStyle == IndentStyle.Virtual) {
- if (textEditorData.GetLine (textEditorData.Caret.Line).Length == 0)
- textEditorData.Caret.Column = textEditorData.IndentationTracker.GetVirtualIndentationColumn (textEditorData.Caret.Location);
+ automaticReindent = (stateTracker.NeedsReindent && lastCharInserted != '\0') && Editor.EditMode == EditMode.Edit;
+ if (descriptor.SpecialKey == SpecialKey.Return && (reIndent || automaticReindent)) {
+ if (Editor.Options.IndentStyle == IndentStyle.Virtual) {
+ if (Editor.GetLine (Editor.CaretLine).Length == 0)
+ Editor.CaretColumn = Editor.GetVirtualIndentationColumn (Editor.CaretLine);
} else {
DoReSmartIndent ();
}
}
}
+
const string reindentChars = ";){}";
- if (reIndent || key != Gdk.Key.Return && key != Gdk.Key.Tab && automaticReindent && reindentChars.Contains (keyChar)) {
- using (var undo = textEditorData.OpenUndoGroup ()) {
+ if (reIndent || descriptor.SpecialKey != SpecialKey.Return && descriptor.SpecialKey != SpecialKey.Tab && automaticReindent && reindentChars.Contains (descriptor.KeyChar)) {
+ using (var undo = Editor.OpenUndoGroup ()) {
DoReSmartIndent ();
}
}
- if (!skipFormatting && !(stateTracker.IsInsideComment || stateTracker.IsInsideString)) {
- if (keyChar == ';' || keyChar == '}') {
- using (var undo = textEditorData.OpenUndoGroup ()) {
- if (OnTheFlyFormatting && textEditorData != null && !(textEditorData.CurrentMode is TextLinkEditMode) && !(textEditorData.CurrentMode is InsertionCursorEditMode)) {
- OnTheFlyFormatter.FormatStatmentAt (Document, textEditorData.Caret.Location);
- }
- }
- }
- }
-
- SafeUpdateIndentEngine (textEditorData.Caret.Offset);
+ HandleOnTheFlyFormatting (descriptor);
+ SafeUpdateIndentEngine (Editor.CaretOffset);
lastCharInserted = '\0';
- CheckXmlCommentCloseTag (keyChar);
+ CheckXmlCommentCloseTag (descriptor.KeyChar);
return retval;
}
- if (textEditorData.Options.IndentStyle == IndentStyle.Auto && DefaultSourceEditorOptions.Instance.TabIsReindent && key == Gdk.Key.Tab) {
- bool retval = base.KeyPress (key, keyChar, modifier);
+ if (Editor.Options.IndentStyle == IndentStyle.Auto && DefaultSourceEditorOptions.Instance.TabIsReindent && descriptor.SpecialKey == SpecialKey.Tab) {
+ bool retval = base.KeyPress (descriptor);
DoReSmartIndent ();
- CheckXmlCommentCloseTag (keyChar);
+ CheckXmlCommentCloseTag (descriptor.KeyChar);
return retval;
}
//pass through to the base class, which actually inserts the character
//and calls HandleCodeCompletion etc to handles completion
- var result = base.KeyPress (key, keyChar, modifier);
+ var result = base.KeyPress (descriptor);
- if (!indentationDisabled && (key == Gdk.Key.Return || key == Gdk.Key.KP_Enter)) {
+ if (!indentationDisabled && (descriptor.SpecialKey == SpecialKey.Return)) {
DoReSmartIndent ();
}
- CheckXmlCommentCloseTag (keyChar);
+ CheckXmlCommentCloseTag (descriptor.KeyChar);
- if (!skipFormatting && keyChar == '}')
- RunFormatter (new DocumentLocation (textEditorData.Caret.Location.Line, textEditorData.Caret.Location.Column));
+ HandleOnTheFlyFormatting (descriptor);
+
return result;
}
- static bool IsSemicolonalreadyPlaced (TextEditorData data, int caretOffset)
+ void HandleOnTheFlyFormatting (KeyDescriptor descriptor)
+ {
+ if (descriptor.KeyChar == '{')
+ return;
+ SafeUpdateIndentEngine (Editor.CaretOffset);
+ bool skipFormatting = stateTracker.IsInsideOrdinaryCommentOrString || stateTracker.IsInsidePreprocessorDirective;
+ if (!skipFormatting && !(stateTracker.IsInsideComment || stateTracker.IsInsideString)) {
+ if (DocumentContext.ParsedDocument == null || DocumentContext.ParsedDocument.GetAst<SemanticModel> () == null)
+ return;
+ var document = DocumentContext.AnalysisDocument;
+ if (document == null)
+ return;
+ if (!skipFormatting && service.SupportsFormattingOnTypedCharacter (document, descriptor.KeyChar)) {
+ var caretPosition = Editor.CaretOffset;
+ var token = CSharpEditorFormattingService.GetTokenBeforeTheCaretAsync (document, caretPosition, default(CancellationToken)).Result;
+ if (token.IsMissing || !service.ValidSingleOrMultiCharactersTokenKind (descriptor.KeyChar, token.Kind ()) || token.IsKind (SyntaxKind.EndOfFileToken, SyntaxKind.None))
+ return;
+ if (CSharpEditorFormattingService.TokenShouldNotFormatOnTypeChar (token))
+ return;
+ using (var undo = Editor.OpenUndoGroup ()) {
+ if (OnTheFlyFormatting && Editor != null && Editor.EditMode == EditMode.Edit) {
+ OnTheFlyFormatter.FormatStatmentAt (Editor, DocumentContext, Editor.CaretLocation);
+ }
+ }
+ }
+ }
+ if (OnTheFlyFormatting && descriptor.SpecialKey == SpecialKey.Return) {
+ try {
+ FormatOnReturn ();
+ } catch (Exception e) {
+ LoggingService.LogError ("Exception while formatting", e);
+ }
+ }
+ }
+
+ async void FormatOnReturn (CancellationToken cancellationToken = default(CancellationToken))
+ {
+ var document = DocumentContext.AnalysisDocument;
+ if (document == null)
+ return;
+ var caretPosition = Editor.CaretOffset;
+ var token = await CSharpEditorFormattingService.GetTokenBeforeTheCaretAsync(document, caretPosition, cancellationToken).ConfigureAwait(false);
+ if (token.IsMissing)
+ return;
+
+ string text = null;
+ if (service.IsInvalidToken(token, ref text))
+ return;
+ // Check to see if the token is ')' and also the parent is a using statement. If not, bail
+ if (CSharpEditorFormattingService.TokenShouldNotFormatOnReturn(token))
+ return;
+ var tokenRange = FormattingRangeHelper.FindAppropriateRange(token);
+ if (tokenRange == null || !tokenRange.HasValue || tokenRange.Value.Item1.Equals(tokenRange.Value.Item2))
+ return;
+ var value = tokenRange.Value;
+ using (var undo = Editor.OpenUndoGroup ()) {
+ OnTheFlyFormatter.Format (Editor, DocumentContext, value.Item1.SpanStart, value.Item2.Span.End);
+ }
+ }
+
+ CSharpEditorFormattingService service = new CSharpEditorFormattingService ();
+
+ static bool IsSemicolonalreadyPlaced (IReadonlyTextDocument data, int caretOffset)
{
for (int pos2 = caretOffset - 1; pos2-- > 0;) {
- var ch2 = data.Document.GetCharAt (pos2);
+ var ch2 = data.GetCharAt (pos2);
if (ch2 == ';') {
return true;
}
@@ -575,7 +598,7 @@ namespace MonoDevelop.CSharp.Formatting
return false;
}
- public static bool GuessSemicolonInsertionOffset (TextEditorData data, ISegment curLine, int caretOffset, out int outOffset)
+ public static bool GuessSemicolonInsertionOffset (IReadonlyTextDocument data, MonoDevelop.Core.Text.ISegment curLine, int caretOffset, out int outOffset)
{
int lastNonWsOffset = caretOffset;
char lastNonWsChar = '\0';
@@ -598,7 +621,7 @@ namespace MonoDevelop.CSharp.Formatting
var offset = curLine.Offset;
string lineText = data.GetTextAt (caretOffset, max - caretOffset);
- var lexer = new CSharpCompletionEngineBase.MiniLexer (lineText);
+ var lexer = new ICSharpCode.NRefactory.CSharp.Completion.CSharpCompletionEngineBase.MiniLexer (lineText);
lexer.Parse ((ch, i) => {
if (lexer.IsInSingleComment || lexer.IsInMultiLineComment)
return true;
@@ -619,13 +642,12 @@ namespace MonoDevelop.CSharp.Formatting
return true;
}
- static char TranslateKeyCharForIndenter (Gdk.Key key, char keyChar, char docChar)
+ static char TranslateKeyCharForIndenter (SpecialKey key, char keyChar, char docChar)
{
switch (key) {
- case Gdk.Key.Return:
- case Gdk.Key.KP_Enter:
+ case SpecialKey.Return:
return '\n';
- case Gdk.Key.Tab:
+ case SpecialKey.Tab:
return '\t';
default:
if (docChar == keyChar)
@@ -637,14 +659,14 @@ namespace MonoDevelop.CSharp.Formatting
// removes "\s*\+\s*" patterns (used for special behaviour inside strings)
void HandleStringConcatinationDeletion (int start, int end)
{
- if (start < 0 || end >= textEditorData.Length || textEditorData.IsSomethingSelected)
+ if (start < 0 || end >= Editor.Length || Editor.IsSomethingSelected)
return;
- char ch = textEditorData.GetCharAt (start);
+ char ch = Editor.GetCharAt (start);
if (ch == '"') {
int sgn = Math.Sign (end - start);
bool foundPlus = false;
- for (int max = start + sgn; max != end && max >= 0 && max < textEditorData.Length; max += sgn) {
- ch = textEditorData.GetCharAt (max);
+ for (int max = start + sgn; max != end && max >= 0 && max < Editor.Length; max += sgn) {
+ ch = Editor.GetCharAt (max);
if (Char.IsWhiteSpace (ch))
continue;
if (ch == '+') {
@@ -655,11 +677,11 @@ namespace MonoDevelop.CSharp.Formatting
if (!foundPlus)
break;
if (sgn < 0) {
- textEditorData.Remove (max, start - max);
- textEditorData.Caret.Offset = max + 1;
+ Editor.RemoveText (max, start - max);
+ Editor.CaretOffset = max + 1;
} else {
- textEditorData.Remove (start + sgn, max - start);
- textEditorData.Caret.Offset = start;
+ Editor.RemoveText (start + sgn, max - start);
+ Editor.CaretOffset = start;
}
break;
} else {
@@ -669,23 +691,23 @@ namespace MonoDevelop.CSharp.Formatting
}
}
- void DoPreInsertionSmartIndent (Gdk.Key key)
+ void DoPreInsertionSmartIndent (SpecialKey key)
{
switch (key) {
- case Gdk.Key.BackSpace:
- SafeUpdateIndentEngine (textEditorData.Caret.Offset);
- HandleStringConcatinationDeletion (textEditorData.Caret.Offset - 1, 0);
+ case SpecialKey.BackSpace:
+ SafeUpdateIndentEngine (Editor.CaretOffset);
+ HandleStringConcatinationDeletion (Editor.CaretOffset - 1, 0);
break;
- case Gdk.Key.Delete:
- SafeUpdateIndentEngine (textEditorData.Caret.Offset);
- HandleStringConcatinationDeletion (textEditorData.Caret.Offset, textEditorData.Length);
+ case SpecialKey.Delete:
+ SafeUpdateIndentEngine (Editor.CaretOffset);
+ HandleStringConcatinationDeletion (Editor.CaretOffset, Editor.Length);
break;
}
}
//special handling for certain characters just inserted , for comments etc
void DoPostInsertionSmartIndent (char charInserted, out bool reIndent)
{
- SafeUpdateIndentEngine (textEditorData.Caret.Offset);
+ SafeUpdateIndentEngine (Editor.CaretOffset);
reIndent = false;
switch (charInserted) {
case '}':
@@ -693,7 +715,7 @@ namespace MonoDevelop.CSharp.Formatting
reIndent = true;
break;
case '\n':
- if (FixLineStart (textEditorData, stateTracker, stateTracker.Location.Line))
+ if (FixLineStart (Editor, stateTracker, Editor.OffsetToLineNumber (stateTracker.Offset)))
return;
//newline always reindents unless it's had special handling
reIndent = true;
@@ -703,17 +725,17 @@ namespace MonoDevelop.CSharp.Formatting
internal bool wasInStringLiteral;
- public bool FixLineStart (TextEditorData textEditorData, IStateMachineIndentEngine stateTracker, int lineNumber)
+ public bool FixLineStart (TextEditor textEditorData, ICSharpCode.NRefactory6.CSharp.IStateMachineIndentEngine stateTracker, int lineNumber)
{
- if (lineNumber > DocumentLocation.MinLine) {
- DocumentLine line = textEditorData.Document.GetLine (lineNumber);
+ if (lineNumber > 1) {
+ var line = textEditorData.GetLine (lineNumber);
if (line == null)
return false;
- DocumentLine prevLine = textEditorData.Document.GetLine (lineNumber - 1);
+ var prevLine = textEditorData.GetLine (lineNumber - 1);
if (prevLine == null)
return false;
- string trimmedPreviousLine = textEditorData.Document.GetTextAt (prevLine).TrimStart ();
+ string trimmedPreviousLine = textEditorData.GetTextAt (prevLine).TrimStart ();
//xml doc comments
//check previous line was a doc comment
@@ -723,13 +745,13 @@ namespace MonoDevelop.CSharp.Formatting
return false;
//check that the newline command actually inserted a newline
textEditorData.EnsureCaretIsNotVirtual ();
- var nextLineSegment = textEditorData.Document.GetLine (lineNumber + 1);
- string nextLine = nextLineSegment != null ? textEditorData.Document.GetTextAt (nextLineSegment).TrimStart () : "";
+ var nextLineSegment = textEditorData.GetLine (lineNumber + 1);
+ string nextLine = nextLineSegment != null ? textEditorData.GetTextAt (nextLineSegment).TrimStart () : "";
if (trimmedPreviousLine.Length > "///".Length || nextLine.StartsWith ("///", StringComparison.Ordinal)) {
- var insertionPoint = textEditorData.Caret.Offset;
- int inserted = textEditorData.Insert (insertionPoint, "/// ");
- textEditorData.Caret.Offset = insertionPoint + inserted;
+ var insertionPoint = textEditorData.CaretOffset;
+ textEditorData.InsertText (insertionPoint, "/// ");
+ textEditorData.CaretOffset = insertionPoint + "/// ".Length;
return true;
}
//multi-line comments
@@ -746,22 +768,22 @@ namespace MonoDevelop.CSharp.Formatting
commentPrefix = "*";
}
- int indentSize = line.GetIndentation (textEditorData.Document).Length;
- var insertedText = prevLine.GetIndentation (textEditorData.Document) + commentPrefix;
- textEditorData.Replace (line.Offset, indentSize, insertedText);
- textEditorData.Caret.Offset = line.Offset + insertedText.Length;
+ int indentSize = line.GetIndentation (textEditorData).Length;
+ var insertedText = prevLine.GetIndentation (textEditorData) + commentPrefix;
+ textEditorData.ReplaceText (line.Offset, indentSize, insertedText);
+ textEditorData.CaretOffset = line.Offset + insertedText.Length;
return true;
} else if (wasInStringLiteral) {
- var lexer = new CSharpCompletionEngineBase.MiniLexer (textEditorData.Document.GetTextAt (0, prevLine.EndOffset).TrimEnd ());
+ var lexer = new ICSharpCode.NRefactory.CSharp.Completion.CSharpCompletionEngineBase.MiniLexer (textEditorData.GetTextAt (0, prevLine.EndOffset).TrimEnd ());
lexer.Parse ();
if (!lexer.IsInString)
return false;
textEditorData.EnsureCaretIsNotVirtual ();
- textEditorData.Insert (prevLine.Offset + prevLine.Length, "\" +");
+ textEditorData.InsertText (prevLine.Offset + prevLine.Length, "\" +");
- int indentSize = textEditorData.Caret.Offset - line.Offset;
- var insertedText = prevLine.GetIndentation (textEditorData.Document) + (trimmedPreviousLine.StartsWith ("\"", StringComparison.Ordinal) ? "" : "\t") + "\"";
- textEditorData.Replace (line.Offset, indentSize, insertedText);
+ int indentSize = textEditorData.CaretOffset - line.Offset;
+ var insertedText = prevLine.GetIndentation (textEditorData) + (trimmedPreviousLine.StartsWith ("\"", StringComparison.Ordinal) ? "" : "\t") + "\"";
+ textEditorData.ReplaceText (line.Offset, indentSize, insertedText);
return true;
}
}
@@ -770,7 +792,7 @@ namespace MonoDevelop.CSharp.Formatting
//does re-indenting and cursor positioning
void DoReSmartIndent ()
{
- DoReSmartIndent (textEditorData.Caret.Offset);
+ DoReSmartIndent (Editor.CaretOffset);
}
void DoReSmartIndent (int cursor)
@@ -779,26 +801,26 @@ namespace MonoDevelop.CSharp.Formatting
if (stateTracker.LineBeganInsideVerbatimString || stateTracker.LineBeganInsideMultiLineComment)
return;
if (DefaultSourceEditorOptions.Instance.IndentStyle == IndentStyle.Auto) {
- textEditorData.FixVirtualIndentation ();
+ Editor.FixVirtualIndentation ();
return;
}
- var line = textEditorData.Document.GetLineByOffset (cursor);
+ var line = Editor.GetLineByOffset (cursor);
// Get context to the end of the line w/o changing the main engine's state
var curTracker = stateTracker.Clone ();
try {
for (int max = cursor; max < line.EndOffset; max++) {
- curTracker.Push (textEditorData.Document.GetCharAt (max));
+ curTracker.Push (Editor.GetCharAt (max));
}
} catch (Exception e) {
LoggingService.LogError ("Exception during indentation", e);
}
int pos = line.Offset;
- string curIndent = line.GetIndentation (textEditorData.Document);
+ string curIndent = line.GetIndentation (Editor);
int nlwsp = curIndent.Length;
int offset = cursor > pos + nlwsp ? cursor - (pos + nlwsp) : 0;
- if (!stateTracker.LineBeganInsideMultiLineComment || (nlwsp < line.LengthIncludingDelimiter && textEditorData.Document.GetCharAt (line.Offset + nlwsp) == '*')) {
+ if (!stateTracker.LineBeganInsideMultiLineComment || (nlwsp < line.LengthIncludingDelimiter && Editor.GetCharAt (line.Offset + nlwsp) == '*')) {
// Possibly replace the indent
string newIndent = curTracker.ThisLineIndent;
int newIndentLength = newIndent.Length;
@@ -807,9 +829,9 @@ namespace MonoDevelop.CSharp.Formatting
if (pos < CompletionWindowManager.CodeCompletionContext.TriggerOffset)
CompletionWindowManager.CodeCompletionContext.TriggerOffset -= nlwsp;
}
-
- newIndentLength = textEditorData.Replace (pos, nlwsp, newIndent);
- textEditorData.Document.CommitLineUpdate (textEditorData.Caret.Line);
+ newIndentLength = newIndent.Length;
+ Editor.ReplaceText (pos, nlwsp, newIndent);
+ //textEditorData.CommitLineUpdate (textEditorData.CaretLine);
CompletionWindowManager.HideWindow ();
}
pos += newIndentLength;
@@ -819,7 +841,7 @@ namespace MonoDevelop.CSharp.Formatting
pos += offset;
- textEditorData.FixVirtualIndentation ();
+ Editor.FixVirtualIndentation ();
}
/*
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/CSharpTextPasteHandler.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/CSharpTextPasteHandler.cs
new file mode 100644
index 0000000000..cc4d6f58c6
--- /dev/null
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/CSharpTextPasteHandler.cs
@@ -0,0 +1,90 @@
+//
+// TextPasteIndentEngine.cs
+//
+// Author:
+// Mike Krüger <mkrueger@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+using System;
+using MonoDevelop.Ide.Editor.Extension;
+using MonoDevelop.Ide.Editor;
+using MonoDevelop.Ide.CodeCompletion;
+using Microsoft.CodeAnalysis.Options;
+using Microsoft.CodeAnalysis.Text;
+
+namespace MonoDevelop.CSharp.Formatting
+{
+ class CSharpTextPasteHandler : TextPasteHandler
+ {
+ readonly ICSharpCode.NRefactory6.CSharp.ITextPasteHandler engine;
+ readonly CSharpTextEditorIndentation indent;
+
+ public CSharpTextPasteHandler (CSharpTextEditorIndentation indent, ICSharpCode.NRefactory6.CSharp.IStateMachineIndentEngine decoratedEngine, OptionSet formattingOptions)
+ {
+ this.engine = new ICSharpCode.NRefactory6.CSharp.TextPasteIndentEngine (decoratedEngine, formattingOptions);
+ this.indent = indent;
+ }
+
+ public override string FormatPlainText (int offset, string text, byte[] copyData)
+ {
+ return engine.FormatPlainText (indent.Editor, offset, text, copyData);
+ }
+
+ public override byte[] GetCopyData (int offset, int length)
+ {
+ return engine.GetCopyData (indent.Editor, new TextSpan (offset, length));
+ }
+
+ public override void PostFomatPastedText (int insertionOffset, int insertedChars)
+ {
+ if (indent.Editor.Options.IndentStyle == IndentStyle.None ||
+ indent.Editor.Options.IndentStyle == IndentStyle.Auto)
+ return;
+
+ // Just correct the start line of the paste operation - the text is already indented.
+ var curLine = indent.Editor.GetLineByOffset (insertionOffset);
+ var curLineOffset = curLine.Offset;
+ indent.SafeUpdateIndentEngine (curLineOffset);
+ if (!indent.stateTracker.IsInsideOrdinaryCommentOrString) {
+ int pos = curLineOffset;
+ string curIndent = curLine.GetIndentation (indent.Editor);
+ int nlwsp = curIndent.Length;
+
+ if (!indent.stateTracker.LineBeganInsideMultiLineComment || (nlwsp < curLine.LengthIncludingDelimiter && indent.Editor.GetCharAt (curLineOffset + nlwsp) == '*')) {
+ // Possibly replace the indent
+ indent.SafeUpdateIndentEngine (curLineOffset + curLine.Length);
+ string newIndent = indent.stateTracker.ThisLineIndent;
+ if (newIndent != curIndent) {
+ if (CompletionWindowManager.IsVisible) {
+ if (pos < CompletionWindowManager.CodeCompletionContext.TriggerOffset)
+ CompletionWindowManager.CodeCompletionContext.TriggerOffset -= nlwsp;
+ }
+ indent.Editor.ReplaceText (pos, nlwsp, newIndent);
+ // textEditorData.Document.CommitLineUpdate (textEditorData.CaretLine);
+ }
+ }
+ }
+ indent.Editor.FixVirtualIndentation ();
+ }
+
+ }
+}
+
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/NewFormattingProfileDialog.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/NewFormattingProfileDialog.cs
index c9d37eaa91..5794cf9fad 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/NewFormattingProfileDialog.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/NewFormattingProfileDialog.cs
@@ -36,14 +36,14 @@ namespace MonoDevelop.CSharp.Formatting
}
- public CSharpFormattingPolicy InitializeFrom {
+ internal CSharpFormattingPolicy InitializeFrom {
get {
return policies[comboboxInitFrom.Active];
}
}
readonly List<CSharpFormattingPolicy> policies;
- public NewFormattingProfileDialog (List<CSharpFormattingPolicy> policies)
+ internal NewFormattingProfileDialog (List<CSharpFormattingPolicy> policies)
{
// ReSharper disable once DoNotCallOverridableMethodsInConstructor
this.Build ();
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/OnTheFlyFormatter.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/OnTheFlyFormatter.cs
index e8bb9b6b7d..239b50ce89 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/OnTheFlyFormatter.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/OnTheFlyFormatter.cs
@@ -23,244 +23,106 @@
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-using Mono.TextEditor;
+
using MonoDevelop.Ide;
using System;
using System.Collections.Generic;
using MonoDevelop.Projects.Policies;
-using ICSharpCode.NRefactory.CSharp;
-using System.Text;
-using ICSharpCode.NRefactory;
-using ICSharpCode.NRefactory.TypeSystem;
-using ICSharpCode.NRefactory.CSharp.TypeSystem;
+using System.Linq;
using MonoDevelop.CSharp.Completion;
using MonoDevelop.CSharp.Refactoring;
using MonoDevelop.CSharp.Parser;
using MonoDevelop.Core;
-using ICSharpCode.NRefactory.CSharp.Completion;
+using MonoDevelop.Ide.Editor;
+using Microsoft.CodeAnalysis.Formatting;
+using Microsoft.CodeAnalysis.Text;
+using MonoDevelop.Ide.Gui.Content;
+using Microsoft.CodeAnalysis.CSharp;
namespace MonoDevelop.CSharp.Formatting
{
static class OnTheFlyFormatter
{
- public static void Format (MonoDevelop.Ide.Gui.Document data)
- {
- Format (data, 0, data.Editor.Length);
- }
-
- public static void Format (MonoDevelop.Ide.Gui.Document data, TextLocation location)
+ public static void Format (TextEditor editor, DocumentContext context)
{
- Format (data, location, location, false);
- }
-
- public static void Format (MonoDevelop.Ide.Gui.Document data, TextLocation startLocation, TextLocation endLocation, bool exact = true)
+ Format (editor, context, 0, editor.Length);
+ }
+
+ // public static void Format (TextEditor editor, DocumentContext context, TextLocation location)
+ // {
+ // Format (editor, context, location, location, false);
+ // }
+ //
+ // public static void Format (TextEditor editor, DocumentContext context, TextLocation startLocation, TextLocation endLocation, bool exact = true)
+ // {
+ // Format (editor, context, editor.LocationToOffset (startLocation), editor.LocationToOffset (endLocation), exact);
+ // }
+
+ public static void Format (TextEditor editor, DocumentContext context, int startOffset, int endOffset, bool exact = true)
{
- Format (data, data.Editor.LocationToOffset (startLocation), data.Editor.LocationToOffset (endLocation), exact);
- }
-
- public static void Format (MonoDevelop.Ide.Gui.Document data, int startOffset, int endOffset, bool exact = true)
- {
- var policyParent = data.Project != null ? data.Project.Policies : PolicyService.DefaultPolicies;
+ var policyParent = context.Project != null ? context.Project.Policies : PolicyService.DefaultPolicies;
var mimeTypeChain = DesktopService.GetMimeTypeInheritanceChain (CSharpFormatter.MimeType);
- Format (policyParent, mimeTypeChain, data, startOffset, endOffset, exact);
+ Format (policyParent, mimeTypeChain, editor, context, startOffset, endOffset, exact);
}
- public static void FormatStatmentAt (MonoDevelop.Ide.Gui.Document data, DocumentLocation location)
+ public static void FormatStatmentAt (TextEditor editor, DocumentContext context, MonoDevelop.Ide.Editor.DocumentLocation location)
{
- var offset = data.Editor.LocationToOffset (location);
- var policyParent = data.Project != null ? data.Project.Policies : PolicyService.DefaultPolicies;
+ var offset = editor.LocationToOffset (location);
+ var policyParent = context.Project != null ? context.Project.Policies : PolicyService.DefaultPolicies;
var mimeTypeChain = DesktopService.GetMimeTypeInheritanceChain (CSharpFormatter.MimeType);
- Format (policyParent, mimeTypeChain, data, offset, offset, false, true);
- }
-
-
- static string BuildStub (MonoDevelop.Ide.Gui.Document data, CSharpCompletionTextEditorExtension.TypeSystemTreeSegment seg, int endOffset, out int memberStartOffset)
- {
- var pf = data.ParsedDocument.ParsedFile as CSharpUnresolvedFile;
- if (pf == null) {
- memberStartOffset = 0;
- return null;
- }
-
- var sb = new StringBuilder ();
-
- int closingBrackets = 0;
- // use the member start location to determine the using scope, because this information is in sync, the position in
- // the file may have changed since last parse run (we have up 2 date locations from the type segment tree).
- var scope = pf.GetUsingScope (seg.Entity.Region.Begin);
-
- while (scope != null && !string.IsNullOrEmpty (scope.NamespaceName)) {
- // Hack: some syntax errors lead to invalid namespace names.
- if (scope.NamespaceName.EndsWith ("<invalid>", StringComparison.Ordinal)) {
- scope = scope.Parent;
- continue;
- }
- sb.Append ("namespace Stub {");
- sb.Append (data.Editor.EolMarker);
- closingBrackets++;
- while (scope.Parent != null && scope.Parent.Region == scope.Region)
- scope = scope.Parent;
- scope = scope.Parent;
- }
-
- var parent = seg.Entity.DeclaringTypeDefinition;
- while (parent != null) {
- sb.Append ("class " + parent.Name + " {");
- sb.Append (data.Editor.EolMarker);
- closingBrackets++;
- parent = parent.DeclaringTypeDefinition;
- }
-
- var segmentLine = data.Editor.GetLineByOffset (seg.Offset);
- memberStartOffset = sb.Length + seg.Offset - segmentLine.Offset;
- var text = data.Editor.GetTextBetween (Math.Max (0, segmentLine.Offset), endOffset);
- sb.Append (text);
- var lex = new CSharpCompletionEngineBase.MiniLexer (text);
- lex.Parse ((ch,i) => {
- if (lex.IsInString || lex.IsInChar || lex.IsInVerbatimString || lex.IsInSingleComment || lex.IsInMultiLineComment || lex.IsInPreprocessorDirective)
- return false;
- if (ch =='{') {
- closingBrackets++;
- } else if (ch =='}') {
- closingBrackets--;
- }
- return false;
- });
-
-
- // Insert at least caret column eol markers otherwise the reindent of the generated closing bracket
- // could interfere with the current indentation.
- var endLocation = data.Editor.OffsetToLocation (endOffset);
- for (int i = 0; i <= endLocation.Column; i++) {
- sb.Append (data.Editor.EolMarker);
- }
- sb.Append (data.Editor.EolMarker);
- sb.Append (new string ('}', closingBrackets));
- return sb.ToString ();
+ Format (policyParent, mimeTypeChain, editor, context, offset, offset, false, true);
}
-
- static FormattingChanges GetFormattingChanges (PolicyContainer policyParent, IEnumerable<string> mimeTypeChain, MonoDevelop.Ide.Gui.Document document, string input, DomRegion formattingRegion, ref int formatStartOffset, ref int formatLength, bool formatLastStatementOnly)
- {
- using (var stubData = TextEditorData.CreateImmutable (input)) {
- stubData.Document.FileName = document.FileName;
- var parser = document.HasProject ? new CSharpParser (TypeSystemParser.GetCompilerArguments (document.Project)) : new CSharpParser ();
- var compilationUnit = parser.Parse (stubData);
- bool hadErrors = parser.HasErrors;
- if (hadErrors) {
- using (var stubData2 = TextEditorData.CreateImmutable (input + "}")) {
- compilationUnit = parser.Parse (stubData2);
- hadErrors = parser.HasErrors;
- }
- }
- // try it out, if the behavior is better when working only with correct code.
- if (hadErrors) {
- return null;
- }
-
- var policy = policyParent.Get<CSharpFormattingPolicy> (mimeTypeChain);
-
- var formattingVisitor = new ICSharpCode.NRefactory.CSharp.CSharpFormatter (policy.CreateOptions (), document.Editor.CreateNRefactoryTextEditorOptions ());
- formattingVisitor.FormattingMode = FormattingMode.Intrusive;
- formattingVisitor.AddFormattingRegion (formattingRegion);
-
- var changes = formattingVisitor.AnalyzeFormatting (stubData.Document, compilationUnit);
-
- if (formatLastStatementOnly) {
- AstNode node = compilationUnit.GetAdjacentNodeAt<Statement> (stubData.OffsetToLocation (formatStartOffset + formatLength - 1));
- if (node != null) {
- while (node.Role == Roles.EmbeddedStatement || node.Role == IfElseStatement.TrueRole || node.Role == IfElseStatement.FalseRole)
- node = node.Parent;
- // include indentation if node starts in new line
- var formatNode = node.GetPrevNode ();
- if (formatNode.Role != Roles.NewLine)
- formatNode = node;
- var start = stubData.LocationToOffset (formatNode.StartLocation);
- if (start > formatStartOffset) {
- var end = stubData.LocationToOffset (node.EndLocation);
- formatStartOffset = start;
- formatLength = end - start;
- }
- }
- }
- return changes;
- }
- }
-
- public static void Format (PolicyContainer policyParent, IEnumerable<string> mimeTypeChain, MonoDevelop.Ide.Gui.Document data, int startOffset, int endOffset, bool exact, bool formatLastStatementOnly = false)
+ static void Format (PolicyContainer policyParent, IEnumerable<string> mimeTypeChain, TextEditor editor, DocumentContext context, int startOffset, int endOffset, bool exact, bool formatLastStatementOnly = false)
{
- if (data.ParsedDocument == null)
- return;
- var ext = data.GetContent<CSharpCompletionTextEditorExtension> ();
- if (ext == null)
- return;
- string text;
- int formatStartOffset, formatLength, realTextDelta;
- DomRegion formattingRegion;
- int startDelta = 1;
+ TextSpan span;
if (exact) {
- text = data.Editor.Text;
- var seg = ext.GetMemberSegmentAt (startOffset);
- var seg2 = ext.GetMemberSegmentAt (endOffset);
- if (seg != null && seg == seg2) {
- var member = seg.Entity;
- if (member == null || member.Region.IsEmpty || member.BodyRegion.End.IsEmpty)
- return;
-
- text = BuildStub (data, seg, endOffset, out formatStartOffset);
- startDelta = startOffset - seg.Offset;
- formatLength = endOffset - startOffset + startDelta;
- realTextDelta = seg.Offset - formatStartOffset;
- formattingRegion = new DomRegion (data.Editor.OffsetToLocation (formatStartOffset), data.Editor.OffsetToLocation (endOffset));
- } else {
- formatStartOffset = startOffset;
- formatLength = endOffset - startOffset;
- realTextDelta = 0;
- formattingRegion = new DomRegion (data.Editor.OffsetToLocation (startOffset), data.Editor.OffsetToLocation (endOffset));
- }
+ span = new TextSpan (startOffset, endOffset - startOffset);
} else {
- var seg = ext.GetMemberSegmentAt (startOffset - 1);
- if (seg == null) {
- return;
- }
- var member = seg.Entity;
- if (member == null)
- return;
-
- // Build stub
- text = BuildStub (data, seg, startOffset, out formatStartOffset);
- formattingRegion = new DomRegion (data.Editor.OffsetToLocation (formatStartOffset), data.Editor.OffsetToLocation (endOffset));
-
- formatLength = endOffset - seg.Offset;
- realTextDelta = seg.Offset - formatStartOffset;
+ span = new TextSpan (0, endOffset);
}
- // Get changes from formatting visitor
- var changes = GetFormattingChanges (policyParent, mimeTypeChain, data, text, formattingRegion, ref formatStartOffset, ref formatLength, formatLastStatementOnly);
- if (changes == null)
- return;
- // Do the actual formatting
-// var originalVersion = data.Editor.Document.Version;
+ var analysisDocument = context.AnalysisDocument;
+ if (analysisDocument == null)
+ return;
- using (var undo = data.Editor.OpenUndoGroup (OperationType.Format)) {
+ using (var undo = editor.OpenUndoGroup (/*OperationType.Format*/)) {
try {
- changes.ApplyChanges (formatStartOffset + startDelta, Math.Max (0, formatLength - startDelta - 1), delegate (int replaceOffset, int replaceLength, string insertText) {
- int translatedOffset = realTextDelta + replaceOffset;
- data.Editor.Document.CommitLineUpdate (data.Editor.OffsetToLineNumber (translatedOffset));
- data.Editor.Replace (translatedOffset, replaceLength, insertText);
- }, (replaceOffset, replaceLength, insertText) => {
- int translatedOffset = realTextDelta + replaceOffset;
- if (translatedOffset < 0 || translatedOffset + replaceLength > data.Editor.Length || replaceLength < 0)
- return true;
- return data.Editor.GetTextAt (translatedOffset, replaceLength) == insertText;
- });
+ var syntaxTree = analysisDocument.GetSyntaxTreeAsync ().Result;
+
+ if (formatLastStatementOnly) {
+ var root = syntaxTree.GetRoot ();
+ var token = root.FindToken (endOffset);
+ var tokens = ICSharpCode.NRefactory6.CSharp.FormattingRangeHelper.FindAppropriateRange (token);
+ if (tokens.HasValue) {
+ span = new TextSpan (tokens.Value.Item1.SpanStart, tokens.Value.Item2.Span.End - tokens.Value.Item1.SpanStart);
+ } else {
+ var parent = token.Parent;
+ if (parent != null)
+ span = parent.FullSpan;
+ }
+ }
+
+ var policy = policyParent.Get<CSharpFormattingPolicy> (mimeTypeChain);
+ var textPolicy = policyParent.Get<TextStylePolicy> (mimeTypeChain);
+
+ var doc = Formatter.FormatAsync (analysisDocument, span, policy.CreateOptions (textPolicy)).Result;
+ var newTree = doc.GetSyntaxTreeAsync ().Result;
+ var caretOffset = editor.CaretOffset;
+ foreach (var change in newTree.GetChanges (syntaxTree).OrderByDescending (c => c.Span.Start) ) {
+ if (!exact && change.Span.Start >= caretOffset)
+ continue;
+ var newText = change.NewText;
+ if (editor.EolMarker != "\r\n")
+ newText = newText.Replace ("\r", "");
+ editor.ReplaceText (change.Span.Start, change.Span.Length, newText);
+ }
+ if (editor.CaretColumn == 1)
+ editor.CaretColumn = editor.GetVirtualIndentationColumn (editor.CaretLine);
} catch (Exception e) {
LoggingService.LogError ("Error in on the fly formatter", e);
}
-
-// var currentVersion = data.Editor.Document.Version;
-// data.Editor.Caret.Offset = originalVersion.MoveOffsetTo (currentVersion, caretOffset, ICSharpCode.NRefactory.Editor.AnchorMovementType.Default);
}
}
}
-} \ No newline at end of file
+}
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/policies/AllmanCSharpPolicy.xml b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/policies/AllmanCSharpPolicy.xml
index be1a18f6b7..f346f57e49 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/policies/AllmanCSharpPolicy.xml
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/policies/AllmanCSharpPolicy.xml
@@ -27,138 +27,48 @@ THE SOFTWARE.
-->
<CSharpFormattingPolicy scope="text/x-csharp" allowDiffSerialize="False">
- <IndentNamespaceBody>True</IndentNamespaceBody>
- <IndentClassBody>True</IndentClassBody>
- <IndentInterfaceBody>True</IndentInterfaceBody>
- <IndentStructBody>True</IndentStructBody>
- <IndentEnumBody>True</IndentEnumBody>
- <IndentMethodBody>True</IndentMethodBody>
- <IndentPropertyBody>True</IndentPropertyBody>
- <IndentEventBody>True</IndentEventBody>
- <IndentBlocks>True</IndentBlocks>
- <IndentSwitchBody>True</IndentSwitchBody>
- <IndentCaseBody>True</IndentCaseBody>
- <IndentBreakStatements>True</IndentBreakStatements>
- <AlignEmbeddedStatements>True</AlignEmbeddedStatements>
- <SimplePropertyFormatting>AllowOneLine</SimplePropertyFormatting>
- <AutoPropertyFormatting>AllowOneLine</AutoPropertyFormatting>
- <NamespaceBraceStyle>NextLine</NamespaceBraceStyle>
- <ClassBraceStyle>NextLine</ClassBraceStyle>
- <InterfaceBraceStyle>NextLine</InterfaceBraceStyle>
- <StructBraceStyle>NextLine</StructBraceStyle>
- <EnumBraceStyle>NextLine</EnumBraceStyle>
- <MethodBraceStyle>NextLine</MethodBraceStyle>
- <AnonymousMethodBraceStyle>NextLine</AnonymousMethodBraceStyle>
- <ConstructorBraceStyle>NextLine</ConstructorBraceStyle>
- <DestructorBraceStyle>NextLine</DestructorBraceStyle>
- <PropertyBraceStyle>NextLine</PropertyBraceStyle>
- <PropertyGetBraceStyle>NextLine</PropertyGetBraceStyle>
- <PropertySetBraceStyle>NextLine</PropertySetBraceStyle>
- <SimpleGetBlockFormatting>AllowOneLine</SimpleGetBlockFormatting>
- <SimpleSetBlockFormatting>AllowOneLine</SimpleSetBlockFormatting>
- <EventBraceStyle>NextLine</EventBraceStyle>
- <EventAddBraceStyle>NextLine</EventAddBraceStyle>
- <EventRemoveBraceStyle>NextLine</EventRemoveBraceStyle>
- <AllowEventAddBlockInline>True</AllowEventAddBlockInline>
- <AllowEventRemoveBlockInline>True</AllowEventRemoveBlockInline>
- <StatementBraceStyle>NextLine</StatementBraceStyle>
- <AllowIfBlockInline>False</AllowIfBlockInline>
- <ElseNewLinePlacement>NewLine</ElseNewLinePlacement>
- <ElseIfNewLinePlacement>SameLine</ElseIfNewLinePlacement>
- <CatchNewLinePlacement>NewLine</CatchNewLinePlacement>
- <FinallyNewLinePlacement>NewLine</FinallyNewLinePlacement>
- <WhileNewLinePlacement>DoNotCare</WhileNewLinePlacement>
- <ArrayInitializerWrapping>DoNotChange</ArrayInitializerWrapping>
- <ArrayInitializerBraceStyle>NextLine</ArrayInitializerBraceStyle>
- <KeepCommentsAtFirstColumn>True</KeepCommentsAtFirstColumn>
- <BeforeMethodDeclarationParentheses>False</BeforeMethodDeclarationParentheses>
- <BetweenEmptyMethodDeclarationParentheses>False</BetweenEmptyMethodDeclarationParentheses>
- <BeforeMethodDeclarationParameterComma>False</BeforeMethodDeclarationParameterComma>
- <AfterMethodDeclarationParameterComma>True</AfterMethodDeclarationParameterComma>
- <WithinMethodDeclarationParentheses>False</WithinMethodDeclarationParentheses>
- <BeforeMethodCallParentheses>False</BeforeMethodCallParentheses>
- <BetweenEmptyMethodCallParentheses>False</BetweenEmptyMethodCallParentheses>
- <BeforeMethodCallParameterComma>False</BeforeMethodCallParameterComma>
- <AfterMethodCallParameterComma>True</AfterMethodCallParameterComma>
- <WithinMethodCallParentheses>False</WithinMethodCallParentheses>
- <BeforeFieldDeclarationComma>False</BeforeFieldDeclarationComma>
- <AfterFieldDeclarationComma>True</AfterFieldDeclarationComma>
- <BeforeLocalVariableDeclarationComma>False</BeforeLocalVariableDeclarationComma>
- <AfterLocalVariableDeclarationComma>True</AfterLocalVariableDeclarationComma>
- <BeforeConstructorDeclarationParentheses>False</BeforeConstructorDeclarationParentheses>
- <BetweenEmptyConstructorDeclarationParentheses>False</BetweenEmptyConstructorDeclarationParentheses>
- <BeforeConstructorDeclarationParameterComma>False</BeforeConstructorDeclarationParameterComma>
- <AfterConstructorDeclarationParameterComma>True</AfterConstructorDeclarationParameterComma>
- <WithinConstructorDeclarationParentheses>False</WithinConstructorDeclarationParentheses>
- <NewLineBeforeConstructorInitializerColon>NewLine</NewLineBeforeConstructorInitializerColon>
- <NewLineAfterConstructorInitializerColon>SameLine</NewLineAfterConstructorInitializerColon>
- <BeforeIndexerDeclarationBracket>True</BeforeIndexerDeclarationBracket>
- <WithinIndexerDeclarationBracket>False</WithinIndexerDeclarationBracket>
- <BeforeIndexerDeclarationParameterComma>False</BeforeIndexerDeclarationParameterComma>
- <AfterIndexerDeclarationParameterComma>True</AfterIndexerDeclarationParameterComma>
- <BeforeDelegateDeclarationParentheses>False</BeforeDelegateDeclarationParentheses>
- <BetweenEmptyDelegateDeclarationParentheses>False</BetweenEmptyDelegateDeclarationParentheses>
- <BeforeDelegateDeclarationParameterComma>False</BeforeDelegateDeclarationParameterComma>
- <AfterDelegateDeclarationParameterComma>False</AfterDelegateDeclarationParameterComma>
- <WithinDelegateDeclarationParentheses>False</WithinDelegateDeclarationParentheses>
- <NewParentheses>False</NewParentheses>
- <IfParentheses>True</IfParentheses>
- <WhileParentheses>True</WhileParentheses>
- <ForParentheses>True</ForParentheses>
- <ForeachParentheses>True</ForeachParentheses>
- <CatchParentheses>True</CatchParentheses>
- <SwitchParentheses>True</SwitchParentheses>
- <LockParentheses>True</LockParentheses>
- <UsingParentheses>True</UsingParentheses>
- <AroundAssignmentParentheses>True</AroundAssignmentParentheses>
- <AroundLogicalOperatorParentheses>True</AroundLogicalOperatorParentheses>
- <AroundEqualityOperatorParentheses>True</AroundEqualityOperatorParentheses>
- <AroundRelationalOperatorParentheses>True</AroundRelationalOperatorParentheses>
- <AroundBitwiseOperatorParentheses>True</AroundBitwiseOperatorParentheses>
- <AroundAdditiveOperatorParentheses>True</AroundAdditiveOperatorParentheses>
- <AroundMultiplicativeOperatorParentheses>True</AroundMultiplicativeOperatorParentheses>
- <AroundShiftOperatorParentheses>True</AroundShiftOperatorParentheses>
- <AroundNullCoalescingOperator>True</AroundNullCoalescingOperator>
- <WithinParentheses>False</WithinParentheses>
- <WithinIfParentheses>False</WithinIfParentheses>
- <WithinWhileParentheses>False</WithinWhileParentheses>
- <WithinForParentheses>False</WithinForParentheses>
- <WithinForEachParentheses>False</WithinForEachParentheses>
- <WithinCatchParentheses>False</WithinCatchParentheses>
- <WithinSwitchParentheses>False</WithinSwitchParentheses>
- <WithinLockParentheses>False</WithinLockParentheses>
- <WithinUsingParentheses>False</WithinUsingParentheses>
- <WithinCastParentheses>False</WithinCastParentheses>
- <WithinSizeOfParentheses>False</WithinSizeOfParentheses>
- <BeforeSizeOfParentheses>False</BeforeSizeOfParentheses>
- <WithinTypeOfParentheses>False</WithinTypeOfParentheses>
- <WithinNewParentheses>False</WithinNewParentheses>
- <BetweenEmptyNewParentheses>False</BetweenEmptyNewParentheses>
- <BeforeNewParameterComma>False</BeforeNewParameterComma>
- <AfterNewParameterComma>True</AfterNewParameterComma>
- <BeforeTypeOfParentheses>False</BeforeTypeOfParentheses>
- <WithinCheckedExpressionParantheses>False</WithinCheckedExpressionParantheses>
- <ConditionalOperatorBeforeConditionSpace>True</ConditionalOperatorBeforeConditionSpace>
- <ConditionalOperatorAfterConditionSpace>True</ConditionalOperatorAfterConditionSpace>
- <ConditionalOperatorBeforeSeparatorSpace>True</ConditionalOperatorBeforeSeparatorSpace>
- <ConditionalOperatorAfterSeparatorSpace>True</ConditionalOperatorAfterSeparatorSpace>
- <SpacesWithinBrackets>False</SpacesWithinBrackets>
- <SpacesBeforeBrackets>False</SpacesBeforeBrackets>
- <BeforeBracketComma>False</BeforeBracketComma>
- <AfterBracketComma>True</AfterBracketComma>
- <SpacesBeforeForSemicolon>False</SpacesBeforeForSemicolon>
- <SpacesAfterForSemicolon>True</SpacesAfterForSemicolon>
- <SpacesAfterTypecast>False</SpacesAfterTypecast>
- <SpacesBeforeArrayDeclarationBrackets>False</SpacesBeforeArrayDeclarationBrackets>
- <BlankLinesBeforeUsings>0</BlankLinesBeforeUsings>
- <BlankLinesAfterUsings>1</BlankLinesAfterUsings>
- <BlankLinesBeforeFirstDeclaration>0</BlankLinesBeforeFirstDeclaration>
- <BlankLinesBetweenTypes>1</BlankLinesBetweenTypes>
- <BlankLinesBetweenFields>0</BlankLinesBetweenFields>
- <BlankLinesBetweenEventFields>0</BlankLinesBetweenEventFields>
- <BlankLinesBetweenMembers>1</BlankLinesBetweenMembers>
- <BlankLinesInsideRegion>1</BlankLinesInsideRegion>
- <BlankLinesAroundRegion>1</BlankLinesAroundRegion>
- <IndentPreprocessorDirectives>True</IndentPreprocessorDirectives>
- <IndentBlocksInsideExpressions>True</IndentBlocksInsideExpressions>
+ <IndentBlock>True</IndentBlock>
+ <IndentBraces>False</IndentBraces>
+ <IndentSwitchSection>True</IndentSwitchSection>
+ <IndentSwitchCaseSection>True</IndentSwitchCaseSection>
+ <LabelPositioning>OneLess</LabelPositioning>
+ <NewLinesForBracesInTypes>True</NewLinesForBracesInTypes>
+ <NewLinesForBracesInMethods>True</NewLinesForBracesInMethods>
+ <NewLinesForBracesInAnonymousMethods>True</NewLinesForBracesInAnonymousMethods>
+ <NewLinesForBracesInControlBlocks>True</NewLinesForBracesInControlBlocks>
+ <NewLinesForBracesInAnonymousTypes>True</NewLinesForBracesInAnonymousTypes>
+ <NewLinesForBracesInObjectInitializers>True</NewLinesForBracesInObjectInitializers>
+ <NewLinesForBracesInLambdaExpressionBody>True</NewLinesForBracesInLambdaExpressionBody>
+ <NewLineForElse>True</NewLineForElse>
+ <NewLineForCatch>True</NewLineForCatch>
+ <NewLineForFinally>True</NewLineForFinally>
+ <NewLineForMembersInObjectInit>True</NewLineForMembersInObjectInit>
+ <NewLineForMembersInAnonymousTypes>True</NewLineForMembersInAnonymousTypes>
+ <NewLineForClausesInQuery>True</NewLineForClausesInQuery>
+ <SpacingAfterMethodDeclarationName>False</SpacingAfterMethodDeclarationName>
+ <SpaceWithinMethodDeclarationParenthesis>False</SpaceWithinMethodDeclarationParenthesis>
+ <SpaceBetweenEmptyMethodDeclarationParentheses>False</SpaceBetweenEmptyMethodDeclarationParentheses>
+ <SpaceAfterMethodCallName>False</SpaceAfterMethodCallName>
+ <SpaceWithinMethodCallParentheses>False</SpaceWithinMethodCallParentheses>
+ <SpaceBetweenEmptyMethodCallParentheses>False</SpaceBetweenEmptyMethodCallParentheses>
+ <SpaceAfterControlFlowStatementKeyword>True</SpaceAfterControlFlowStatementKeyword>
+ <SpaceWithinExpressionParentheses>False</SpaceWithinExpressionParentheses>
+ <SpaceWithinCastParentheses>False</SpaceWithinCastParentheses>
+ <SpaceWithinOtherParentheses>False</SpaceWithinOtherParentheses>
+ <SpaceAfterCast>False</SpaceAfterCast>
+ <SpacesIgnoreAroundVariableDeclaration>False</SpacesIgnoreAroundVariableDeclaration>
+ <SpaceBeforeOpenSquareBracket>False</SpaceBeforeOpenSquareBracket>
+ <SpaceBetweenEmptySquareBrackets>False</SpaceBetweenEmptySquareBrackets>
+ <SpaceWithinSquareBrackets>False</SpaceWithinSquareBrackets>
+ <SpaceAfterColonInBaseTypeDeclaration>True</SpaceAfterColonInBaseTypeDeclaration>
+ <SpaceAfterComma>True</SpaceAfterComma>
+ <SpaceAfterDot>False</SpaceAfterDot>
+ <SpaceAfterSemicolonsInForStatement>True</SpaceAfterSemicolonsInForStatement>
+ <SpaceBeforeColonInBaseTypeDeclaration>True</SpaceBeforeColonInBaseTypeDeclaration>
+ <SpaceBeforeComma>False</SpaceBeforeComma>
+ <SpaceBeforeDot>False</SpaceBeforeDot>
+ <SpaceBeforeSemicolonsInForStatement>False</SpaceBeforeSemicolonsInForStatement>
+ <SpacingAroundBinaryOperator>Single</SpacingAroundBinaryOperator>
+ <WrappingPreserveSingleLine>True</WrappingPreserveSingleLine>
+ <WrappingKeepStatementsOnSingleLine>True</WrappingKeepStatementsOnSingleLine>
</CSharpFormattingPolicy> \ No newline at end of file
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/policies/GNUCSharpPolicy.xml b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/policies/GNUCSharpPolicy.xml
deleted file mode 100644
index a40b19ac24..0000000000
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/policies/GNUCSharpPolicy.xml
+++ /dev/null
@@ -1,163 +0,0 @@
-<!--
-
-GNUCSharpPolicy.xml
-
-Author:
- Mike Krüger <mkrueger@xamarin.com>
-
-Copyright (c) 2012 Xamarin Inc. (http://xamarin.com)
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
--->
-
-
-<CSharpFormattingPolicy scope="text/x-csharp" allowDiffSerialize="False">
- <IndentNamespaceBody>True</IndentNamespaceBody>
- <IndentClassBody>True</IndentClassBody>
- <IndentInterfaceBody>True</IndentInterfaceBody>
- <IndentStructBody>True</IndentStructBody>
- <IndentEnumBody>True</IndentEnumBody>
- <IndentMethodBody>True</IndentMethodBody>
- <IndentPropertyBody>True</IndentPropertyBody>
- <IndentEventBody>True</IndentEventBody>
- <IndentBlocks>True</IndentBlocks>
- <IndentSwitchBody>True</IndentSwitchBody>
- <IndentCaseBody>True</IndentCaseBody>
- <IndentBreakStatements>True</IndentBreakStatements>
- <AlignEmbeddedStatements>True</AlignEmbeddedStatements>
- <PropertyFormatting>AllowOneLine</PropertyFormatting>
- <NamespaceBraceStyle>NextLine</NamespaceBraceStyle>
- <ClassBraceStyle>NextLine</ClassBraceStyle>
- <InterfaceBraceStyle>NextLine</InterfaceBraceStyle>
- <StructBraceStyle>NextLine</StructBraceStyle>
- <EnumBraceStyle>NextLine</EnumBraceStyle>
- <MethodBraceStyle>NextLine</MethodBraceStyle>
- <AnonymousMethodBraceStyle>EndOfLine</AnonymousMethodBraceStyle>
- <ConstructorBraceStyle>NextLine</ConstructorBraceStyle>
- <DestructorBraceStyle>NextLine</DestructorBraceStyle>
- <PropertyBraceStyle>EndOfLine</PropertyBraceStyle>
- <PropertyGetBraceStyle>EndOfLine</PropertyGetBraceStyle>
- <PropertySetBraceStyle>EndOfLine</PropertySetBraceStyle>
- <SimpleGetBlockFormatting>AllowOneLine</SimpleGetBlockFormatting>
- <SimpleSetBlockFormatting>AllowOneLine</SimpleSetBlockFormatting>
- <EventBraceStyle>EndOfLine</EventBraceStyle>
- <EventAddBraceStyle>EndOfLine</EventAddBraceStyle>
- <EventRemoveBraceStyle>EndOfLine</EventRemoveBraceStyle>
- <AllowEventAddBlockInline>True</AllowEventAddBlockInline>
- <AllowEventRemoveBlockInline>True</AllowEventRemoveBlockInline>
- <StatementBraceStyle>NextLineShifted2</StatementBraceStyle>
- <AllowIfBlockInline>False</AllowIfBlockInline>
- <ElseNewLinePlacement>SameLine</ElseNewLinePlacement>
- <ElseIfNewLinePlacement>SameLine</ElseIfNewLinePlacement>
- <CatchNewLinePlacement>SameLine</CatchNewLinePlacement>
- <FinallyNewLinePlacement>SameLine</FinallyNewLinePlacement>
- <WhileNewLinePlacement>SameLine</WhileNewLinePlacement>
- <ArrayInitializerWrapping>WrapIfTooLong</ArrayInitializerWrapping>
- <ArrayInitializerBraceStyle>EndOfLine</ArrayInitializerBraceStyle>
- <KeepCommentsAtFirstColumn>True</KeepCommentsAtFirstColumn>
- <BeforeMethodDeclarationParentheses>False</BeforeMethodDeclarationParentheses>
- <BetweenEmptyMethodDeclarationParentheses>False</BetweenEmptyMethodDeclarationParentheses>
- <BeforeMethodDeclarationParameterComma>False</BeforeMethodDeclarationParameterComma>
- <AfterMethodDeclarationParameterComma>True</AfterMethodDeclarationParameterComma>
- <WithinMethodDeclarationParentheses>False</WithinMethodDeclarationParentheses>
- <BeforeMethodCallParentheses>False</BeforeMethodCallParentheses>
- <BetweenEmptyMethodCallParentheses>False</BetweenEmptyMethodCallParentheses>
- <BeforeMethodCallParameterComma>False</BeforeMethodCallParameterComma>
- <AfterMethodCallParameterComma>True</AfterMethodCallParameterComma>
- <WithinMethodCallParentheses>False</WithinMethodCallParentheses>
- <BeforeFieldDeclarationComma>False</BeforeFieldDeclarationComma>
- <AfterFieldDeclarationComma>True</AfterFieldDeclarationComma>
- <BeforeLocalVariableDeclarationComma>False</BeforeLocalVariableDeclarationComma>
- <AfterLocalVariableDeclarationComma>True</AfterLocalVariableDeclarationComma>
- <BeforeConstructorDeclarationParentheses>False</BeforeConstructorDeclarationParentheses>
- <BetweenEmptyConstructorDeclarationParentheses>False</BetweenEmptyConstructorDeclarationParentheses>
- <BeforeConstructorDeclarationParameterComma>False</BeforeConstructorDeclarationParameterComma>
- <AfterConstructorDeclarationParameterComma>True</AfterConstructorDeclarationParameterComma>
- <WithinConstructorDeclarationParentheses>False</WithinConstructorDeclarationParentheses>
- <NewLineBeforeConstructorInitializerColon>NewLine</NewLineBeforeConstructorInitializerColon>
- <NewLineAfterConstructorInitializerColon>SameLine</NewLineAfterConstructorInitializerColon>
- <BeforeIndexerDeclarationBracket>True</BeforeIndexerDeclarationBracket>
- <WithinIndexerDeclarationBracket>False</WithinIndexerDeclarationBracket>
- <BeforeIndexerDeclarationParameterComma>False</BeforeIndexerDeclarationParameterComma>
- <AfterIndexerDeclarationParameterComma>True</AfterIndexerDeclarationParameterComma>
- <BeforeDelegateDeclarationParentheses>False</BeforeDelegateDeclarationParentheses>
- <BetweenEmptyDelegateDeclarationParentheses>False</BetweenEmptyDelegateDeclarationParentheses>
- <BeforeDelegateDeclarationParameterComma>False</BeforeDelegateDeclarationParameterComma>
- <AfterDelegateDeclarationParameterComma>False</AfterDelegateDeclarationParameterComma>
- <WithinDelegateDeclarationParentheses>False</WithinDelegateDeclarationParentheses>
- <NewParentheses>False</NewParentheses>
- <IfParentheses>True</IfParentheses>
- <WhileParentheses>True</WhileParentheses>
- <ForParentheses>True</ForParentheses>
- <ForeachParentheses>True</ForeachParentheses>
- <CatchParentheses>True</CatchParentheses>
- <SwitchParentheses>True</SwitchParentheses>
- <LockParentheses>True</LockParentheses>
- <UsingParentheses>True</UsingParentheses>
- <AroundAssignmentParentheses>True</AroundAssignmentParentheses>
- <AroundLogicalOperatorParentheses>True</AroundLogicalOperatorParentheses>
- <AroundEqualityOperatorParentheses>True</AroundEqualityOperatorParentheses>
- <AroundRelationalOperatorParentheses>True</AroundRelationalOperatorParentheses>
- <AroundBitwiseOperatorParentheses>True</AroundBitwiseOperatorParentheses>
- <AroundAdditiveOperatorParentheses>True</AroundAdditiveOperatorParentheses>
- <AroundMultiplicativeOperatorParentheses>True</AroundMultiplicativeOperatorParentheses>
- <AroundShiftOperatorParentheses>True</AroundShiftOperatorParentheses>
- <AroundNullCoalescingOperator>True</AroundNullCoalescingOperator>
- <WithinParentheses>False</WithinParentheses>
- <WithinIfParentheses>False</WithinIfParentheses>
- <WithinWhileParentheses>False</WithinWhileParentheses>
- <WithinForParentheses>False</WithinForParentheses>
- <WithinForEachParentheses>False</WithinForEachParentheses>
- <WithinCatchParentheses>False</WithinCatchParentheses>
- <WithinSwitchParentheses>False</WithinSwitchParentheses>
- <WithinLockParentheses>False</WithinLockParentheses>
- <WithinUsingParentheses>False</WithinUsingParentheses>
- <WithinCastParentheses>False</WithinCastParentheses>
- <WithinSizeOfParentheses>False</WithinSizeOfParentheses>
- <BeforeSizeOfParentheses>False</BeforeSizeOfParentheses>
- <WithinTypeOfParentheses>False</WithinTypeOfParentheses>
- <WithinNewParentheses>False</WithinNewParentheses>
- <BetweenEmptyNewParentheses>False</BetweenEmptyNewParentheses>
- <BeforeNewParameterComma>False</BeforeNewParameterComma>
- <AfterNewParameterComma>True</AfterNewParameterComma>
- <BeforeTypeOfParentheses>False</BeforeTypeOfParentheses>
- <WithinCheckedExpressionParantheses>False</WithinCheckedExpressionParantheses>
- <ConditionalOperatorBeforeConditionSpace>True</ConditionalOperatorBeforeConditionSpace>
- <ConditionalOperatorAfterConditionSpace>True</ConditionalOperatorAfterConditionSpace>
- <ConditionalOperatorBeforeSeparatorSpace>True</ConditionalOperatorBeforeSeparatorSpace>
- <ConditionalOperatorAfterSeparatorSpace>True</ConditionalOperatorAfterSeparatorSpace>
- <SpacesWithinBrackets>False</SpacesWithinBrackets>
- <SpacesBeforeBrackets>False</SpacesBeforeBrackets>
- <BeforeBracketComma>False</BeforeBracketComma>
- <AfterBracketComma>True</AfterBracketComma>
- <SpacesBeforeForSemicolon>False</SpacesBeforeForSemicolon>
- <SpacesAfterForSemicolon>True</SpacesAfterForSemicolon>
- <SpacesAfterTypecast>False</SpacesAfterTypecast>
- <SpacesBeforeArrayDeclarationBrackets>False</SpacesBeforeArrayDeclarationBrackets>
- <BlankLinesBeforeUsings>0</BlankLinesBeforeUsings>
- <BlankLinesAfterUsings>1</BlankLinesAfterUsings>
- <BlankLinesBeforeFirstDeclaration>0</BlankLinesBeforeFirstDeclaration>
- <BlankLinesBetweenTypes>1</BlankLinesBetweenTypes>
- <BlankLinesBetweenFields>0</BlankLinesBetweenFields>
- <BlankLinesBetweenEventFields>0</BlankLinesBetweenEventFields>
- <BlankLinesBetweenMembers>1</BlankLinesBetweenMembers>
- <BlankLinesInsideRegion>1</BlankLinesInsideRegion>
- <BlankLinesAroundRegion>1</BlankLinesAroundRegion>
- <IndentBlocksInsideExpressions>False</IndentBlocksInsideExpressions>
-</CSharpFormattingPolicy> \ No newline at end of file
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/policies/GNUTextStylePolicy.xml b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/policies/GNUTextStylePolicy.xml
deleted file mode 100644
index e04fa3260f..0000000000
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/policies/GNUTextStylePolicy.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-<!--
-
-GNUTextStylePolicy.xml
-
-Author:
- Mike Krüger <mkrueger@xamarin.com>
-
-Copyright (c) 2012 Xamarin Inc. (http://xamarin.com)
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
--->
-
-<TextStylePolicy scope="text/x-csharp">
- <FileWidth>120</FileWidth>
- <TabWidth>4</TabWidth>
- <IndentWidth>2</IndentWidth>
- <TabsToSpaces>True</TabsToSpaces>
- <NoTabsAfterNonTabs>False</NoTabsAfterNonTabs>
- <RemoveTrailingWhitespace>True</RemoveTrailingWhitespace>
- <EolMarker>Unix</EolMarker>
-</TextStylePolicy> \ No newline at end of file
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/policies/KRCSharpPolicy.xml b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/policies/KRCSharpPolicy.xml
index b9f7b6b8a6..92cb6cd61e 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/policies/KRCSharpPolicy.xml
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/policies/KRCSharpPolicy.xml
@@ -27,138 +27,48 @@ THE SOFTWARE.
-->
<CSharpFormattingPolicy scope="text/x-csharp" allowDiffSerialize="False">
- <IndentNamespaceBody>True</IndentNamespaceBody>
- <IndentClassBody>True</IndentClassBody>
- <IndentInterfaceBody>True</IndentInterfaceBody>
- <IndentStructBody>True</IndentStructBody>
- <IndentEnumBody>True</IndentEnumBody>
- <IndentMethodBody>True</IndentMethodBody>
- <IndentPropertyBody>True</IndentPropertyBody>
- <IndentEventBody>True</IndentEventBody>
- <IndentBlocks>True</IndentBlocks>
- <IndentSwitchBody>True</IndentSwitchBody>
- <IndentCaseBody>True</IndentCaseBody>
- <IndentBreakStatements>True</IndentBreakStatements>
- <AlignEmbeddedStatements>True</AlignEmbeddedStatements>
- <SimplePropertyFormatting>AllowOneLine</SimplePropertyFormatting>
- <AutoPropertyFormatting>AllowOneLine</AutoPropertyFormatting>
- <NamespaceBraceStyle>NextLine</NamespaceBraceStyle>
- <ClassBraceStyle>NextLine</ClassBraceStyle>
- <InterfaceBraceStyle>NextLine</InterfaceBraceStyle>
- <StructBraceStyle>NextLine</StructBraceStyle>
- <EnumBraceStyle>NextLine</EnumBraceStyle>
- <MethodBraceStyle>NextLine</MethodBraceStyle>
- <AnonymousMethodBraceStyle>EndOfLine</AnonymousMethodBraceStyle>
- <ConstructorBraceStyle>NextLine</ConstructorBraceStyle>
- <DestructorBraceStyle>NextLine</DestructorBraceStyle>
- <PropertyBraceStyle>EndOfLine</PropertyBraceStyle>
- <PropertyGetBraceStyle>EndOfLine</PropertyGetBraceStyle>
- <PropertySetBraceStyle>EndOfLine</PropertySetBraceStyle>
- <SimpleGetBlockFormatting>AllowOneLine</SimpleGetBlockFormatting>
- <SimpleSetBlockFormatting>AllowOneLine</SimpleSetBlockFormatting>
- <EventBraceStyle>EndOfLine</EventBraceStyle>
- <EventAddBraceStyle>EndOfLine</EventAddBraceStyle>
- <EventRemoveBraceStyle>EndOfLine</EventRemoveBraceStyle>
- <AllowEventAddBlockInline>True</AllowEventAddBlockInline>
- <AllowEventRemoveBlockInline>True</AllowEventRemoveBlockInline>
- <StatementBraceStyle>EndOfLine</StatementBraceStyle>
- <AllowIfBlockInline>False</AllowIfBlockInline>
- <ElseNewLinePlacement>SameLine</ElseNewLinePlacement>
- <ElseIfNewLinePlacement>SameLine</ElseIfNewLinePlacement>
- <CatchNewLinePlacement>SameLine</CatchNewLinePlacement>
- <FinallyNewLinePlacement>SameLine</FinallyNewLinePlacement>
- <WhileNewLinePlacement>SameLine</WhileNewLinePlacement>
- <ArrayInitializerWrapping>WrapIfTooLong</ArrayInitializerWrapping>
- <ArrayInitializerBraceStyle>EndOfLine</ArrayInitializerBraceStyle>
- <KeepCommentsAtFirstColumn>True</KeepCommentsAtFirstColumn>
- <BeforeMethodDeclarationParentheses>False</BeforeMethodDeclarationParentheses>
- <BetweenEmptyMethodDeclarationParentheses>False</BetweenEmptyMethodDeclarationParentheses>
- <BeforeMethodDeclarationParameterComma>False</BeforeMethodDeclarationParameterComma>
- <AfterMethodDeclarationParameterComma>True</AfterMethodDeclarationParameterComma>
- <WithinMethodDeclarationParentheses>False</WithinMethodDeclarationParentheses>
- <BeforeMethodCallParentheses>False</BeforeMethodCallParentheses>
- <BetweenEmptyMethodCallParentheses>False</BetweenEmptyMethodCallParentheses>
- <BeforeMethodCallParameterComma>False</BeforeMethodCallParameterComma>
- <AfterMethodCallParameterComma>True</AfterMethodCallParameterComma>
- <WithinMethodCallParentheses>False</WithinMethodCallParentheses>
- <BeforeFieldDeclarationComma>False</BeforeFieldDeclarationComma>
- <AfterFieldDeclarationComma>True</AfterFieldDeclarationComma>
- <BeforeLocalVariableDeclarationComma>False</BeforeLocalVariableDeclarationComma>
- <AfterLocalVariableDeclarationComma>True</AfterLocalVariableDeclarationComma>
- <BeforeConstructorDeclarationParentheses>False</BeforeConstructorDeclarationParentheses>
- <BetweenEmptyConstructorDeclarationParentheses>False</BetweenEmptyConstructorDeclarationParentheses>
- <BeforeConstructorDeclarationParameterComma>False</BeforeConstructorDeclarationParameterComma>
- <AfterConstructorDeclarationParameterComma>True</AfterConstructorDeclarationParameterComma>
- <WithinConstructorDeclarationParentheses>False</WithinConstructorDeclarationParentheses>
- <NewLineBeforeConstructorInitializerColon>NewLine</NewLineBeforeConstructorInitializerColon>
- <NewLineAfterConstructorInitializerColon>SameLine</NewLineAfterConstructorInitializerColon>
- <BeforeIndexerDeclarationBracket>True</BeforeIndexerDeclarationBracket>
- <WithinIndexerDeclarationBracket>False</WithinIndexerDeclarationBracket>
- <BeforeIndexerDeclarationParameterComma>False</BeforeIndexerDeclarationParameterComma>
- <AfterIndexerDeclarationParameterComma>True</AfterIndexerDeclarationParameterComma>
- <BeforeDelegateDeclarationParentheses>False</BeforeDelegateDeclarationParentheses>
- <BetweenEmptyDelegateDeclarationParentheses>False</BetweenEmptyDelegateDeclarationParentheses>
- <BeforeDelegateDeclarationParameterComma>False</BeforeDelegateDeclarationParameterComma>
- <AfterDelegateDeclarationParameterComma>False</AfterDelegateDeclarationParameterComma>
- <WithinDelegateDeclarationParentheses>False</WithinDelegateDeclarationParentheses>
- <NewParentheses>False</NewParentheses>
- <IfParentheses>True</IfParentheses>
- <WhileParentheses>True</WhileParentheses>
- <ForParentheses>True</ForParentheses>
- <ForeachParentheses>True</ForeachParentheses>
- <CatchParentheses>True</CatchParentheses>
- <SwitchParentheses>True</SwitchParentheses>
- <LockParentheses>True</LockParentheses>
- <UsingParentheses>True</UsingParentheses>
- <AroundAssignmentParentheses>True</AroundAssignmentParentheses>
- <AroundLogicalOperatorParentheses>True</AroundLogicalOperatorParentheses>
- <AroundEqualityOperatorParentheses>True</AroundEqualityOperatorParentheses>
- <AroundRelationalOperatorParentheses>True</AroundRelationalOperatorParentheses>
- <AroundBitwiseOperatorParentheses>True</AroundBitwiseOperatorParentheses>
- <AroundAdditiveOperatorParentheses>True</AroundAdditiveOperatorParentheses>
- <AroundMultiplicativeOperatorParentheses>True</AroundMultiplicativeOperatorParentheses>
- <AroundShiftOperatorParentheses>True</AroundShiftOperatorParentheses>
- <AroundNullCoalescingOperator>True</AroundNullCoalescingOperator>
- <WithinParentheses>False</WithinParentheses>
- <WithinIfParentheses>False</WithinIfParentheses>
- <WithinWhileParentheses>False</WithinWhileParentheses>
- <WithinForParentheses>False</WithinForParentheses>
- <WithinForEachParentheses>False</WithinForEachParentheses>
- <WithinCatchParentheses>False</WithinCatchParentheses>
- <WithinSwitchParentheses>False</WithinSwitchParentheses>
- <WithinLockParentheses>False</WithinLockParentheses>
- <WithinUsingParentheses>False</WithinUsingParentheses>
- <WithinCastParentheses>False</WithinCastParentheses>
- <WithinSizeOfParentheses>False</WithinSizeOfParentheses>
- <BeforeSizeOfParentheses>False</BeforeSizeOfParentheses>
- <WithinTypeOfParentheses>False</WithinTypeOfParentheses>
- <WithinNewParentheses>False</WithinNewParentheses>
- <BetweenEmptyNewParentheses>False</BetweenEmptyNewParentheses>
- <BeforeNewParameterComma>False</BeforeNewParameterComma>
- <AfterNewParameterComma>True</AfterNewParameterComma>
- <BeforeTypeOfParentheses>False</BeforeTypeOfParentheses>
- <WithinCheckedExpressionParantheses>False</WithinCheckedExpressionParantheses>
- <ConditionalOperatorBeforeConditionSpace>True</ConditionalOperatorBeforeConditionSpace>
- <ConditionalOperatorAfterConditionSpace>True</ConditionalOperatorAfterConditionSpace>
- <ConditionalOperatorBeforeSeparatorSpace>True</ConditionalOperatorBeforeSeparatorSpace>
- <ConditionalOperatorAfterSeparatorSpace>True</ConditionalOperatorAfterSeparatorSpace>
- <SpacesWithinBrackets>False</SpacesWithinBrackets>
- <SpacesBeforeBrackets>False</SpacesBeforeBrackets>
- <BeforeBracketComma>False</BeforeBracketComma>
- <AfterBracketComma>True</AfterBracketComma>
- <SpacesBeforeForSemicolon>False</SpacesBeforeForSemicolon>
- <SpacesAfterForSemicolon>True</SpacesAfterForSemicolon>
- <SpacesAfterTypecast>False</SpacesAfterTypecast>
- <SpacesBeforeArrayDeclarationBrackets>False</SpacesBeforeArrayDeclarationBrackets>
- <BlankLinesBeforeUsings>0</BlankLinesBeforeUsings>
- <BlankLinesAfterUsings>1</BlankLinesAfterUsings>
- <BlankLinesBeforeFirstDeclaration>0</BlankLinesBeforeFirstDeclaration>
- <BlankLinesBetweenTypes>1</BlankLinesBetweenTypes>
- <BlankLinesBetweenFields>0</BlankLinesBetweenFields>
- <BlankLinesBetweenEventFields>0</BlankLinesBetweenEventFields>
- <BlankLinesBetweenMembers>1</BlankLinesBetweenMembers>
- <BlankLinesInsideRegion>1</BlankLinesInsideRegion>
- <BlankLinesAroundRegion>1</BlankLinesAroundRegion>
- <IndentPreprocessorDirectives>True</IndentPreprocessorDirectives>
- <IndentBlocksInsideExpressions>False</IndentBlocksInsideExpressions>
+ <IndentBlock>True</IndentBlock>
+ <IndentBraces>False</IndentBraces>
+ <IndentSwitchSection>True</IndentSwitchSection>
+ <IndentSwitchCaseSection>True</IndentSwitchCaseSection>
+ <LabelPositioning>OneLess</LabelPositioning>
+ <NewLinesForBracesInTypes>True</NewLinesForBracesInTypes>
+ <NewLinesForBracesInMethods>True</NewLinesForBracesInMethods>
+ <NewLinesForBracesInAnonymousMethods>False</NewLinesForBracesInAnonymousMethods>
+ <NewLinesForBracesInControlBlocks>False</NewLinesForBracesInControlBlocks>
+ <NewLinesForBracesInAnonymousTypes>False</NewLinesForBracesInAnonymousTypes>
+ <NewLinesForBracesInObjectInitializers>False</NewLinesForBracesInObjectInitializers>
+ <NewLinesForBracesInLambdaExpressionBody>False</NewLinesForBracesInLambdaExpressionBody>
+ <NewLineForElse>False</NewLineForElse>
+ <NewLineForCatch>False</NewLineForCatch>
+ <NewLineForFinally>False</NewLineForFinally>
+ <NewLineForMembersInObjectInit>False</NewLineForMembersInObjectInit>
+ <NewLineForMembersInAnonymousTypes>False</NewLineForMembersInAnonymousTypes>
+ <NewLineForClausesInQuery>False</NewLineForClausesInQuery>
+ <SpacingAfterMethodDeclarationName>False</SpacingAfterMethodDeclarationName>
+ <SpaceWithinMethodDeclarationParenthesis>False</SpaceWithinMethodDeclarationParenthesis>
+ <SpaceBetweenEmptyMethodDeclarationParentheses>False</SpaceBetweenEmptyMethodDeclarationParentheses>
+ <SpaceAfterMethodCallName>False</SpaceAfterMethodCallName>
+ <SpaceWithinMethodCallParentheses>False</SpaceWithinMethodCallParentheses>
+ <SpaceBetweenEmptyMethodCallParentheses>False</SpaceBetweenEmptyMethodCallParentheses>
+ <SpaceAfterControlFlowStatementKeyword>True</SpaceAfterControlFlowStatementKeyword>
+ <SpaceWithinExpressionParentheses>False</SpaceWithinExpressionParentheses>
+ <SpaceWithinCastParentheses>False</SpaceWithinCastParentheses>
+ <SpaceWithinOtherParentheses>False</SpaceWithinOtherParentheses>
+ <SpaceAfterCast>False</SpaceAfterCast>
+ <SpacesIgnoreAroundVariableDeclaration>False</SpacesIgnoreAroundVariableDeclaration>
+ <SpaceBeforeOpenSquareBracket>False</SpaceBeforeOpenSquareBracket>
+ <SpaceBetweenEmptySquareBrackets>False</SpaceBetweenEmptySquareBrackets>
+ <SpaceWithinSquareBrackets>False</SpaceWithinSquareBrackets>
+ <SpaceAfterColonInBaseTypeDeclaration>True</SpaceAfterColonInBaseTypeDeclaration>
+ <SpaceAfterComma>True</SpaceAfterComma>
+ <SpaceAfterDot>False</SpaceAfterDot>
+ <SpaceAfterSemicolonsInForStatement>True</SpaceAfterSemicolonsInForStatement>
+ <SpaceBeforeColonInBaseTypeDeclaration>True</SpaceBeforeColonInBaseTypeDeclaration>
+ <SpaceBeforeComma>False</SpaceBeforeComma>
+ <SpaceBeforeDot>False</SpaceBeforeDot>
+ <SpaceBeforeSemicolonsInForStatement>False</SpaceBeforeSemicolonsInForStatement>
+ <SpacingAroundBinaryOperator>Single</SpacingAroundBinaryOperator>
+ <WrappingPreserveSingleLine>True</WrappingPreserveSingleLine>
+ <WrappingKeepStatementsOnSingleLine>True</WrappingKeepStatementsOnSingleLine>
</CSharpFormattingPolicy> \ No newline at end of file
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/policies/MonoCSharpPolicy.xml b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/policies/MonoCSharpPolicy.xml
index 9924d6f2c3..1a9b87ab52 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/policies/MonoCSharpPolicy.xml
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/policies/MonoCSharpPolicy.xml
@@ -27,140 +27,48 @@ THE SOFTWARE.
-->
<CSharpFormattingPolicy scope="text/x-csharp" allowDiffSerialize="True">
- <IndentNamespaceBody>True</IndentNamespaceBody>
- <IndentClassBody>True</IndentClassBody>
- <IndentInterfaceBody>True</IndentInterfaceBody>
- <IndentStructBody>True</IndentStructBody>
- <IndentEnumBody>True</IndentEnumBody>
- <IndentMethodBody>True</IndentMethodBody>
- <IndentPropertyBody>True</IndentPropertyBody>
- <IndentEventBody>True</IndentEventBody>
- <IndentBlocks>True</IndentBlocks>
- <IndentSwitchBody>False</IndentSwitchBody>
- <IndentCaseBody>True</IndentCaseBody>
- <IndentBreakStatements>True</IndentBreakStatements>
- <AlignEmbeddedStatements>True</AlignEmbeddedStatements>
- <SimplePropertyFormatting>AllowOneLine</SimplePropertyFormatting>
- <AutoPropertyFormatting>AllowOneLine</AutoPropertyFormatting>
- <NamespaceBraceStyle>NextLine</NamespaceBraceStyle>
- <ClassBraceStyle>NextLine</ClassBraceStyle>
- <InterfaceBraceStyle>NextLine</InterfaceBraceStyle>
- <StructBraceStyle>NextLine</StructBraceStyle>
- <EnumBraceStyle>NextLine</EnumBraceStyle>
- <MethodBraceStyle>NextLine</MethodBraceStyle>
- <AnonymousMethodBraceStyle>EndOfLine</AnonymousMethodBraceStyle>
- <ConstructorBraceStyle>NextLine</ConstructorBraceStyle>
- <DestructorBraceStyle>NextLine</DestructorBraceStyle>
- <PropertyBraceStyle>EndOfLine</PropertyBraceStyle>
- <PropertyGetBraceStyle>EndOfLine</PropertyGetBraceStyle>
- <PropertySetBraceStyle>EndOfLine</PropertySetBraceStyle>
- <SimpleGetBlockFormatting>AllowOneLine</SimpleGetBlockFormatting>
- <SimpleSetBlockFormatting>AllowOneLine</SimpleSetBlockFormatting>
- <EventBraceStyle>EndOfLine</EventBraceStyle>
- <EventAddBraceStyle>EndOfLine</EventAddBraceStyle>
- <EventRemoveBraceStyle>EndOfLine</EventRemoveBraceStyle>
- <AllowEventAddBlockInline>True</AllowEventAddBlockInline>
- <AllowEventRemoveBlockInline>True</AllowEventRemoveBlockInline>
- <StatementBraceStyle>EndOfLine</StatementBraceStyle>
- <AllowIfBlockInline>False</AllowIfBlockInline>
- <ElseNewLinePlacement>SameLine</ElseNewLinePlacement>
- <ElseIfNewLinePlacement>SameLine</ElseIfNewLinePlacement>
- <CatchNewLinePlacement>SameLine</CatchNewLinePlacement>
- <FinallyNewLinePlacement>SameLine</FinallyNewLinePlacement>
- <WhileNewLinePlacement>SameLine</WhileNewLinePlacement>
- <ArrayInitializerWrapping>WrapIfTooLong</ArrayInitializerWrapping>
- <ArrayInitializerBraceStyle>EndOfLine</ArrayInitializerBraceStyle>
- <KeepCommentsAtFirstColumn>True</KeepCommentsAtFirstColumn>
- <BeforeMethodDeclarationParentheses>True</BeforeMethodDeclarationParentheses>
- <BetweenEmptyMethodDeclarationParentheses>False</BetweenEmptyMethodDeclarationParentheses>
- <BeforeMethodDeclarationParameterComma>False</BeforeMethodDeclarationParameterComma>
- <AfterMethodDeclarationParameterComma>True</AfterMethodDeclarationParameterComma>
- <WithinMethodDeclarationParentheses>False</WithinMethodDeclarationParentheses>
- <BeforeMethodCallParentheses>True</BeforeMethodCallParentheses>
- <BetweenEmptyMethodCallParentheses>False</BetweenEmptyMethodCallParentheses>
- <BeforeMethodCallParameterComma>False</BeforeMethodCallParameterComma>
- <AfterMethodCallParameterComma>True</AfterMethodCallParameterComma>
- <WithinMethodCallParentheses>False</WithinMethodCallParentheses>
- <BeforeFieldDeclarationComma>False</BeforeFieldDeclarationComma>
- <AfterFieldDeclarationComma>True</AfterFieldDeclarationComma>
- <BeforeLocalVariableDeclarationComma>False</BeforeLocalVariableDeclarationComma>
- <AfterLocalVariableDeclarationComma>True</AfterLocalVariableDeclarationComma>
- <BeforeConstructorDeclarationParentheses>True</BeforeConstructorDeclarationParentheses>
- <BetweenEmptyConstructorDeclarationParentheses>False</BetweenEmptyConstructorDeclarationParentheses>
- <BeforeConstructorDeclarationParameterComma>False</BeforeConstructorDeclarationParameterComma>
- <AfterConstructorDeclarationParameterComma>True</AfterConstructorDeclarationParameterComma>
- <WithinConstructorDeclarationParentheses>False</WithinConstructorDeclarationParentheses>
- <NewLineBeforeConstructorInitializerColon>DoNotCare</NewLineBeforeConstructorInitializerColon>
- <NewLineAfterConstructorInitializerColon>DoNotCare</NewLineAfterConstructorInitializerColon>
- <BeforeIndexerDeclarationBracket>True</BeforeIndexerDeclarationBracket>
- <WithinIndexerDeclarationBracket>False</WithinIndexerDeclarationBracket>
- <BeforeIndexerDeclarationParameterComma>False</BeforeIndexerDeclarationParameterComma>
- <AfterIndexerDeclarationParameterComma>True</AfterIndexerDeclarationParameterComma>
- <BeforeDelegateDeclarationParentheses>True</BeforeDelegateDeclarationParentheses>
- <BetweenEmptyDelegateDeclarationParentheses>False</BetweenEmptyDelegateDeclarationParentheses>
- <BeforeDelegateDeclarationParameterComma>False</BeforeDelegateDeclarationParameterComma>
- <AfterDelegateDeclarationParameterComma>False</AfterDelegateDeclarationParameterComma>
- <WithinDelegateDeclarationParentheses>False</WithinDelegateDeclarationParentheses>
- <NewParentheses>True</NewParentheses>
- <IfParentheses>True</IfParentheses>
- <WhileParentheses>True</WhileParentheses>
- <ForParentheses>True</ForParentheses>
- <ForeachParentheses>True</ForeachParentheses>
- <CatchParentheses>True</CatchParentheses>
- <SwitchParentheses>True</SwitchParentheses>
- <LockParentheses>True</LockParentheses>
- <UsingParentheses>True</UsingParentheses>
- <AroundAssignmentParentheses>True</AroundAssignmentParentheses>
- <AroundLogicalOperatorParentheses>True</AroundLogicalOperatorParentheses>
- <AroundEqualityOperatorParentheses>True</AroundEqualityOperatorParentheses>
- <AroundRelationalOperatorParentheses>True</AroundRelationalOperatorParentheses>
- <AroundBitwiseOperatorParentheses>True</AroundBitwiseOperatorParentheses>
- <AroundAdditiveOperatorParentheses>True</AroundAdditiveOperatorParentheses>
- <AroundMultiplicativeOperatorParentheses>True</AroundMultiplicativeOperatorParentheses>
- <AroundShiftOperatorParentheses>True</AroundShiftOperatorParentheses>
- <AroundNullCoalescingOperator>True</AroundNullCoalescingOperator>
- <WithinParentheses>False</WithinParentheses>
- <WithinIfParentheses>False</WithinIfParentheses>
- <WithinWhileParentheses>False</WithinWhileParentheses>
- <WithinForParentheses>False</WithinForParentheses>
- <WithinForEachParentheses>False</WithinForEachParentheses>
- <WithinCatchParentheses>False</WithinCatchParentheses>
- <WithinSwitchParentheses>False</WithinSwitchParentheses>
- <WithinLockParentheses>False</WithinLockParentheses>
- <WithinUsingParentheses>False</WithinUsingParentheses>
- <WithinCastParentheses>False</WithinCastParentheses>
- <WithinSizeOfParentheses>False</WithinSizeOfParentheses>
- <BeforeSizeOfParentheses>False</BeforeSizeOfParentheses>
- <WithinTypeOfParentheses>False</WithinTypeOfParentheses>
- <WithinNewParentheses>False</WithinNewParentheses>
- <BetweenEmptyNewParentheses>False</BetweenEmptyNewParentheses>
- <BeforeNewParameterComma>False</BeforeNewParameterComma>
- <AfterNewParameterComma>True</AfterNewParameterComma>
- <BeforeTypeOfParentheses>False</BeforeTypeOfParentheses>
- <WithinCheckedExpressionParantheses>False</WithinCheckedExpressionParantheses>
- <ConditionalOperatorBeforeConditionSpace>True</ConditionalOperatorBeforeConditionSpace>
- <ConditionalOperatorAfterConditionSpace>True</ConditionalOperatorAfterConditionSpace>
- <ConditionalOperatorBeforeSeparatorSpace>True</ConditionalOperatorBeforeSeparatorSpace>
- <ConditionalOperatorAfterSeparatorSpace>True</ConditionalOperatorAfterSeparatorSpace>
- <SpacesWithinBrackets>False</SpacesWithinBrackets>
- <SpacesBeforeBrackets>True</SpacesBeforeBrackets>
- <BeforeBracketComma>False</BeforeBracketComma>
- <AfterBracketComma>True</AfterBracketComma>
- <SpacesBeforeForSemicolon>False</SpacesBeforeForSemicolon>
- <SpacesAfterForSemicolon>True</SpacesAfterForSemicolon>
- <SpacesAfterTypecast>False</SpacesAfterTypecast>
- <SpacesBeforeArrayDeclarationBrackets>False</SpacesBeforeArrayDeclarationBrackets>
- <BlankLinesBeforeUsings>0</BlankLinesBeforeUsings>
- <BlankLinesAfterUsings>1</BlankLinesAfterUsings>
- <BlankLinesBeforeFirstDeclaration>0</BlankLinesBeforeFirstDeclaration>
- <BlankLinesBetweenTypes>1</BlankLinesBetweenTypes>
- <BlankLinesBetweenFields>0</BlankLinesBetweenFields>
- <BlankLinesBetweenEventFields>0</BlankLinesBetweenEventFields>
- <BlankLinesBetweenMembers>1</BlankLinesBetweenMembers>
- <BlankLinesInsideRegion>1</BlankLinesInsideRegion>
- <BlankLinesAroundRegion>1</BlankLinesAroundRegion>
- <IndentPreprocessorDirectives>True</IndentPreprocessorDirectives>
- <AlignToFirstIndexerArgument>False</AlignToFirstIndexerArgument>
- <AlignToFirstMethodCallArgument>False</AlignToFirstMethodCallArgument>
- <IndentBlocksInsideExpressions>False</IndentBlocksInsideExpressions>
+ <IndentBlock>True</IndentBlock>
+ <IndentBraces>False</IndentBraces>
+ <IndentSwitchSection>False</IndentSwitchSection>
+ <IndentSwitchCaseSection>True</IndentSwitchCaseSection>
+ <LabelPositioning>OneLess</LabelPositioning>
+ <NewLinesForBracesInTypes>True</NewLinesForBracesInTypes>
+ <NewLinesForBracesInMethods>True</NewLinesForBracesInMethods>
+ <NewLinesForBracesInAnonymousMethods>False</NewLinesForBracesInAnonymousMethods>
+ <NewLinesForBracesInControlBlocks>False</NewLinesForBracesInControlBlocks>
+ <NewLinesForBracesInAnonymousTypes>False</NewLinesForBracesInAnonymousTypes>
+ <NewLinesForBracesInObjectInitializers>False</NewLinesForBracesInObjectInitializers>
+ <NewLinesForBracesInLambdaExpressionBody>False</NewLinesForBracesInLambdaExpressionBody>
+ <NewLineForElse>False</NewLineForElse>
+ <NewLineForCatch>False</NewLineForCatch>
+ <NewLineForFinally>False</NewLineForFinally>
+ <NewLineForMembersInObjectInit>False</NewLineForMembersInObjectInit>
+ <NewLineForMembersInAnonymousTypes>False</NewLineForMembersInAnonymousTypes>
+ <NewLineForClausesInQuery>False</NewLineForClausesInQuery>
+ <SpacingAfterMethodDeclarationName>True</SpacingAfterMethodDeclarationName>
+ <SpaceWithinMethodDeclarationParenthesis>False</SpaceWithinMethodDeclarationParenthesis>
+ <SpaceBetweenEmptyMethodDeclarationParentheses>False</SpaceBetweenEmptyMethodDeclarationParentheses>
+ <SpaceAfterMethodCallName>True</SpaceAfterMethodCallName>
+ <SpaceWithinMethodCallParentheses>False</SpaceWithinMethodCallParentheses>
+ <SpaceBetweenEmptyMethodCallParentheses>False</SpaceBetweenEmptyMethodCallParentheses>
+ <SpaceAfterControlFlowStatementKeyword>True</SpaceAfterControlFlowStatementKeyword>
+ <SpaceWithinExpressionParentheses>False</SpaceWithinExpressionParentheses>
+ <SpaceWithinCastParentheses>False</SpaceWithinCastParentheses>
+ <SpaceWithinOtherParentheses>False</SpaceWithinOtherParentheses>
+ <SpaceAfterCast>False</SpaceAfterCast>
+ <SpacesIgnoreAroundVariableDeclaration>False</SpacesIgnoreAroundVariableDeclaration>
+ <SpaceBeforeOpenSquareBracket>True</SpaceBeforeOpenSquareBracket>
+ <SpaceBetweenEmptySquareBrackets>False</SpaceBetweenEmptySquareBrackets>
+ <SpaceWithinSquareBrackets>False</SpaceWithinSquareBrackets>
+ <SpaceAfterColonInBaseTypeDeclaration>True</SpaceAfterColonInBaseTypeDeclaration>
+ <SpaceAfterComma>True</SpaceAfterComma>
+ <SpaceAfterDot>False</SpaceAfterDot>
+ <SpaceAfterSemicolonsInForStatement>True</SpaceAfterSemicolonsInForStatement>
+ <SpaceBeforeColonInBaseTypeDeclaration>True</SpaceBeforeColonInBaseTypeDeclaration>
+ <SpaceBeforeComma>False</SpaceBeforeComma>
+ <SpaceBeforeDot>False</SpaceBeforeDot>
+ <SpaceBeforeSemicolonsInForStatement>False</SpaceBeforeSemicolonsInForStatement>
+ <SpacingAroundBinaryOperator>Single</SpacingAroundBinaryOperator>
+ <WrappingPreserveSingleLine>True</WrappingPreserveSingleLine>
+ <WrappingKeepStatementsOnSingleLine>True</WrappingKeepStatementsOnSingleLine>
</CSharpFormattingPolicy> \ No newline at end of file
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/policies/SharpDevelopCSharpPolicy.xml b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/policies/SharpDevelopCSharpPolicy.xml
deleted file mode 100644
index 396628950f..0000000000
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/policies/SharpDevelopCSharpPolicy.xml
+++ /dev/null
@@ -1,164 +0,0 @@
-<!--
-
-SharpDevelopCSharpPolicy.xml
-
-Author:
- Mike Krüger <mkrueger@xamarin.com>
-
-Copyright (c) 2012 Xamarin Inc. (http://xamarin.com)
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
--->
-
-<CSharpFormattingPolicy scope="text/x-csharp" allowDiffSerialize="False">
- <IndentNamespaceBody>True</IndentNamespaceBody>
- <IndentClassBody>True</IndentClassBody>
- <IndentInterfaceBody>True</IndentInterfaceBody>
- <IndentStructBody>True</IndentStructBody>
- <IndentEnumBody>True</IndentEnumBody>
- <IndentMethodBody>True</IndentMethodBody>
- <IndentPropertyBody>True</IndentPropertyBody>
- <IndentEventBody>True</IndentEventBody>
- <IndentBlocks>True</IndentBlocks>
- <IndentSwitchBody>True</IndentSwitchBody>
- <IndentCaseBody>True</IndentCaseBody>
- <IndentBreakStatements>True</IndentBreakStatements>
- <AlignEmbeddedStatements>True</AlignEmbeddedStatements>
- <SimplePropertyFormatting>AllowOneLine</SimplePropertyFormatting>
- <AutoPropertyFormatting>AllowOneLine</AutoPropertyFormatting>
- <NamespaceBraceStyle>NextLine</NamespaceBraceStyle>
- <ClassBraceStyle>NextLine</ClassBraceStyle>
- <InterfaceBraceStyle>NextLine</InterfaceBraceStyle>
- <StructBraceStyle>NextLine</StructBraceStyle>
- <EnumBraceStyle>NextLine</EnumBraceStyle>
- <MethodBraceStyle>NextLine</MethodBraceStyle>
- <AnonymousMethodBraceStyle>EndOfLine</AnonymousMethodBraceStyle>
- <ConstructorBraceStyle>NextLine</ConstructorBraceStyle>
- <DestructorBraceStyle>NextLine</DestructorBraceStyle>
- <PropertyBraceStyle>EndOfLine</PropertyBraceStyle>
- <PropertyGetBraceStyle>EndOfLine</PropertyGetBraceStyle>
- <PropertySetBraceStyle>EndOfLine</PropertySetBraceStyle>
- <SimpleGetBlockFormatting>AllowOneLine</SimpleGetBlockFormatting>
- <SimpleSetBlockFormatting>AllowOneLine</SimpleSetBlockFormatting>
- <EventBraceStyle>EndOfLine</EventBraceStyle>
- <EventAddBraceStyle>EndOfLine</EventAddBraceStyle>
- <EventRemoveBraceStyle>EndOfLine</EventRemoveBraceStyle>
- <AllowEventAddBlockInline>True</AllowEventAddBlockInline>
- <AllowEventRemoveBlockInline>True</AllowEventRemoveBlockInline>
- <StatementBraceStyle>EndOfLine</StatementBraceStyle>
- <AllowIfBlockInline>False</AllowIfBlockInline>
- <ElseNewLinePlacement>SameLine</ElseNewLinePlacement>
- <ElseIfNewLinePlacement>SameLine</ElseIfNewLinePlacement>
- <CatchNewLinePlacement>SameLine</CatchNewLinePlacement>
- <FinallyNewLinePlacement>SameLine</FinallyNewLinePlacement>
- <WhileNewLinePlacement>SameLine</WhileNewLinePlacement>
- <ArrayInitializerWrapping>WrapIfTooLong</ArrayInitializerWrapping>
- <ArrayInitializerBraceStyle>EndOfLine</ArrayInitializerBraceStyle>
- <KeepCommentsAtFirstColumn>True</KeepCommentsAtFirstColumn>
- <BeforeMethodDeclarationParentheses>False</BeforeMethodDeclarationParentheses>
- <BetweenEmptyMethodDeclarationParentheses>False</BetweenEmptyMethodDeclarationParentheses>
- <BeforeMethodDeclarationParameterComma>False</BeforeMethodDeclarationParameterComma>
- <AfterMethodDeclarationParameterComma>True</AfterMethodDeclarationParameterComma>
- <WithinMethodDeclarationParentheses>False</WithinMethodDeclarationParentheses>
- <BeforeMethodCallParentheses>False</BeforeMethodCallParentheses>
- <BetweenEmptyMethodCallParentheses>False</BetweenEmptyMethodCallParentheses>
- <BeforeMethodCallParameterComma>False</BeforeMethodCallParameterComma>
- <AfterMethodCallParameterComma>True</AfterMethodCallParameterComma>
- <WithinMethodCallParentheses>False</WithinMethodCallParentheses>
- <BeforeFieldDeclarationComma>False</BeforeFieldDeclarationComma>
- <AfterFieldDeclarationComma>True</AfterFieldDeclarationComma>
- <BeforeLocalVariableDeclarationComma>False</BeforeLocalVariableDeclarationComma>
- <AfterLocalVariableDeclarationComma>True</AfterLocalVariableDeclarationComma>
- <BeforeConstructorDeclarationParentheses>False</BeforeConstructorDeclarationParentheses>
- <BetweenEmptyConstructorDeclarationParentheses>False</BetweenEmptyConstructorDeclarationParentheses>
- <BeforeConstructorDeclarationParameterComma>False</BeforeConstructorDeclarationParameterComma>
- <AfterConstructorDeclarationParameterComma>True</AfterConstructorDeclarationParameterComma>
- <WithinConstructorDeclarationParentheses>False</WithinConstructorDeclarationParentheses>
- <NewLineBeforeConstructorInitializerColon>NewLine</NewLineBeforeConstructorInitializerColon>
- <NewLineAfterConstructorInitializerColon>SameLine</NewLineAfterConstructorInitializerColon>
- <BeforeIndexerDeclarationBracket>True</BeforeIndexerDeclarationBracket>
- <WithinIndexerDeclarationBracket>False</WithinIndexerDeclarationBracket>
- <BeforeIndexerDeclarationParameterComma>False</BeforeIndexerDeclarationParameterComma>
- <AfterIndexerDeclarationParameterComma>True</AfterIndexerDeclarationParameterComma>
- <BeforeDelegateDeclarationParentheses>False</BeforeDelegateDeclarationParentheses>
- <BetweenEmptyDelegateDeclarationParentheses>False</BetweenEmptyDelegateDeclarationParentheses>
- <BeforeDelegateDeclarationParameterComma>False</BeforeDelegateDeclarationParameterComma>
- <AfterDelegateDeclarationParameterComma>False</AfterDelegateDeclarationParameterComma>
- <WithinDelegateDeclarationParentheses>False</WithinDelegateDeclarationParentheses>
- <NewParentheses>False</NewParentheses>
- <IfParentheses>True</IfParentheses>
- <WhileParentheses>True</WhileParentheses>
- <ForParentheses>True</ForParentheses>
- <ForeachParentheses>True</ForeachParentheses>
- <CatchParentheses>True</CatchParentheses>
- <SwitchParentheses>True</SwitchParentheses>
- <LockParentheses>True</LockParentheses>
- <UsingParentheses>True</UsingParentheses>
- <AroundAssignmentParentheses>True</AroundAssignmentParentheses>
- <AroundLogicalOperatorParentheses>True</AroundLogicalOperatorParentheses>
- <AroundEqualityOperatorParentheses>True</AroundEqualityOperatorParentheses>
- <AroundRelationalOperatorParentheses>True</AroundRelationalOperatorParentheses>
- <AroundBitwiseOperatorParentheses>True</AroundBitwiseOperatorParentheses>
- <AroundAdditiveOperatorParentheses>True</AroundAdditiveOperatorParentheses>
- <AroundMultiplicativeOperatorParentheses>True</AroundMultiplicativeOperatorParentheses>
- <AroundShiftOperatorParentheses>True</AroundShiftOperatorParentheses>
- <AroundNullCoalescingOperator>True</AroundNullCoalescingOperator>
- <WithinParentheses>False</WithinParentheses>
- <WithinIfParentheses>False</WithinIfParentheses>
- <WithinWhileParentheses>False</WithinWhileParentheses>
- <WithinForParentheses>False</WithinForParentheses>
- <WithinForEachParentheses>False</WithinForEachParentheses>
- <WithinCatchParentheses>False</WithinCatchParentheses>
- <WithinSwitchParentheses>False</WithinSwitchParentheses>
- <WithinLockParentheses>False</WithinLockParentheses>
- <WithinUsingParentheses>False</WithinUsingParentheses>
- <WithinCastParentheses>False</WithinCastParentheses>
- <WithinSizeOfParentheses>False</WithinSizeOfParentheses>
- <BeforeSizeOfParentheses>False</BeforeSizeOfParentheses>
- <WithinTypeOfParentheses>False</WithinTypeOfParentheses>
- <WithinNewParentheses>False</WithinNewParentheses>
- <BetweenEmptyNewParentheses>False</BetweenEmptyNewParentheses>
- <BeforeNewParameterComma>False</BeforeNewParameterComma>
- <AfterNewParameterComma>True</AfterNewParameterComma>
- <BeforeTypeOfParentheses>False</BeforeTypeOfParentheses>
- <WithinCheckedExpressionParantheses>False</WithinCheckedExpressionParantheses>
- <ConditionalOperatorBeforeConditionSpace>True</ConditionalOperatorBeforeConditionSpace>
- <ConditionalOperatorAfterConditionSpace>True</ConditionalOperatorAfterConditionSpace>
- <ConditionalOperatorBeforeSeparatorSpace>True</ConditionalOperatorBeforeSeparatorSpace>
- <ConditionalOperatorAfterSeparatorSpace>True</ConditionalOperatorAfterSeparatorSpace>
- <SpacesWithinBrackets>False</SpacesWithinBrackets>
- <SpacesBeforeBrackets>False</SpacesBeforeBrackets>
- <BeforeBracketComma>False</BeforeBracketComma>
- <AfterBracketComma>True</AfterBracketComma>
- <SpacesBeforeForSemicolon>False</SpacesBeforeForSemicolon>
- <SpacesAfterForSemicolon>True</SpacesAfterForSemicolon>
- <SpacesAfterTypecast>False</SpacesAfterTypecast>
- <SpacesBeforeArrayDeclarationBrackets>False</SpacesBeforeArrayDeclarationBrackets>
- <BlankLinesBeforeUsings>0</BlankLinesBeforeUsings>
- <BlankLinesAfterUsings>1</BlankLinesAfterUsings>
- <BlankLinesBeforeFirstDeclaration>0</BlankLinesBeforeFirstDeclaration>
- <BlankLinesBetweenTypes>1</BlankLinesBetweenTypes>
- <BlankLinesBetweenFields>0</BlankLinesBetweenFields>
- <BlankLinesBetweenEventFields>0</BlankLinesBetweenEventFields>
- <BlankLinesBetweenMembers>1</BlankLinesBetweenMembers>
- <BlankLinesInsideRegion>1</BlankLinesInsideRegion>
- <BlankLinesAroundRegion>1</BlankLinesAroundRegion>
- <IndentPreprocessorDirectives>True</IndentPreprocessorDirectives>
- <IndentBlocksInsideExpressions>False</IndentBlocksInsideExpressions>
-</CSharpFormattingPolicy> \ No newline at end of file
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/policies/WhitesmithsCSharpPolicy.xml b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/policies/WhitesmithsCSharpPolicy.xml
deleted file mode 100644
index f4ed3e864e..0000000000
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/policies/WhitesmithsCSharpPolicy.xml
+++ /dev/null
@@ -1,164 +0,0 @@
-<!--
-
-WhitesmithsCSharpPolicy.xml
-
-Author:
- Mike Krüger <mkrueger@xamarin.com>
-
-Copyright (c) 2012 Xamarin Inc. (http://xamarin.com)
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
--->
-
-<CSharpFormattingPolicy scope="text/x-csharp" allowDiffSerialize="False">
- <IndentNamespaceBody>True</IndentNamespaceBody>
- <IndentClassBody>True</IndentClassBody>
- <IndentInterfaceBody>True</IndentInterfaceBody>
- <IndentStructBody>True</IndentStructBody>
- <IndentEnumBody>True</IndentEnumBody>
- <IndentMethodBody>True</IndentMethodBody>
- <IndentPropertyBody>True</IndentPropertyBody>
- <IndentEventBody>True</IndentEventBody>
- <IndentBlocks>True</IndentBlocks>
- <IndentSwitchBody>True</IndentSwitchBody>
- <IndentCaseBody>True</IndentCaseBody>
- <IndentBreakStatements>True</IndentBreakStatements>
- <AlignEmbeddedStatements>True</AlignEmbeddedStatements>
- <SimplePropertyFormatting>AllowOneLine</SimplePropertyFormatting>
- <AutoPropertyFormatting>AllowOneLine</AutoPropertyFormatting>
- <NamespaceBraceStyle>NextLineShifted</NamespaceBraceStyle>
- <ClassBraceStyle>NextLineShifted</ClassBraceStyle>
- <InterfaceBraceStyle>NextLineShifted</InterfaceBraceStyle>
- <StructBraceStyle>NextLineShifted</StructBraceStyle>
- <EnumBraceStyle>NextLineShifted</EnumBraceStyle>
- <MethodBraceStyle>NextLineShifted</MethodBraceStyle>
- <AnonymousMethodBraceStyle>NextLineShifted</AnonymousMethodBraceStyle>
- <ConstructorBraceStyle>NextLineShifted</ConstructorBraceStyle>
- <DestructorBraceStyle>NextLineShifted</DestructorBraceStyle>
- <PropertyBraceStyle>NextLineShifted</PropertyBraceStyle>
- <PropertyGetBraceStyle>NextLineShifted</PropertyGetBraceStyle>
- <PropertySetBraceStyle>NextLineShifted</PropertySetBraceStyle>
- <SimpleGetBlockFormatting>AllowOneLine</SimpleGetBlockFormatting>
- <SimpleSetBlockFormatting>AllowOneLine</SimpleSetBlockFormatting>
- <EventBraceStyle>NextLineShifted</EventBraceStyle>
- <EventAddBraceStyle>NextLineShifted</EventAddBraceStyle>
- <EventRemoveBraceStyle>NextLineShifted</EventRemoveBraceStyle>
- <AllowEventAddBlockInline>True</AllowEventAddBlockInline>
- <AllowEventRemoveBlockInline>True</AllowEventRemoveBlockInline>
- <StatementBraceStyle>NextLineShifted</StatementBraceStyle>
- <AllowIfBlockInline>False</AllowIfBlockInline>
- <ElseNewLinePlacement>SameLine</ElseNewLinePlacement>
- <ElseIfNewLinePlacement>SameLine</ElseIfNewLinePlacement>
- <CatchNewLinePlacement>SameLine</CatchNewLinePlacement>
- <FinallyNewLinePlacement>SameLine</FinallyNewLinePlacement>
- <WhileNewLinePlacement>SameLine</WhileNewLinePlacement>
- <ArrayInitializerWrapping>WrapIfTooLong</ArrayInitializerWrapping>
- <ArrayInitializerBraceStyle>EndOfLine</ArrayInitializerBraceStyle>
- <KeepCommentsAtFirstColumn>True</KeepCommentsAtFirstColumn>
- <BeforeMethodDeclarationParentheses>False</BeforeMethodDeclarationParentheses>
- <BetweenEmptyMethodDeclarationParentheses>False</BetweenEmptyMethodDeclarationParentheses>
- <BeforeMethodDeclarationParameterComma>False</BeforeMethodDeclarationParameterComma>
- <AfterMethodDeclarationParameterComma>True</AfterMethodDeclarationParameterComma>
- <WithinMethodDeclarationParentheses>False</WithinMethodDeclarationParentheses>
- <BeforeMethodCallParentheses>False</BeforeMethodCallParentheses>
- <BetweenEmptyMethodCallParentheses>False</BetweenEmptyMethodCallParentheses>
- <BeforeMethodCallParameterComma>False</BeforeMethodCallParameterComma>
- <AfterMethodCallParameterComma>True</AfterMethodCallParameterComma>
- <WithinMethodCallParentheses>False</WithinMethodCallParentheses>
- <BeforeFieldDeclarationComma>False</BeforeFieldDeclarationComma>
- <AfterFieldDeclarationComma>True</AfterFieldDeclarationComma>
- <BeforeLocalVariableDeclarationComma>False</BeforeLocalVariableDeclarationComma>
- <AfterLocalVariableDeclarationComma>True</AfterLocalVariableDeclarationComma>
- <BeforeConstructorDeclarationParentheses>False</BeforeConstructorDeclarationParentheses>
- <BetweenEmptyConstructorDeclarationParentheses>False</BetweenEmptyConstructorDeclarationParentheses>
- <BeforeConstructorDeclarationParameterComma>False</BeforeConstructorDeclarationParameterComma>
- <AfterConstructorDeclarationParameterComma>True</AfterConstructorDeclarationParameterComma>
- <WithinConstructorDeclarationParentheses>False</WithinConstructorDeclarationParentheses>
- <NewLineBeforeConstructorInitializerColon>NewLine</NewLineBeforeConstructorInitializerColon>
- <NewLineAfterConstructorInitializerColon>SameLine</NewLineAfterConstructorInitializerColon>
- <BeforeIndexerDeclarationBracket>True</BeforeIndexerDeclarationBracket>
- <WithinIndexerDeclarationBracket>False</WithinIndexerDeclarationBracket>
- <BeforeIndexerDeclarationParameterComma>False</BeforeIndexerDeclarationParameterComma>
- <AfterIndexerDeclarationParameterComma>True</AfterIndexerDeclarationParameterComma>
- <BeforeDelegateDeclarationParentheses>False</BeforeDelegateDeclarationParentheses>
- <BetweenEmptyDelegateDeclarationParentheses>False</BetweenEmptyDelegateDeclarationParentheses>
- <BeforeDelegateDeclarationParameterComma>False</BeforeDelegateDeclarationParameterComma>
- <AfterDelegateDeclarationParameterComma>False</AfterDelegateDeclarationParameterComma>
- <WithinDelegateDeclarationParentheses>False</WithinDelegateDeclarationParentheses>
- <NewParentheses>False</NewParentheses>
- <IfParentheses>True</IfParentheses>
- <WhileParentheses>True</WhileParentheses>
- <ForParentheses>True</ForParentheses>
- <ForeachParentheses>True</ForeachParentheses>
- <CatchParentheses>True</CatchParentheses>
- <SwitchParentheses>True</SwitchParentheses>
- <LockParentheses>True</LockParentheses>
- <UsingParentheses>True</UsingParentheses>
- <AroundAssignmentParentheses>True</AroundAssignmentParentheses>
- <AroundLogicalOperatorParentheses>True</AroundLogicalOperatorParentheses>
- <AroundEqualityOperatorParentheses>True</AroundEqualityOperatorParentheses>
- <AroundRelationalOperatorParentheses>True</AroundRelationalOperatorParentheses>
- <AroundBitwiseOperatorParentheses>True</AroundBitwiseOperatorParentheses>
- <AroundAdditiveOperatorParentheses>True</AroundAdditiveOperatorParentheses>
- <AroundMultiplicativeOperatorParentheses>True</AroundMultiplicativeOperatorParentheses>
- <AroundShiftOperatorParentheses>True</AroundShiftOperatorParentheses>
- <AroundNullCoalescingOperator>True</AroundNullCoalescingOperator>
- <WithinParentheses>False</WithinParentheses>
- <WithinIfParentheses>False</WithinIfParentheses>
- <WithinWhileParentheses>False</WithinWhileParentheses>
- <WithinForParentheses>False</WithinForParentheses>
- <WithinForEachParentheses>False</WithinForEachParentheses>
- <WithinCatchParentheses>False</WithinCatchParentheses>
- <WithinSwitchParentheses>False</WithinSwitchParentheses>
- <WithinLockParentheses>False</WithinLockParentheses>
- <WithinUsingParentheses>False</WithinUsingParentheses>
- <WithinCastParentheses>False</WithinCastParentheses>
- <WithinSizeOfParentheses>False</WithinSizeOfParentheses>
- <BeforeSizeOfParentheses>False</BeforeSizeOfParentheses>
- <WithinTypeOfParentheses>False</WithinTypeOfParentheses>
- <WithinNewParentheses>False</WithinNewParentheses>
- <BetweenEmptyNewParentheses>False</BetweenEmptyNewParentheses>
- <BeforeNewParameterComma>False</BeforeNewParameterComma>
- <AfterNewParameterComma>True</AfterNewParameterComma>
- <BeforeTypeOfParentheses>False</BeforeTypeOfParentheses>
- <WithinCheckedExpressionParantheses>False</WithinCheckedExpressionParantheses>
- <ConditionalOperatorBeforeConditionSpace>True</ConditionalOperatorBeforeConditionSpace>
- <ConditionalOperatorAfterConditionSpace>True</ConditionalOperatorAfterConditionSpace>
- <ConditionalOperatorBeforeSeparatorSpace>True</ConditionalOperatorBeforeSeparatorSpace>
- <ConditionalOperatorAfterSeparatorSpace>True</ConditionalOperatorAfterSeparatorSpace>
- <SpacesWithinBrackets>False</SpacesWithinBrackets>
- <SpacesBeforeBrackets>False</SpacesBeforeBrackets>
- <BeforeBracketComma>False</BeforeBracketComma>
- <AfterBracketComma>True</AfterBracketComma>
- <SpacesBeforeForSemicolon>False</SpacesBeforeForSemicolon>
- <SpacesAfterForSemicolon>True</SpacesAfterForSemicolon>
- <SpacesAfterTypecast>False</SpacesAfterTypecast>
- <SpacesBeforeArrayDeclarationBrackets>False</SpacesBeforeArrayDeclarationBrackets>
- <BlankLinesBeforeUsings>0</BlankLinesBeforeUsings>
- <BlankLinesAfterUsings>1</BlankLinesAfterUsings>
- <BlankLinesBeforeFirstDeclaration>0</BlankLinesBeforeFirstDeclaration>
- <BlankLinesBetweenTypes>1</BlankLinesBetweenTypes>
- <BlankLinesBetweenFields>0</BlankLinesBetweenFields>
- <BlankLinesBetweenEventFields>0</BlankLinesBetweenEventFields>
- <BlankLinesBetweenMembers>1</BlankLinesBetweenMembers>
- <BlankLinesInsideRegion>1</BlankLinesInsideRegion>
- <BlankLinesAroundRegion>1</BlankLinesAroundRegion>
- <IndentPreprocessorDirectives>True</IndentPreprocessorDirectives>
- <IndentBlocksInsideExpressions>True</IndentBlocksInsideExpressions>
-</CSharpFormattingPolicy> \ No newline at end of file