public void CommentWithoutASpace() { string unformattedCode = " //Some : FB_Some;\n"; uint indents = 0; string actual = new CompositeCode( unformattedCode: unformattedCode, singleIndent: singleIndent, lineEnding: lineEnding ) .Tokenize() .Format(ref indents); string expected = " //Some : FB_Some;\n"; Assert.Equal(expected, actual); }
/// <summary> /// This function is the callback used to execute the command when the menu item is clicked. /// See the constructor to see how the menu item is associated with this function using /// OleMenuCommandService service and MenuCommand class. /// </summary> /// <param name="sender">Event sender.</param> /// <param name="e">Event args.</param> private void Execute(object sender, EventArgs e) { ThreadHelper.ThrowIfNotOnUIThread(); DTE dte = Package.GetGlobalService(typeof(DTE)) as DTE; if (dte.ActiveWindow.ProjectItem.Object is ITcPlcDeclaration declaration) { dte.ActiveDocument.Save(""); int indents = 0; string text = declaration.DeclarationText; TcBlackCore.Globals.indentation = text.Contains("\t") ? "\t" : " "; TcBlackCore.Globals.lineEnding = "\r\n"; string formatedCode = new CompositeCode(text).Format(ref indents); declaration.DeclarationText = formatedCode; } }