@duza11/riot-v3-language-server
v1.0.1
Published
Language server for Riot.js v3 single-file components
Maintainers
Readme
@duza11/riot-v3-language-server
A standalone language server for Riot.js v3 single-file components.
The server is built on Volar and targets Riot.js v3 .tag files. It can be used by editors that support the Language Server Protocol, including Neovim, Helix, Zed, and other LSP clients.
Installation
Install the package with your preferred package manager:
npm install -g @duza11/riot-v3-language-serverOr run it from this repository:
pnpm --filter @duza11/riot-v3-language-server build
pnpm --filter @duza11/riot-v3-language-server exec riot-v3-language-serverWith Nix:
nix build github:duza11/riot-v3-language-server
./result/bin/riot-v3-language-serverCommand
riot-v3-language-serverThe server communicates over stdio.
TypeScript SDK
Volar requires a TypeScript SDK. This language server resolves it in the following order:
initializationOptions.typescript.tsdk- the bundled TypeScript SDK
Riot.js projects do not need to install TypeScript locally unless they want the language server to use a project-specific TypeScript version.
Configuration
Riot-specific initialization options are disabled by default:
| Option under initializationOptions.riotV3 | Default | Description |
| --- | --- | --- |
| allowDynamicPropertiesFromAnyAssignments | false | Allows dynamic child properties through inferred objects and arrays when the property also receives an inferred any value. |
| reportUnusedComponentMembers | false | Reports component fields and methods that are not read within the same component. |
init_options = {
riotV3 = {
allowDynamicPropertiesFromAnyAssignments = true,
reportUnusedComponentMembers = true,
},
}Restart the language server after changing initialization options.
Option behavior
allowDynamicPropertiesFromAnyAssignments propagates dynamic access through inferred nested objects and array elements, including static index and computed property assignments. Known child properties keep their inferred types. A null or undefined initializer is preserved as a nullable dynamic object, so optional chaining may still be required. Properties without an inferred any assignment, primitive properties, and root or nested properties with explicit JSDoc types remain strict.
reportUnusedComponentMembers emits TypeScript-compatible 6133 hints for unused Riot component fields and methods. The analysis is intentionally component-local: references from another component or file, including dynamic runtime access, do not mark a member as used. Keep the option disabled when the project relies heavily on those patterns.
Embedded languages
The JavaScript, TypeScript, HTML, CSS, SCSS, Less, and Emmet services read their standard configuration sections through workspace/configuration when the LSP client supports it. These settings are provided by the embedded language services and are not Riot-specific options.
Neovim Example
Using Neovim's built-in LSP client:
vim.api.nvim_create_autocmd({ "BufRead", "BufNewFile" }, {
pattern = "*.tag",
callback = function()
vim.bo.filetype = "riot_v3"
end,
})
vim.lsp.config("riot_v3", {
cmd = { "riot-v3-language-server", "--stdio" },
filetypes = { "riot_v3" },
root_markers = { "package.json", ".git" },
init_options = {
typescript = {
-- Optional. When omitted, the bundled TypeScript SDK is used.
-- tsdk = "/path/to/node_modules/typescript/lib",
},
riotV3 = {
-- Optional. Defaults to false.
-- allowDynamicPropertiesFromAnyAssignments = true,
-- reportUnusedComponentMembers = true,
},
},
})
vim.lsp.enable("riot_v3")If your LSP client starts servers without --stdio, use:
cmd = { "riot-v3-language-server" }VS Code
VS Code users should usually install the Riot.js v3 Language Features extension instead of configuring this package directly.
Supported Files
This server targets Riot.js v3 .tag files.
