This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SimpleClass | |
{ | |
public void SimpleMethod() | |
{ | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class CustomWalker : CSharpSyntaxWalker | |
{ | |
static int Tabs = 0; | |
public override void Visit(SyntaxNode node) | |
{ | |
Tabs++; | |
var indents = new String('\t', Tabs); | |
Console.WriteLine(indents + node.Kind()); | |
base.Visit(node); | |
Tabs--; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class DeeperWalker : CSharpSyntaxWalker | |
{ | |
static int Tabs = 0; | |
//NOTE: Make sure you invoke the base constructor with | |
//the correct SyntaxWalkerDepth. Otherwise VisitToken() | |
//will never get run. | |
public DeeperWalker() : base(SyntaxWalkerDepth.Token) | |
{ | |
} | |
public override void Visit(SyntaxNode node) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ClassMethodWalker : CSharpSyntaxWalker | |
{ | |
string className = String.Empty; | |
public override void VisitClassDeclaration(ClassDeclarationSyntax node) | |
{ | |
className = node.Identifier.ToString(); | |
base.VisitClassDeclaration(node); | |
} | |
public override void VisitMethodDeclaration(MethodDeclarationSyntax node) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
namespace Company.ProjectionBufferTutorial | |
{ | |
public static class VisualStudioServices | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<UserControl x:Class="Company.ProjectionBufferTutorial.MyControl" | |
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |
Background="{DynamicResource VsBrush.Window}" | |
Foreground="{DynamicResource VsBrush.WindowText}" | |
mc:Ignorable="d" | |
d:DesignHeight="300" d:DesignWidth="300" | |
Name="MyToolWindow"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Linq; | |
using System.Collections; | |
using System.ComponentModel; | |
using System.Drawing; | |
using System.Data; | |
using System.Windows; | |
using System.Runtime.InteropServices; | |
using Microsoft.VisualStudio.Shell.Interop; | |
using Microsoft.VisualStudio.Shell; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.ComponentModel.Composition; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
using Microsoft.VisualStudio.Text; | |
using Microsoft.VisualStudio.Text.Editor; | |
using Microsoft.VisualStudio.Text.Projection; | |
using Microsoft.VisualStudio.Utilities; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Diagnostics; | |
using System.Globalization; | |
using System.Runtime.InteropServices; | |
using System.ComponentModel.Design; | |
using Microsoft.Win32; | |
using Microsoft.VisualStudio; | |
using Microsoft.VisualStudio.Shell.Interop; | |
using Microsoft.VisualStudio.OLE.Interop; | |
using Microsoft.VisualStudio.Shell; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class EmtpyStatementRemoval : CSharpSyntaxRewriter | |
{ | |
public override SyntaxNode VisitEmptyStatement(EmptyStatementSyntax node) | |
{ | |
//Simply remove all Empty Statements | |
return null; | |
} | |
} | |
public static void Main(string[] args) |