aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/DialogOpenMode.cs
blob: 0d46a97346ea71a13bc8e0b9f3687d82b68dc387 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Tango.MachineStudio.DB.ViewModels
{
    public enum DialogOpenMode
    {
        Editing,
        Adding,
    }
}
System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Tango.Scripting.Formatting { public static class CodeFormatter { public static String Format(String code) { SyntaxTree tree = CSharpSyntaxTree.ParseText(code); CompilationUnitSyntax root = tree.GetCompilationUnitRoot(); //var node = ApplyBraceNewLineRule(root); //node = ApplyCopyrightHeaderRule(node); //node = ApplyNewLineAboveRule(node); //node = ApplyUsingLocationRule(node); //Just to make VS copy the dll to output folder. Microsoft.CodeAnalysis.CSharp.Formatting.BinaryOperatorSpacingOptions a = Microsoft.CodeAnalysis.CSharp.Formatting.BinaryOperatorSpacingOptions.Ignore; var node = Formatter.Format(root, new AdhocWorkspace()); return node.ToString(); } //private static SyntaxNode ApplyUsingLocationRule(SyntaxNode node) //{ // UsingLocationRule rule = new UsingLocationRule(); // return rule.Process(node, "CSharp"); //} //private static SyntaxNode ApplyBraceNewLineRule(SyntaxNode node) //{ // BraceNewLineRule rule = new BraceNewLineRule(); // return rule.Process(node, "CSharp"); //} //private static SyntaxNode ApplyNewLineAboveRule(SyntaxNode node) //{ // NewLineAboveRule rule = new NewLineAboveRule(); // return rule.Process(node, "CSharp"); //} //private static SyntaxNode ApplyCopyrightHeaderRule(SyntaxNode node) //{ // CopyrightHeaderRule rule = new CopyrightHeaderRule(new Microsoft.DotNet.CodeFormatting.Options() // { // }); // return rule.ProcessCSharp(node); //} } }