Skip to content

Overview

Alex edited this page May 28, 2024 · 5 revisions

Program overview

The program contains a code editor and an analysis viewer, on the left and right sides of the window respectively. The code editor displays and enables editing the current code, and the analysis viewer displays the syntactic or semantic analysis of the code in the code editor. The code is only modified from the code editor, or by pasting using the Paste over button.

The top bar has the following buttons:

  • Reset: Resets the current code to the initial code snippet that Syndiesis displays upon loading.
  • Paste over: Replaces the current code with the text found on the clipboard. If there is no text on the clipboard, nothing is pasted.
  • GitHub: Brings you here.
  • Settings: Enters the settings view.
  • Collapse all: Collapses all nodes in the syntax tree view.

Code editor

There is an active blinking cursor that indicates the current position of the cursor. When the cursor moves, a portion of the text is highlighted, which is the deepest syntax tree view node on the position of the cursor. Hovering over other syntax tree view nodes will also change the highlight.

Text can be edited using a plethora of navigation and manipulation operations, as shown in the keybinds too. Below are quickly listed:

  • Select
  • Delete
  • Cut/copy/paste
  • Increase/decrease indentation
  • Select (next) word
  • Select outer syntax node span

Limitations

The code editor has the following limitations or oversights:

  • Scripts that are easily supported in monospace in Fira Code are supported (more complicated scripts like Japanese, Chinese, etc. are not tested)
  • Zooming is not implemented
  • Tab display is fuzzy, this is planned to be fixed

Analysis view

The analysis view displays the syntax or semantic analysis of the current source. The nodes are expandable and collapsible. The node's children are lazily loaded on pointer hover or expansion. The tree has three analysis modes, Syntax, Symbol and Operation.

Syntax

The view displays the tree by analyzing all the components of each node, either a syntax node, a syntax token or its trivia and display values, sorted by ascending position in the document (code snippet).

Each syntax tree view node's children are automatically retrieved via reflection, with few filters to avoid repetition or unimportance. The filtered properties that are displayed for SyntaxNode are the ones with return types that involve expansion and traversal of the syntax tree. SyntaxToken is expanded into its positionally ordered structure including both the token's value and its surrounding trivia. Structured trivia nodes are also expandable with a GetStructure() node, containing the node representing the trivia's structure.

Symbol

The view displays a tree-like structure of the symbols defined from the given source, by displaying the root assembly symbol of the compilation instance for the document. The root will always be an ISourceAssemblySymbol, wherefrom all declared symbols are accessible. Their declaring syntax nodes are also tracked, meaning that jumping around the code editor will also hover the respective declared symbol.

The properties that are shown for each publicly consumable symbol interface are hand-picked. The real concrete type of the symbol is not shown.

Operation

The view displays a tree-like structure of the operations within the given source, through a custom OperationTree instance. The root will always be an OperationTree, which contains all the symbols that contain operations. The children of the symbol nodes are all the operations declared within the symbol. Symbols are all laid out in the same level, ignoring their nesting.

Node type legend

Each node in the analysis view has a discriminator which denotes the kind of the node, and what information it will display.

Syntax-related nodes:

Discriminator Meaning
C# CSharpSyntaxTree
VB VisualBasicSyntaxTree
N SyntaxNode
T SyntaxToken
SL [Separated]SyntaxList
TL SyntaxTokenList
D Display value
VL Trivia list
& Syntax reference
.. Text span

Trivia:

Discriminator Meaning
_ Whitespace
\n End of line
/* Comment
# Preprocessor directive
~ Disabled text (inactive text due to conditional preprocessor directives)

Symbols:

Discriminator Meaning
S ISymbol
SC IReadOnlyList<ISymbol>
A AttributeData
AL IReadOnlyList<AttributeData>
TC TypedConstant

Operations:

Discriminator Meaning
O IOperation
OL IReadOnlyList<IOperation>
OT OperationTree

Common type discriminators:

Discriminator Meaning
. General value
X Member throws exception upon accessing
Clone this wiki locally