The most revolutionary syntax visualizer and more for C# and Visual Basic
The project was inspired by the task for applying into a Roslyn internship position regarding C# syntax highlighting at JetBrains (possibly dead links: project / task)
The main design inspiration is SharpLab. The syntax view feature of SharpLab is the main design that the app built upon.
Despite not applying for the internship, I wanted to finish the project and release it into a usable state without entering the depths of feature creep.
For Windows, download from the Releases page. For macOS and Linux, you have to manually compile the program (refer to the section below).
The program is designed to be cross-platform for desktop (including Windows, Linux and macOS). It's heavily tested to run on Windows 10, and it's moderately tested on Windows 11 and macOS. Please file an issue if platform-specific problems occur.
Check the change log here.
View the wiki for detailed documentation.
To compile this program you will need an IDE like Visual Studio 2022, or JetBrains Rider 2024.1. Load the solution file (Syndiesis.sln
) from the IDE of your choice and build the project (recommended to switch to Release mode).
The video was shot in version 1.2.0
Syndiesis.1.2.0.demo.mp4
- Visual Studio 2022
- .NET 8.0
- C# 12.0
- Avalonia 11.0
- Roslyn 4.10.0
- AvaloniaEdit, for the code editor
- jamarino/IntervalTree, for the diagnostics
Below is a short list of features:
- Code editor
- AvaloniaEdit's features
- Syntax and semantic colorization
- Go to definition using F12
- Custom nagivation to outer syntax nodes based on the current selection
- Diagnostics display
- Automatic recognition of the snippet's language (C# or VB)
- Selection of any available language version
- Syntax and semantic analysis visualizer
- Current caret syntax node highlighting
- Tree view of nodes
- Display of property names of syntax objects
- Colorful display of different analysis list view nodes
- Navigation to code snippet span of selected node
- Syntax, symbol, operation and attribute analysis
- Node details view
- Indication of throwing properties per node
- Loading nodes respects responsiveness of the app
A large portion of the app is built using basic components in Avalonia. The code editor is from AvaloniaEdit. Some icons were taken from the free version of FontAwesome.
Any issues regarding the code editor are most likely to be reported in AvaloniaEdit. This includes behavior not specific to Syndiesis. Issues will be closed if they are specific to AvaloniaEdit, and must be reported there.
Syndiesis exposes data retrieved from Roslyn itself with minimal intervention for readability purposes. If you encounter misrepresented data, it is probably a Roslyn bug, but feel free to report it regardless. Examples of known Roslyn bugs include:
- In
#pragma warning xyz CS0123
, semantic model considersCS0123
as a preprocessing symbol. (dotnet/roslyn#72907) GetChildTokens()
returning tokens with no parentSyntaxTree
and their spans beginning at position 0.
Desired features among other issues are listed in the issues.
- Auto-complete on text
The syntax visualizer should provide detailed information about how Roslyn parses the given C# code snippet, and in a pretty and user-friendly format. SharpLab lacks in readability of the tree, and it also doesn't paint the entire picture as intended.
The properties of the nodes are automatically extracted via reflection. Some are filtered out due to duplication in most cases, and in other cases they were not providing any helpful information.
Each different node type is differently treated to extract the most useful information out of it. If you encounter a node missing critical information, or displaying it weirdly, please file an issue.
With 1.1.0 onwards, the program's direction was shifted more towards explaining and visualizing the expected results by using Roslyn itself. This expands the initial scope of the program into being a handy utility making the usage of Roslyn more predictable, especially when testing analyzers or source generators.
On 1.2.0 the node details view was added, focusing more on giving direct feedback for the specified node. This also helps with troubleshooting issues and discovering potential bugs in Roslyn itself.