Skip to content
Streamlordv0.23.0

The editors

A VS Code extension and an IntelliJ plugin that read Datastar as a language.

Datastar lives inside attribute values and inside Kotlin strings, two places where no editor checks anything on its own. That is what these are for.

IntelliJ IDEA 2026.1 and newer, Community and Ultimate alike.

What they see

Diagnostics with quick fixes for Datastar expressions and markup: inside Kotlin strings, whether handed to the DSL or standing free, and in HTML and template files. Kotlin $ interpolation traps, syntax errors with the right column, missing ids, unknown attributes and modifiers, capitals in keys, signal names the client cannot hold, and the places where Datastar’s own rewrite of an expression does what JavaScript would not, such as a $name in the text of a template literal that also holds a ${...}. An empty data-nonce on <html> is an error, since Datastar throws NonceRequired and does not start, and one that is no base64 value a warning, since a browser ignores it in the policy and blocks the scripts.

Unknown signals. A $name no file in the project defines is a warning, and so, in a Kotlin file, is a signal the server reads that no page declares (signal-never-declared). One switch in each editor turns both on and off: the setting streamlord.diagnostics.unknownSignals in VS Code, and its counterpart, the inspection Streamlord › Unknown signals, in IntelliJ.

Completions for signals, actions, attributes, modifiers, ids and classes. Signals are collected from the whole project, since the page that declares one is rarely the file that reads it. They work where the value runs over several lines or sits in single quotes, and in Kotlin strings, where a \$ or ${'$'} before the name stays as you wrote it.

Go to a signal, find where it is used, rename it. Ctrl+click (⌘+click on macOS) on a signal goes to every place the project defines it: a data-signals on the page, a patchSignals in the handler that answers it, a property of a signals class. Find usages lists those places and every expression that reads it, in markup and in Kotlin strings alike: Alt+F7 in IntelliJ, ⇧F12 in VS Code. Rename rewrites them all, each as its place needs: Shift+F6 in IntelliJ, F2 in VS Code.

<div data-signals:item-count="0">
  <button data-on:click="$itemCount++">Add</button>
  <span data-text="$itemCount"></span>
</div>
patchSignals("itemCount" to 3)

Rename itemCount to basketCount and the key becomes data-signals:basket-count, since the browser lowercases an attribute’s key and Datastar reads the kebab-case back as camelCase; the two reads and the pair in the handler become basketCount. A place that cannot hold the new name stops the rename before anything is written, and says which: a key whose __case modifier gives no spelling of the name back, a key of an object asked to move under another object, or a property of a signals class, which Kotlin’s own rename renames. In $user.name.length each part is its own signal: the caret on user renames user, on name it renames user.name.

