Skip to main content

Editor extensions

Editor support covers both halves of a program: Tungsten kernels (.w) and Paint layouts (.paint).

LanguageVisual Studio CodeVim
TungstenSyntax highlighting, comment and bracket handling, and Unicode symbols typed by nameFile detection, syntax highlighting, and optional Unicode input mappings
PaintSyntax highlighting, and comment and bracket handlingFile detection and syntax highlighting

Getting the extensions: download the experimental SDK.

Visual Studio Code​

Tungsten​

The experimental SDK holds the extension unpacked, in <sdk>/share/tungsten/syntax_highlight/vscode/, where <sdk> is the SDK's directory. Install it in the Visual Studio Code on your own machine: copy that directory to ~/.vscode/extensions/tungsten there, and restart Visual Studio Code. In a Remote SSH window it runs there too, so completions don't wait on the network.

The extension opens .w files as Tungsten. It highlights the language, comments lines with // and blocks with /* */, and matches brackets, including a half-open range's [ and ). To see which version is installed, open View › Output and choose Tungsten in the output list.

Unicode symbols by name​

In a Tungsten file, type a backslash and a symbol's name, then pick the symbol from the completion list. For example, \forall gives ∀. The list opens at the backslash and shows each symbol and its meaning, and it narrows as you type. Picking an entry replaces the whole name, backslash included, and leaves the text after it. Whether Tab or Enter accepts an entry follows your Visual Studio Code suggestion keybindings.

Many symbols have more than one name: the usual LaTeX one and a shorter one. The operators and loop symbols:

NamesSymbolMeaning
\forall, \all∀for all: loop prefix
\in∈in: loop range
\smallin∊in: loop range
\leftarrow, \gets, \arrow←assign (<-)
\arrowplus←̟accumulate (<+-)
\leftarrowplus⥆accumulate (<+-)
\acc, \leftarrowonoplus⬲accumulate (<+-)
\sum∑dot product sum
\downarrow↓decreasing iterator
\infty, \inf∞infinite iterator end (INF)
\times×multiply (*)
\oplus, \xor⊕xor (^)
\bigoplus⨁xor (^)
\wedge, \land∧logical and (&&)
\vee, \lor∨logical or (||)
\neg, \lnot¬logical not (!)
\ne, \neq≠not equal (!=)
\le, \leq≤less or equal (<=)
\leqq≦less or equal (<=)
\ge, \geq≥greater or equal (>=)
\geqq≧greater or equal (>=)
\sll, \twoheadmapsfrom⬶shift left (<<)
\sar, \twoheadrightarrowtail⤖arithmetic shift right (x>>)
\slr, \twoheadmapsto⤅logical shift right (>>)

The list also has the characters a name can contain:

  • Greek letters:
    • every lowercase letter from \alpha to \omega, with \varepsilon (ε), \varphi (φ) and \varsigma (ς);
    • the uppercase letters that differ from Latin ones: \Gamma, \Delta, \Theta, \Lambda, \Xi, \Pi, \Sigma, \Upsilon, \Phi, \Psi and \Omega;
    • \nabla (∇), which can start a name.
  • Superscripts and subscripts: \^0 to \^9 give ⁰ to ⁹, and \_0 to \_9 give ₀ to ₉.
  • Marks: \prime gives ′, \vec the combining arrow above (v⃗), and \^T the transpose mark ᵀ.

Paint​

The SDK holds it in <sdk>/share/paint/syntax_highlight/vscode/paint/; copy that directory to ~/.vscode/extensions/paint and restart Visual Studio Code. The extension opens .paint files as Paint. It highlights the language, comments blocks with (* *), and matches brackets.

Vim​

The Vim support is plain syntax and ftdetect scripts for each language, which go in Vim's standard syntax and ftdetect directories. The SDK holds them in <sdk>/share/tungsten/syntax_highlight/vim/ and <sdk>/share/paint/syntax_highlight/vim/; copy their syntax and ftdetect directories into ~/.vim/. Restart Vim after installing them. .w files should report tungsten and .paint files should report paint when you run :set filetype?.

Greek letters and mathematical symbols​

The Tungsten Vim support provides an optional GreekKeymap() function for your .vimrc. Once that function is installed, its buffer-local insert-mode mappings use a colon prefix:

Type in Insert modeInsertsType in Insert modeInserts
:alphaα:AlphaΑ
:thetaθ:ThetaΘ
:phiφ:PhiΦ
:omegaω:OmegaΩ
<-←:prime′
:tildecombining tilde ◌̃:hatcombining circumflex ◌̂
::literal :

The mappings cover the Greek alphabet using the same lowercase/capitalized naming pattern shown above. They apply only to Tungsten buffers and are intentionally not enabled by the syntax plugin itself. Copy the complete function from the README rather than installing the examples in this table one at a time.

The keymap has no mapping for ∀, ∈ or ∞. Vim's built-in digraphs type them in Insert mode: Ctrl-K FA gives ∀, Ctrl-K (- gives ∈, and Ctrl-K 00 gives ∞. Vim's =< and >= digraphs give ≤ and ≥, which Tungsten reads as <= and >=.