Skip to content
| Marketplace
Sign in
Visual Studio Code>Programming Languages>Flaris Language SupportNew to Visual Studio Code? Get it now.
Flaris Language Support

Flaris Language Support

flaris-lang

|
75 installs
| (0) | Free
Flaris (.fls) language support: syntax highlighting, snippets, hover documentation, Go to Definition, analyzer diagnostics, a source formatter, a debugger with breakpoints, stepping and fiber inspection, and optional code generation and completions from a local Ollama model, checked by the compiler.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Flaris Language Support for Visual Studio Code

Syntax highlighting, code snippets, analyzer diagnostics, a source formatter and a full debugger for Flaris (.fls) files - breakpoints, stepping, variable inspection and fiber-aware call stacks, with no separate debug adapter to install. Optionally, a local model writes code for you, checked by the Flaris compiler before you see it.

Features

Syntax Highlighting

Complete syntax highlighting for all Flaris language features:

  • Keywords: fn, class, async, await, yield, if, for, foreach, iter, while, guard, enum, etc.
  • Built-in Modules: Console, Debug, Math, File, Array, Fiber, VM, and more
  • Type annotations: every type the compiler knows - int, string, fn (any callable), instance, fiber, stream, block and the sized-int aliases - including array element types ([int]), unions (object|nil) and a class name in return position
  • Comments: Line (//) and block (/* */) comments
  • Strings & Characters: Double-quoted and triple-quoted ("""…""") strings, full escape sequence support including \uXXXX
  • Numbers: Decimal, hexadecimal (0xFF), binary (0b101), octal (0o755), floats (including 1e5), and underscore separators (1_000_000)
  • Operators: All arithmetic, logical, bitwise, assignment operators, the ^^ power operator, and the ≈ approximate equality operator

Code Snippets

Quick snippets for common patterns (type prefix and press Tab):

Prefix Description
fn Function declaration
fna Async function
fns Static function
fni Inline function
fnjit Typed function (eligible for JIT compilation)
class Class declaration
classm Class with methods
if, ife If / If-else statements
for, foreach, while, do Loop statements (do expands a do-while)
foreachi Foreach with index
iter Iter loop (iter i from 0 to n)
switch Switch statement
try Try-catch block
log Console.WriteLine
logw Console.Write
assert Debug.Assert
dbgv Debug.Value
guard Debug.GuardAddress
bp Breakpoint
fiber Fiber.New
fresume Fiber.Resume
await Await async call
import Import statement
let, const Variable / constant declaration
arr Array literal
obj Object literal
main Main function

Language Features

  • Auto-closing: Brackets, parentheses, quotes
  • Comment toggling: Quick line/block comment with Ctrl+/ (or Cmd+/)
  • Bracket matching: Highlight matching brackets
  • Code folding: Fold functions, classes, and blocks
  • Smart indentation: Auto-indent based on context
  • Problem matcher: Inline error and warning squiggles from the analyzer
  • Auto tasks.json: When a workspace containing .fls files is opened for the first time, the extension automatically creates .vscode/tasks.json with run tasks (Ctrl+Shift+B to run the current file)

Code Intelligence

Hover a function, method, class, field, enum or constant to see its declaration, the comment written above it, and its parameter and return types:

// Persist the cache to disk as JSON. Returns false when the write fails.
fn Save(path: string): bool { ... }

Hovering Save shows that signature, that sentence, path: string, and Returns bool. Optional parameters (ttl?) are marked as optional, and hovering an imported name resolves through to the declaration it binds to rather than stopping at the import line. Any contiguous run of // comments directly above a declaration is used as its documentation - no special marker is needed.

Go to Definition (F12 / Ctrl+Click) jumps to the declaration of functions, methods, classes, enums, fields, constants and variables anywhere in the workspace. It is served from an index built once at startup and kept current as you type, so it also resolves declarations you have not saved yet.

Analyzer diagnostics run automatically: flarisvm --check analyses a file when it is opened and each time it is saved, and its warnings and syntax errors appear as squiggles with the analyzer's warning code attached. Problems reported inside an imported library are shown against that library's file. Run Flaris: Analyse Current File from the command palette to check on demand.

Formatting (Shift+Alt+F, or enable editor.formatOnSave) lays the file out canonically - indentation, spacing, brace placement and blank lines. The buffer is piped through flarisvm --format -, so it formats as typed rather than as last saved. Indentation follows the editor's own tab settings.

The VM re-tokenizes its own output and compares it against the input before emitting anything, so a format can only ever move whitespace - it cannot change what the program means. A buffer that does not tokenize (mid-edit, an unterminated string) is left untouched, with a note in the status bar.

Setting Purpose
flaris.vmPath Path to flarisvm for analysis, formatting and debugging. Empty prefers a flarisvm in the workspace root, otherwise the one on PATH
flaris.check.run onSave (default) or off
flaris.check.args Extra flags for analysis runs, e.g. ["--libs=./libs"]
flaris.format.maxWidth Right margin the formatter wraps at (default 100)

AI Assistance (optional, local)

With flaris.ai.enabled on, a model served by Ollama on your own machine writes Flaris code. Nothing is sent anywhere but the configured endpoint, and the feature is off until you enable it.

Flaris: Generate Code... (command palette, or the editor's context menu) asks what to write and inserts the result at the cursor. With a selection, it rewrites the selected code as described instead.

Before anything is inserted, the code is checked with flarisvm --check in place in your file, so the check sees your other functions and imports. If it adds compile errors, or a warning that always means a bug - an is that is never true, a member that is always nil, an async call that never runs - the model gets one more turn with exactly those problems and the corrected code is used. If problems remain after that, the code is still inserted and a warning names the first one. On held-out test tasks, this one retry raised the share of generated code that compiles and passes its tests from 75% to 85%.

Inline suggestions appear as ghost text while you type (Tab accepts). A suggestion the analyzer rejects on its own lines - a call to a function that does not exist, an argument of the wrong type - is asked for once more and otherwise not shown. If Ollama cannot be reached, suggestions pause for a minute rather than failing on every keystroke.

Setting Purpose
flaris.ai.enabled Turn the AI features on (default off)
flaris.ai.endpoint Ollama URL (default http://127.0.0.1:11434)
flaris.ai.model The Ollama model to use (default flaris-coder)
flaris.ai.inlineCompletions Inline suggestions while typing (default on, when AI is enabled)

The checks use the same flaris.vmPath and flaris.check.args as the analyzer diagnostics.

Debugging

Press F5 on a .fls file to debug it - no launch.json needed. Set breakpoints in the gutter, step with F10/F11, and inspect locals, object fields and array elements in the Variables pane.

Breakpoints can be added and removed while the program runs, the pause button interrupts a running program at the next source line, and Open Disassembly View shows the bytecode around the selected frame. Add Data Breakpoint at Address in the Breakpoints view (VS Code 1.90 or later) stops the program when that memory address is read or written, the watch Debug.GuardAddress sets.

The VM speaks the Debug Adapter Protocol itself (flarisvm --dap=<port>), over a loopback socket. Each fiber appears as a thread, so the thread picker lets you look at any fiber's stack while the program is paused.

A launch.json is only needed to change the defaults:

{
  "type": "flaris",
  "request": "launch",
  "name": "Debug current Flaris file",
  "program": "${file}",
  "cwd": "${workspaceFolder}",
  "vmArgs": ["--libs=./libs"]
}
Setting Purpose
program The .fls file to debug (defaults to the active editor)
vmPath Path to flarisvm. Defaults to a flarisvm in the workspace root if there is one, otherwise the one on PATH
vmArgs Extra VM flags, e.g. ["--libs=./libs"]
cwd Working directory for the VM
port Fixed adapter port; omit to pick one per session

Notes:

  • Debugging disables the JIT. A JIT-compiled function runs natively and never reports its source lines, so breakpoints inside one could not be reached; the VM says so on the Debug Console when it starts.
  • A file compiled with --strip carries no line information and cannot be stopped in.
  • Requires a flarisvm new enough to support --dap; older builds will report an unknown argument on the Debug Console.

Installation

Open Extensions (Ctrl+Shift+X / Cmd+Shift+X), search for Flaris, and click Install - or from a terminal:

code --install-extension flaris-lang.flaris

You also need the Flaris VM itself, which the extension runs and debugs:

curl -fsSL https://www.flaris-lang.org/install.sh | sh

See flaris-lang.org for Windows and manual installs.

Examples

Basic Example

// Fibonacci with recursion
fn fib(n) {
    if (n <= 1) {
        return n;
    }
    return fib(n - 1) + fib(n - 2);
}

fn Main() {
    Console.WriteLine(fib(10));
}

Classes and Inheritance

class Animal {
    fn Constructor(name) {
        this.name = name;
    }

    fn speak() {
        Console.WriteLine(this.name, "makes a sound.");
    }
}

class Dog : Animal {
    fn Constructor(name) {
        super.Constructor(name);
    }

    fn speak() {
        Console.WriteLine(this.name, "barks.");
    }
}

fn Main() {
    let d = new Dog("Rex");
    d.speak();
}

Async / Await

import { Http } from library("Http", "1.0");

fn async fetchData(url) {
    let response = await Http.GetAsync(url);
    return Json.Parse(response);
}

Fibers and Concurrency

fn Main() {
    let worker = Fiber.New(fn() {
        for (let i = 0; i < 5; i++) {
            Console.WriteLine("Work", i);
            yield i;
        }
    });

    Fiber.Resume(worker);
}

Error Handling

try {
    let data = Json.Parse(rawInput);
} catch (e) {
    Console.WriteLine("Parse failed:", e.Error, "code:", e.Code);
} finally {
    Console.WriteLine("Done.");
}

Approximate Equality

let x = 1.0 / 3.0;
if (x ≈ 0.333333) {
    Console.WriteLine("Close enough!");
}

JIT-compiled Functions

Eligible functions are JIT-compiled automatically - no keyword needed. Use typed parameters and return types; only arithmetic, comparisons, loops, array access, and Math.*/Char.* builtins are supported inside JIT-compiled functions - general calls are not. Run flarisvm --check <file> to see which functions can be JIT-compiled and why others cannot.

// Iterative inner loop compiled to native ARM64
fn sum(arr: [int], n: int) : int {
    let s: int = 0;
    iter (i from 0 to n) {
        s = s + arr[i];
    }
    return s;
}

Keyboard Shortcuts

  • Ctrl+/ (Mac: Cmd+/) - Toggle line comment
  • Shift+Alt+A (Mac: Shift+Opt+A) - Toggle block comment
  • Ctrl+Space - Trigger IntelliSense/snippets
  • Tab - Expand snippet
  • F12 / Ctrl+Click - Go to Definition
  • Tab on an inline suggestion - accept it (with flaris.ai.enabled)

Language Reference

Keywords

Control Flow:   if, else, while, do, for, foreach, iter, from, to, in, is
                switch, case, default, break, continue, return, guard
Functions:      fn, async, yield, await, inline, static
Variables:      let, var, const, global
OOP:            class, new, this, super, enum
Modules:        import, export, as, library
Error Handling: try, catch, finally, throw
Constants:      nil, true, false
Word Operators: and, or
Debug:          breakpoint

Built-in Modules

Array       Buffer      Char        Class       Collections Console
Convert     Crypto      Debug       Directory   Event       Ffi
Fiber       File        FileWatch   Hash        Json        Math
Memory      Net         Object      Os          Path        Random
Regex       Scheduler   Stream      String      Time        Timers
Type        VM

Operators

Arithmetic:   +  -  *  /  %  ^^  ++  --
Assignment:   =  +=  -=  *=  /=  %=  ^^=  <<=  >>=  >>>=  &=  |=  ^=  ??=
Comparison:   ==  !=  <  >  <=  >=  ≈
Logical:      &&  ||  !  and  or
Bitwise:      &  |  ^  ~  <<  >>  >>>
Other:        ??  =>

Issues & Feedback

Bug reports and feature requests are welcome on the Flaris Discord, or via the contact address at flaris-lang.org.

For a bug, please include the Flaris version (flarisvm --version), your OS, and a minimal .fls script that reproduces it.

More Information

  • Flaris Language Documentation
  • VSCode Extension Guidelines
  • TextMate Grammar Reference

License

MIT

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
  • Your Privacy Choices
  • Consumer Health Privacy
© 2026 Microsoft