Kanoniq for VS Code

One extension, Kanoniq: it reads, checks and builds the model as you type, and draws it beside the editor.

It colors .kq files, the plain-text form a Kanoniq model is stored in, and checks them as you type: parse errors, references that name nothing and the model's own rules show in the Problems panel, across every file of the model. Go to a definition, hover a name to read its description, find every reference, and rename a name in every file that uses it. Formatting keeps your comments, and saving builds the model, so every element keeps its identity without a command to run.

It draws the model. Right-click a .kq file or a folder and Show Kanoniq Viewer opens it beside the editor, kept live as you type, in your editor's light or dark theme. Click an element to see its details, follow a link to move to it, and step back and forward the way a browser does.

No server, no account: the model is parsed, checked and drawn on your machine.

  • extenza-works.vscode-kanoniq extension ID
  • 0.3.0 version
  • 1.101 minimum VS Code

orders.kq

1/// Takes orders on the website, keeps them, and hands them on to fulfilment.
2ecosystem shop "Shop" (SHOP) {
3
4 domain selling "Selling" {
5 function place-order "Place an order"
6 function fulfil-order "Fulfil an order"
7 }
8
9 broker events "Events" : kafka {
10 channel orders "Orders"
11 }
12
13 platform commerce "Commerce" {
14
15 object order "Order" : selling
16
17 component storefront "Storefront" : user-facing-app {
18 spa storefront-ui "Storefront UI"
19 }
20
21 /// The system of record for an Order.
22 component order-service "Order Service" : backend {
23 http-api order-service-api "Order Service API"
24 sql orders-db "Orders DB" {
25 root order authoritative origin
26 identifier "Order Id"
27 property "Placed at"
28 }
29 }
30
31 component fulfilment "Fulfilment" : backend
32
33 storefront/storefront-ui -> order-service/order-service-api over http
34 order-service -> fulfilment over events/orders
35
36 storefront realizes selling/place-order
37 order-service realizes selling/place-order
38 fulfilment realizes selling/fulfil-order
39 }
40}
41
  • keyword
  • kind
  • flag
  • name
  • date and period
  • description
  • comment

The coloring rules are generated from the grammar Kanoniq itself parses with, so a keyword added to the language is colored correctly the next time the extension is built — there is no second keyword list to fall behind.

Install it

  1. Install VS Code

    Don't have it yet?
    Visual Studio Code is free, for Windows, macOS and Linux.

  2. From VS Code

    Open the Extensions view (Ctrl+Shift+X), search for Kanoniq, and install the one published by Extenza Works.

  3. Or from a terminal

    code --install-extension extenza-works.vscode-kanoniq
  4. Open a .kq file

    The status bar shows Kanoniq as the file's language, and the file is checked and colored. Right-click it and choose Show Kanoniq Viewer. Nothing to configure.

Kanoniq on the Visual Studio Marketplace

What it does not do

The diagram shows the model; it does not edit it yet. Every change is made in the text, and editing in the diagram comes next.

There are no views you arrange by hand yet: every view is generated.

Exporting a diagram as PNG or SVG needs a paid license, and licenses are not on sale yet.