Vela ships a language server, vela-rbxts-lsp, and a VS Code extension that runs it. The server
uses the same compiler as your build, so what the editor says about a class is what the build does.
VS Code
Install Vela Roblox IntelliSense from the marketplace. It needs VS Code ^1.91.0.
code --install-extension astra-void.vela-rbxts-lspOpen a .tsx or .ts file and the server starts. There is nothing to enable per project.
Settings
A change to a velaRbxts.lsp.* setting restarts the server for you. The others apply at once.
| Prop | Type | Description |
|---|---|---|
| velaRbxts.lsp.serverPath | string | Path to a server binary. A relative path is resolved against the workspace root. Defaults to "", meaning auto-resolve. |
| velaRbxts.lsp.trace.server | "off" | "messages" | "verbose" | LSP protocol trace written to the extension's output channel. Defaults to "off". |
| velaRbxts.lsp.enabled | boolean | Whether to start the server at all. Defaults to true. |
| velaRbxts.inlayHints.enabled | boolean | Show what each class lowers to as an inlay hint after the class. Defaults to false. |
| velaRbxts.classFunctions | string[] | Helpers whose arguments are class lists wherever they are called, such as ["cn", "cva"]. Defaults to []. |
| velaRbxts.lint | Record<string, "error" | "warning" | "info" | "hint" | "ignore"> | A level per diagnostic code, replacing the default one. Defaults to {}. |
| velaRbxts.validate | boolean | Whether to show Vela diagnostics. Completions, hover and colors keep working when it's off. Defaults to true. |
To quiet one check or make another fail loudly, set its code. Every diagnostic shows its code:
{ "velaRbxts.lint": { "overridden-class": "ignore", "unknown-theme-key": "error" }}Commands
Run these from the command palette:
- Vela: Restart Language Server restarts the server and re-reads every
vela.config, without reloading the window. - Vela: Show Output opens the server’s output channel.
- Vela: Sort Classes sorts the classes in the active file.
How the server binary is resolved
If velaRbxts.lsp.serverPath is set, the extension runs that binary. Otherwise it runs the server
bundled for your platform.
Linux arm64 musl and Windows on ARM need a source build. Point velaRbxts.lsp.serverPath at the result.
The bundled platforms are darwin arm64 and x64, linux x64 gnu and musl, linux arm64 gnu, and win32
x64. There is no cargo run fallback, so set serverPath when you work on the server itself.
When your config fails to load
If the extension can’t load your vela.config.ts, it shows a notification naming the file and the
reason. Fix the file and save. The notification clears once the config loads. Until then the editor
uses the default theme, so your custom keys show as unknown.
What the language server provides
- Completions inside a
className, triggered by-,:,",'and space. A completion replaces only the segment under the cursor. Some scales list only common values. For example,opacity-*suggests round numbers, but any integer from 0 to 100 compiles. - Hover shows what a class resolves to. Scaled offsets read in rem first, such as
1rem (16px at the base viewport). If your config pins rem, hovers use plain pixels. - Diagnostics as you type. While you’re still typing a real key,
unknown-theme-keywaits:bg-slastays quiet on the way tobg-slate-800, butbg-nopewarns at once. - Color swatches in the gutter, editable with the editor’s color picker.
- Quickfixes for Vela diagnostics: up to three suggested replacements, plus “remove token”.
- Document highlight for other uses of the token under the cursor.
- Inlay hints, off by default. Turn on
velaRbxts.inlayHints.enabledto see them:
<frame className="p-4 rounded-l-lg" />// ↑ UIPadding.PaddingTop/Right/Bottom/Left// ↑ UICorner.TopLeftRadius, BottomLeftRadiusAll of these work anywhere a class string can appear in a className. That includes a function
(how Vide writes a dynamic class), template interpolations, as const,
satisfies, string concatenation, and object keys and spreads.
They also work on a const string that a className names, at the place it’s declared:
const base = "px-4 bg-slate-700"; // completed, checked and sorted here<frame className={cn(base, active && "p-2")} />The editor reads the same consts the compiler lowers. A let, a const declared after the class
value, or one inside another function isn’t read.
A helper called outside a className, such as a cva recipe at the top of the file, is read only
once you list it in velaRbxts.classFunctions:
// with "velaRbxts.classFunctions": ["cva", "tw"]const button = cva("px-4 rounded-md", { variants: { size: { sm: "text-sm", lg: "text-lg" } },});const card = tw`p-4 bg-slate-800`;In an object, a key counts as a class list only when its value is a condition, as in clsx. In a
cva-style map, defaultVariants and the variant names in compoundVariants are skipped.
The server does not provide go-to-definition, references, rename, formatting, semantic tokens or signature help. Your editor uses its TypeScript service for those.
text-* on a frame, image-* on a label, and placeholder-* outside a textbox raise unsupported-host-utility in the editor. The build compiles them without complaint and writes the property onto the wrong instance.
On a component like <Panel />, the editor can’t know which element it renders. It offers every
utility there and never raises unsupported-host-utility.
Overridden classes
The editor warns when a later class overrides an earlier one. In bg-red-500 bg-blue-500, the
first class has no effect, so it gets an overridden-class warning naming the winner. It’s drawn
faded, and the quickfix removes it. A repeat like p-4 p-4 reports "p-4" is repeated later.
The check uses the compiler’s own resolver, so it always agrees with the build:
px-2 p-4warns onpx-2.p-4 px-2stays quiet, becausepx-2only overrides part ofp-4.w-4 h-8andfont-mono font-boldcombine into one property and stay quiet.bg-red-500/50 bg-blue-500warns onbg-red-500/50. The solid color also replaces the/50.opacity-50 opacity-75anddivide-y divide-red-500/50 divide-blue-500warn too.- A
bg-*before a gradient warns and names the gradient. A gradient forcesBackgroundColor3to white.
Only classes under the same condition are compared. bg-red-500 hover:bg-blue-500 and
md:px-6 max-md:px-3 never warn. md:hover: and hover:md: count as the same condition.
This is an editor-only lint. Builds never report it.
Arbitrary values with a named class
An arbitrary value that lowers exactly like a named class gets a canonical-class note at info
level, and the quickfix swaps in the name:
<frame className="w-[16px] h-[100%]" />// ↑ w-4 ↑ h-fullThe named class follows your theme, so a later change to the scale reaches it. Your own theme’s
steps count: if your spacing scale names card as 18 pixels, px-[18px] points at px-card.
Variants are kept, so hover:w-[16px] points at hover:w-4.
Sorting class names
The source action source.sortVelaClasses puts every className in the file into a standard order:
layout, sizing, spacing, colors, radius, typography, then classes with variant prefixes.
<frame className="text-lg bg-blue-600 flex p-4 hover:bg-blue-700 rounded-lg w-full" /><frame className="flex w-full p-4 bg-blue-600 rounded-lg text-lg hover:bg-blue-700" />Sorting never changes what your classes do:
- Classes that can set the same Roblox property keep their order. A
px-4afterp-2stays after it. - Variant chains sort by the conditions they name.
hover:md:bg-red-500 md:hover:bg-blue-500keeps its order because both name the same two conditions. - A longer chain sorts after the shorter one it extends, so
dark:hover:stays behinddark:.group-*andpeer-*sort betweenfocus:anddark:.
It doesn’t change your layout either. Whitespace and line breaks stay as written, and so does the
whitespace around template interpolations. A class with a space inside brackets, such as
w-[calc(100% - 4px)], moves as one class. A class whose bracket never closes is left alone.
Run it with Vela: Sort Classes, from the source-action menu, or on save:
{ "editor.codeActionsOnSave": { "source.sortVelaClasses": "explicit" }}To check the order in CI, run vela sort --check. Any LSP
client that supports source actions can request the sort by that kind. The same sort is available
as sortClassNames on @vela-rbxts/compiler. It takes { source, fileName } and returns
{ edits: [{ range: { start, end }, text }] }.
Other editors
The server speaks LSP over stdio and doesn’t depend on VS Code. Add it to your project:
pnpm add -D @vela-rbxts/lspnpm install -D @vela-rbxts/lspyarn add -D @vela-rbxts/lspbun add -d @vela-rbxts/lspThen set your editor’s server command to:
npx --package @vela-rbxts/lsp vela-rbxts-lspKeep --package. The binary is vela-rbxts-lsp, but the npm package is @vela-rbxts/lsp. A bare
npx vela-rbxts-lsp finds nothing, because that name belongs to the VS Code extension.
Text sync is incremental and positions are UTF-16. The server exits on the exit notification even
if the client keeps stdin open.
Pass your config to the server
The server never reads vela.config.ts itself. Your editor has to evaluate the config and send the
result in initializationOptions:
{ "workspaceRoot": "/abs/path/to/project", "configs": [ { "dir": "/abs/path/to/project", "json": "{\"theme\":{\"colors\":{ }}}" } ]}Keep workspaceRoot and configs as top-level siblings. If the payload doesn’t parse, the server uses zero configs and every custom key reports unknown-theme-key.
Each entry is a directory plus that directory’s resolved config as a JSON string. A file uses the
config of its nearest containing dir, which is how per-package configs in a monorepo work.
To update configs after startup, send the custom method vela-rbxts/setConfigs with only
configs in the payload.
The VS Code extension does exactly this. It finds every vela.config.ts, vela.config.json and
vela.css, evaluates each directory’s config through @vela-rbxts/rbxtsc-host/project-config, and
sends { dir, json } pairs at startup. It sends them again when any of those files or any .css
file changes, so stylesheets pulled in with @import are followed too.
Your client can build the JSON any way it likes. It only has to match the resolved TailwindConfig
shape.
The VS Code settings classFunctions, lint and validate go in initializationOptions too, with
the same names and values. To change them later, send workspace/didChangeConfiguration with them
under velaRbxts. The server re-checks open files when lint or validate changes. A level it
doesn’t know is dropped, and the rest of the settings still apply.
Platform packages
The vela-rbxts-lsp launcher picks one of six platform packages, installed as optional
dependencies:
@vela-rbxts/lsp-darwin-arm64@vela-rbxts/lsp-darwin-x64@vela-rbxts/lsp-linux-arm64-gnu@vela-rbxts/lsp-linux-x64-gnu@vela-rbxts/lsp-linux-x64-musl@vela-rbxts/lsp-win32-x64-msvc
The launcher also looks for @vela-rbxts/lsp-linux-arm64-musl and
@vela-rbxts/lsp-win32-arm64-msvc, but neither is published. On those platforms, build from source.
See also
- Configuration: the config shape the server expects.
- Diagnostics: every code the editor can show, and which also appear in a build.
- Dynamic class names: the case the editor can’t help with, because nothing is reported.