Help inside an expression. Put the caret in the options of a backend action and completion offers the ones not yet written, each with what Datastar 1.0.5 does with it; hovering one says the same. Parameter info shows the action’s parameters with the one the caret is on: Parameter Info in IntelliJ (⌘P on macOS, Ctrl+P elsewhere), Trigger Parameter Hints in VS Code (⇧⌘Space on macOS, Ctrl+Shift+Space elsewhere), and on typing ( or ,. After data-on: come Datastar’s own events, datastar-fetch and datastar-signal-patch, then the DOM’s, with their pages on MDN where TypeScript names one. In Kotlin the help starts once the DSL call’s parenthesis is closed, as the IDE closes it for you.

<button data-on:click="@post('/save', {retry: 'error', retryMaxCount: 3})">Save</button>
<div data-on:datastar-fetch="evt.detail.type === 'error' && ($failed = true)"></div>

retry here is worth the hover: 'auto' retries only a request that fails on the network, 'error' is what also retries a 4xx or 5xx answer, and 'never' retries nothing.

Hover documentation, snippets, and syntax highlighting of the Datastar tokens only, never of your Kotlin or your HTML, which belong to your theme. In both editors the Datastar tokens take their colours from your theme too, through the standard scopes and keys it already colours. In IntelliJ a signal is coloured as a static field, an action such as @get and a modifier as a keyword, a global such as Math as a constant, and the parts of an attribute’s name as an HTML attribute’s name. Every one of IntelliJ’s own schemes colours each of them, classic Default, Darcula and the New UI’s Light and Dark alike; a name, a call and an operator stay as plain as in JavaScript. Settings | Editor | Color Scheme | Streamlord gives any of them a colour of your own.

A Stream Inspector that shows a live SSE stream decoded rather than as raw text, with saved requests in .streamlord/inspector.json that the two editors share.

Route code lenses in VS Code, gutter icons in IntelliJ.

The JVM template languages are covered: JTE, kte, FreeMarker, Velocity, Mustache and Pebble. Thymeleaf is plain HTML and needs nothing special. In VS Code, Twig, PHP and Razor files get the same colours, where their extension or VS Code’s own grammar reads them. Each engine’s own syntax in a value, ${...} in FreeMarker or {{ }} in Twig, keeps the engine’s colours and is left out of the checks, while the rest of the value is still checked; in JTE, kte, FreeMarker and Velocity that holds inside a JavaScript template too, since the engine writes it before the browser reads the page. Each editor knows the engine from the file’s own language, so a file associated with FreeMarker by a setting, or not yet saved, gets FreeMarker’s rules too.

Razor reads every @ before the browser does: @Model.Name, @(...) and @{...} are C#, and so is @post('/save'), which Razor tries to run as a method named post. Write Datastar’s actions with two: @@post('/save'), which Razor writes as the @post('/save') the browser reads. VS Code colours the first @ as Razor’s escape and the rest as Datastar’s action, and the checks read it as that action.

<button data-on:click="@@post('/cart/@Model.Id')">Add</button>

The Stream Inspector’s two files

The inspector keeps what you save in two files under .streamlord/ in the project. One is for the team and one is for you.

Share the requests, keep the variables to yourself. Commit .streamlord/inspector.json and ignore .streamlord/env.json:

# .gitignore
.streamlord/env.json

inspector.json holds the requests. Save one with Save in the inspector, or write the file by hand:

{
  "version": 1,
  "requests": [
    {
      "name": "feed",
      "url": "{{baseUrl}}/api/feed/{{partsnummer}}",
      "method": "POST",
      "signals": { "search": "ash" },
      "headers": { "X-Id": "7" }
    }
  ]
}

name and url are needed, and a name is held once, whatever its case. method is GET when left out. signals is an object or JSON text, and headers an object or Name: value lines.

env.json holds the values that differ from one machine to the next: the host, a token, the parameters of your routes. Edit variables in the inspector creates it:

{
  "baseUrl": "http://127.0.0.1:8081",
  "signals": { "search": "ash" },
  "headers": { "Authorization": "Bearer dev-token" },
  "params": { "partsnummer": "3000507723" }
}

Write {{baseUrl}} in the URL, {{signals}} in the signals field, {{headers}} in the headers field, and the name of a param, {{partsnummer}}, in the URL or the headers. Type {{ in a field to pick from the ones that are set. Without baseUrl in the file, it is where the server you started from the editor said it listens, and with nothing running the default base URL of the settings.

What a save keeps. Save and Delete change the one entry and leave the rest of inspector.json as it was written: the other entries, their layout, and what else the file holds. The entry that is saved is written in the layout above, with its members of your own such as a "note" after headers, and with signals and headers still objects where the new values allow it. So the diff a colleague reviews is the request that changed. With the file open in an editor, the Request list follows it as you type, saved or not, and Save and Delete change the editor’s text as one edit you can undo, keeping what you typed there.

What stops you, and where it says so. Both files are JSON and take no comments, and both have a schema, so the editor marks a mistake as you type it.

  • An entry of inspector.json without a name or a url, or a second entry of a name, is not read. The inspector names it in red under the Request list, and leaves it in the file.
  • An inspector.json that is not JSON, not an object with a requests list, or of another version than 1, is not read and not written over until it is fixed.
  • Any key of env.json but baseUrl, signals, headers and params, or a value of the wrong kind, stops every request until it is fixed, also one that uses no variable: a request is not sent half filled. The Variables box names the key.
  • The setting for another requests file takes a path inside the project, written with /, and not .streamlord/env.json. A path it refuses is said in the inspector, which shows the default file meanwhile.

One implementation, two editors

Everything they know comes from catalog/datastar-1.0.5.json, which the SDK’s own tests bind to the DSL, so the catalog cannot drift from the library without a test failing.

The checks live once, in streamlord-analysis: a Kotlin module with no dependency beyond streamlord-core, holding the Kotlin string reader, the JavaScript syntax check, the markup and attribute rules, the signal and selector collectors, the route finder and the inspector’s file format. Both editors run it: the IntelliJ plugin calls it on the JVM, and the VS Code extension runs the same Kotlin compiled to JavaScript. Its tests run on both, over one corpus of expressions, markup, HTML and Kotlin, each case with the issue codes, the ranges and the text every quick fix must leave behind. It lives in editors/vscode/test/fixtures/corpus. What is no issue, such as the signals a file declares, the routes it serves or the curl line of a saved request, is a case in fixtures/cases beside it. The JavaScript check is a port of acorn to Kotlin, so an expression parses the same in both editors.

You can call it too, which is worth doing in the tests of your own markup functions:

Analyzer().analyzeHtml(html)     // a template: attributes and expressions
Analyzer().analyzeKotlin(source) // a Kotlin file: the strings and the DSL calls in it

Each returns a list of Issue, and an issue carries the range it covers, a code, a message, a severity, its quick fixes, and a link into the Datastar reference where the reference has a page for it; an unclosed tag, for one, has none. analyzeHtml judges a template, so it checks attributes and expressions and leaves the id and completeness rules alone; those belong to markup handed to a patch, and validateMarkup is where they live. The analysis shows the test that runs it over a whole project in CI.

In IntelliJ specifically

The plugin adds what the IDE does not have. The Kotlin plugin already gives you completion, KDoc and type errors for the DSL, and @Language("HTML") on Streamlord’s parameters turns on HTML injection by itself. What the plugin brings is the Datastar checks, HTML injection into the strings that carry no annotation, and stepping aside for the official Datastar plugin’s attribute and DOM event completion when that one is installed. Its spell checking reads only the strings of a Datastar expression, in HTML and in the DSL calls and HTML strings of Kotlin, so $usrnm is no typo and 'Sav' still is; a template file IntelliJ reads as plain text, a .peb without its plugin, say, is still spelled whole.

And on this site

The code blocks on these pages are highlighted by the extension’s own TextMate grammars, with the same recommended colours it offers you. When the extension’s palette changes, the next build of this site follows.

That holds for the Datastar tokens, which are what these grammars are for. It does not hold for Kotlin itself: your editor colours Kotlin with the language server’s semantic tokens, and a static site has only the TextMate grammar, which says far less. Code here is greyer than code in your IDE, and that is why.

What went over the wire

The frames your last search produced, encoded by the same SseEncoder the golden-file tests check. Not a description of them. The frames.

Nothing yet. Search from the top of the page, and what the server sends will appear here.