Javelle .jvl — VS Code Extension
Editor support for Javelle Single-File Components (.jvl): formatting,
IntelliSense, auto-import, diagnostics with quick fixes, navigation and the
Javelle CLI/Studio tooling with fast live preview.
A .jvl file looks like:
<template>
<j-page class="j-page my-page">
<h1>{{ title }}</h1>
<j-button color="primary" variant="filled" data-jvl-on-click="refresh">Refresh</j-button>
</j-page>
</template>
<code lang="java">
@Component("my-page")
public final class MyPage {
@State private String title = "Hello, Javelle";
public void refresh() {
Composables.useNotify().info("Refreshed");
}
}
</code>
<style scoped>
.my-page { padding: var(--jv-space-lg); }
</style>
Fast Preview
Open a file in your Javelle app and click the Fast Preview icon in the
.jvl editor title, run Javelle: Fast Preview, or press Ctrl+K V
(Cmd+K V on macOS). The Explorer and editor context menus also offer it.
Fast Preview finds the nearest javelle.config.json, starts javelle dev
with jvl.previewMode and jvl.previewPort, and opens the running app beside
the editor without prompts. It waits for HTTP readiness and reuses the server
and panel on repeated clicks, keeping the app state and selected preview size.
Switching to another app restarts the server for that app. The preview toolbar
offers desktop, phone, landscape, tablet, PWA and SSR frames.
The requested file is saved before launching if it has unsaved changes.
Subsequent saves use Javelle's hot reload for templates, styles and Java;
web mode uses the existing CLI development pipeline without a Maven package
step. This previews the whole app, including its layout and routes. Components
are displayed where the app mounts them. JVM SSR mode still needs compilation.
With the default jvl.cliPath, generated apps use their scripts/javelle.sh
(scripts/javelle.bat on Windows) when present, otherwise javelle from PATH.
A configured relative CLI path such as bin/javelle resolves from the owning
workspace folder, including when the app is nested in a larger repository.
Remote workspaces forward the preview URL through VS Code.
Use Javelle: Stop Dev Server to stop it. Closing the panel keeps the server
available for the next preview; unloading the extension stops it. Startup
errors appear in Javelle .jvl output. Change jvl.previewPort if occupied,
or increase jvl.previewStartupTimeout for a first-time toolchain download or
SSR compilation. Starting a preview requires a trusted workspace.
Format Document (and format-on-save, range formatting) formats every block
with a Javelle-aware built-in formatter, then normalizes the file skeleton:
block tags at column 0, one blank line between blocks, template content
indented one level, Java and CSS at column 0 (matching the framework examples),
a single trailing newline.
- Template (HTML) — re-indents elements, wraps long attribute lists one per
line with
> on its own line, fills text and inline elements up to the print
width without introducing whitespace between adjacent inline elements, keeps
{{ }} interpolations, comments, <pre>/<textarea> content and named
<template #slot> blocks intact, and collapses whitespace in class values.
- Java — re-indents from brace/paren structure (blocks,
switch labels,
lambda and anonymous-class bodies, chained calls, continuation lines, JSON
object literals, text blocks kept verbatim) and normalizes spacing around
keywords, commas, parentheses, braces, assignment/comparison operators and
->. Lines are never split or joined.
- CSS / SCSS — one declaration per line, comma-separated selectors one per
line, spaced combinators,
property: value;, nested rules and at-rules,
} @else {, comments preserved.
Every built-in formatter is whitespace-only and verifies that before returning;
structurally broken markup or CSS is only re-indented, never rewritten.
Set jvl.format.template, jvl.format.code or jvl.format.style to
external to hand a block to the formatter VS Code has for that language
(when that formatter supports virtual documents) instead. External formatting
uses read-only snapshots and never creates Untitled editors. If a provider is
unavailable or requires files on disk, Javelle falls back to its built-in
formatter. The default built-in formatters cover HTML, Java, CSS and SCSS
without scratch documents.
jvl.format.printWidth and
jvl.format.indent* tune the layout.
If saving opens Untitled files, check your [jvl] settings: the old
javelle.vscode-jvl formatter ID selects the legacy extension. Select
digital-pages.vscode-jvl as editor.defaultFormatter, update this extension,
and reload VS Code. Existing Untitled tabs are left open so their contents are
not discarded.
IntelliSense
Template
<j-*> / <jx-*> component tags from the registries (333), local components
from components/*.jvl, structural HTML tags, j-include / j-component
snippets and closing-tag completion. Native form controls are filtered out
of the standard HTML suggestions.
- Attributes per component (derived from each component's Java builder and the
compiler's attribute contract, e.g.
variant, color, side, mode,
storage-key), common Javelle attributes, every directive family
(v-*, jv-* shorthands, data-jv-*, data-jvl-on-*, :attr, @event,
#slot) with modifier completion (v-model.trim, @click.prevent).
Attributes already on the tag are hidden.
- Attribute values: enum values (
variant="filled"), Javelle utility classes
plus classes from this file's <style> and template, Java action methods for
data-jvl-on-* / @event, writable @State fields for v-model, route
paths from app.route(...) / @Page for to=, resource paths for
j-include src=, Material icon names, drawer and tab-panel ids, runtime
action names.
- Expressions (
{{ }}, :attr, v-if, data-jv-text, handler arguments):
loop variables in scope, @State/@Prop/@Model fields, @Computed
values, actions, backing-class members, t('key') / tn() / env() /
$env. helpers, translation keys from i18n/*.json, .env keys, and
size() / isEmpty() / contains() idioms after a dot.
Java block
- Offline catalog of the public Javelle API (1,150 types, 6,700 methods
with Javadoc summaries) shipped in
data/javelle-types.json: type completion
with auto-import, static and instance member completion (Http.,
LocalStorage., Composables.useNotify()., plugins().get(X.class).,
local variables by declared type, enum constants, nested types), signature
help, and hover documentation — no Java language server required.
- Workspace types and the Java extension's Maven index remain merged in.
- Local fields and methods, annotations with snippets (
@Watch("field") offers
state fields, @Template("...") offers sibling templates, @Page("/...")
offers routes), browser facades (Console, Location, ...), storage keys
used in the file, and member-level snippets (state, computed, watch,
action, onMounted, httpGet, httpFunc, notify, ...).
- Organize imports (
source.organizeImports, command
Javelle: Organize Imports in Block) and an Import '...' quick fix on
any unimported Javelle type. jvl.autoImport controls automatic imports.
Style block
- Classes used in the template (first) and every Javelle utility/component
class after
., --jv-* design tokens inside var(), and for SCSS the
$variables and javelle-theme mixin of javelle-ui.variables.scss.
Diagnostics and quick fixes
Built-in lint (Problems panel, source javelle) mirrors the compiler and the
Javelle authoring rules:
| Rule |
Severity |
Quick fix |
Unclosed or duplicate <template>/<code>/<style> block |
error |
|
Plain <script> block |
error |
Convert to <code lang="java"> |
Native control (<button>, <input>, <form>, ...) in a template |
warning |
Replace with <j-button>, <j-input>, <j-checkbox>, ... |
data-jv-model / data-jv-text / data-jvl-on-click not matching the Java block |
warning |
Create the @State field or action method |
v-model / @event handler not found |
info |
Create the field or method |
Unknown v-* / jv-* directive (typo) |
warning |
|
Unregistered <j-*> component, unclosed / stray tag, duplicate attribute |
warning |
|
v-for without :key |
hint |
Add :key |
jvl.lint.* settings adjust severities or disable rules. Javelle: Check .jvl
File / Check All .jvl Files run javelle jvl <dir> --check --strict and
map the CLI's path:line:col: level: message output into Problems
(jvl.checkOnSave runs it on save).
Navigation and editing
- Outline/breadcrumbs: blocks, the component class with
@State fields,
computed values, watchers, hooks and actions, template element tree, style rules.
- Go-to-definition from template bindings to Java declarations, Java symbol
navigation (workspace source and Java extension index), hover for component
tags, attributes, directives, Javelle types/members and CSS tokens.
- Document links for
@Template("X.html"), j-include/j-component src,
stylesheet/script references and SCSS @use.
- Linked editing of paired tags (
editor.linkedEditing), auto-closing tags,
Enter/indent rules for tags, braces and Javadoc inside .jvl.
- Snippets:
jvl, jvl-page, jvl-form, jvl-for, jvl-if, jvl-include,
jvl-component, jvl-t, jvl-state, jvl-computed, jvl-watch,
jvl-hook, jvl-action, jvl-http, jvl-func, jvl-notify, jvl-json,
j-card, j-button, j-dialog, jvl-drawer, jvl-tabs, ...
Commands
- Javelle: Compile .jvl File / Compile All .jvl Files in Workspace —
javelle jvl.
- Javelle: Check .jvl File / Check All .jvl Files —
javelle jvl --check --strict into Problems.
- Javelle: Organize Imports in
Block.
- Javelle: Create App Shell Sample —
javelle create <app> --sample app-shell.
- Javelle: Fast Preview — start/reuse the current app and show it beside the editor without prompts.
- Javelle: Open Studio, Start Dev Server and Preview, Open Preview Panel,
Open DevTools Studio, Open Mobile Browser Preview, Inspect Current
Component, Show Dependency Graph, Export Debug Report.
Settings
| Setting |
Default |
Description |
jvl.cliPath |
javelle |
Path to the javelle CLI (bin/javelle for a repo launcher, or absolute). |
jvl.compileOnSave |
false |
Run javelle jvl <file> on save. |
jvl.checkOnSave |
false |
Run javelle jvl <dir> --check --strict on save and show diagnostics. |
jvl.autoClosingTags |
true |
Insert the closing tag when typing > in a template. |
jvl.autoImport |
always |
always, whenImportsPresent or never for accepted Java type completions. |
jvl.format.template / code / style |
builtin |
builtin Javelle formatter or the external VS Code formatter per block. |
jvl.format.printWidth |
100 |
Line width for attribute wrapping and text fill. |
jvl.format.indentTemplate / indentCode / indentStyle |
true / false / false |
Indent block content one level. |
jvl.lint.enabled |
true |
Built-in diagnostics. |
jvl.lint.nativeControls |
warning |
Severity for native form controls (off disables). |
jvl.lint.disabledRules |
[] |
Rule codes to disable. |
jvl.devToolsPort / devToolsWebSocket / devToolsToken |
8097 / "" / "" |
Javelle Studio server. |
jvl.previewPort / previewMode / previewUrl |
8080 / web / http://localhost:8080/ |
Preview panel defaults. |
jvl.previewStartupTimeout |
60 |
Maximum seconds to wait for HTTP readiness. |
.jvl files get their own Explorer and tab icon in icon themes that show
language icons (the default Seti theme does). Themes with their own file
mapping can reuse an existing icon instead, for example
"material-icon-theme.files.associations": { "*.jvl": "vue" } or
"vsicons.associations.files": [{ "icon": "vue", "extensions": ["jvl"], "format": "svg" }].
Emmet abbreviations in templates: add "emmet.includeLanguages": { "jvl": "html" }
to your settings.
Building
cd vscode-jvl
npm install
npm run data:sync # regenerate data/*.json from the framework sources
npm test # data freshness, compile, unit tests
data/jvl-tags.json (components and attributes), data/javelle-types.json
(Java API catalog) and data/jvl-styles.json (classes, tokens, Sass variables)
are generated by scripts/sync-*.mjs from the monorepo; npm test fails when
they are stale.
Press F5 in VS Code to launch an Extension Development Host, or package:
npx @vscode/vsce package
code --install-extension vscode-jvl-0.8.0.vsix
Repository layout
package.json — manifest (languages, grammar, snippets, commands, settings).
language-configuration.json — brackets, folding, indentation and Enter rules.
syntaxes/jvl.tmLanguage.json — TextMate grammar with embedded HTML / Java / CSS / SCSS.
snippets/*.code-snippets — Javelle snippets.
src/sfc.ts — block parser shared by every feature (depth-aware, mirrors SfcParser).
src/formatters/ — built-in HTML, Java and CSS/SCSS formatters and document assembly.
src/analysis/ — Java block, template and lint analysis (pure, unit-tested).
src/completions.ts, hover.ts, signatureHelp.ts, codeActions.ts,
diagnostics.ts, symbols.ts, links.ts, linkedEditing.ts — language features.
src/catalog.ts, data.ts, workspaceIndex.ts — Javelle API catalog, static data, workspace scans.
src/embedded.ts, javaSymbols.ts — embedded language bridge and Java symbol resolution.
src/format.ts, autoclose.ts, browserSource.ts, extension.ts — editor wiring and CLI commands.
src/fastPreview.ts, previewServer.ts — Fast Preview command, app discovery and dev-server lifecycle.
scripts/sync-*.mjs, data/ — generated framework knowledge.
test/ — node:test suites (formatters, analysis, providers with a mocked VS Code API).
Browser inspection
Install the companion Javelle Chrome Devtools and
open your app workspace. Open component in VS Code locates the inspected
Java owner's @Component declaration; Open page in VS Code locates its page.
The extension activates for vscode://digital-pages.vscode-jvl/open links.
Browser requests only resolve existing .jvl, .java and .html workspace
files; they cannot execute commands or open arbitrary external file URIs.
Changelog
See CHANGELOG.md.
| |