Trait-C for Visual Studio Code
This extension adds language support for Trait-C to Visual Studio Code.
Quick Start
- Install the Trait-C compiler.
- Install this Trait-C extention for Visual Studio Code.
- Open or create a *.tc file and start coding!
Features
The following features are provided:
1. Syntax Highlighting
The keywords of Trait-C are highlighted. Also, the syntax of C code, embedded in Trait-C templates, is highlighted.
2. Snippets
Snippets make it easier to enter repeating code patterns. The following Trait-C code snippets are defined:
- type declaration
- trait declaration
- trait implementation
- generic trait implementation
- function item declaration
- function item definition
- constant item definition
- fragment declaration
- tcdoc annotations (used by the tool
tcdoc
)
Also, you can see the available snippets by running Insert Snippet
in the Command Palette.
3. Problem Matcher
Errors and warnings emitted by the Trait-C compiler are shown in the Problems
view of Visual Studio Code. Each problem is also marked and described within the code, e.g. like this:
The problem matcher can be used in a tasks.json
file via its name reference $traitcc
, like so:
{
"version": "2.0.0",
"tasks": [
{
"label": "build",
"type": "shell",
"group": {
"kind": "build",
"isDefault": true
},
"command": "traitcc compile src",
"problemMatcher": "$traitcc"
}
]
}
The compilation of the Trait-C code is started with the command traitcc compile src
. In case of a problem, the output of the Trait-C compiler is the input of the problem matcher. By running the task, the problem matcher $traitcc
is activated.