.kick in other editors
The VS Code extension bundles the .kick language server. Any editor with an LSP client can run the same server directly: errors as you type, completion, hover, go to definition and formatting all come from it, not from the extension.
The server
pnpm add -D @forinda/kickjs-view-language-server
npx -y -p @forinda/kickjs-view-language-server kick-view-ls --stdiokick-view-ls is the command, not a package. A bare npx kick-view-ls works only when npx finds the command locally, in the project the editor starts it in; otherwise it looks for a package called kick-view-ls, gets a 404 and the server exits before it starts. With -p, npx uses the project's installed copy when there is one and otherwise downloads it once, whatever folder the editor starts it in. -y keeps npx from asking to install on the server's own stdin. The editor setups below run it this way, except Zed, whose extension downloads the server and runs it with Zed's Node.
- It speaks LSP over stdio. Start it from the project root, or send the project as the workspace folder. It reads the first workspace folder only.
- It treats any file ending in
.kickas a template, whatever language ID the editor sends. Sendkickwhen your editor lets you choose. - It watches templates and the pipes file itself (
workspace/didChangeWatchedFiles), so saving a component re-checks the pages that use it.
Highlighting
The server sends semantic tokens for the template syntax: @if and the other keywords, {{ }} and |, names and properties, pipes, component tags, @input names, strings, numbers and {{-- --}} comments. They use standard token types, so your theme colours them. Editors that show semantic tokens highlight templates without a grammar:
- Neovim: on by default.
- JetBrains IDEs (LSP4IJ): on by default.
- Zed: off by default. Turn it on for
.kickfiles in your settings:"languages": { "Kick": { "semantic_tokens": "combined" } }. - Helix: doesn't support semantic tokens, so only the HTML grammar applies.
Initialization options
Every editor below passes these as initializationOptions. Paths are relative to the workspace folder.
| option | default | |
|---|---|---|
viewsDir | src/views | |
componentsDir | components | inside viewsDir |
pipesFile | <viewsDir>/pipes.ts | |
layout | none | the same as createViews({ layout }): one name, or folder prefix → layout |
baseLayout | none | the same as createViews({ baseLayout }) |
trusted | false | true loads the project's own @forinda/kickjs-view, which runs its code. See below. |
trusted: with true, the server imports your installed @forinda/kickjs-view, so the editor checks and formats exactly as your build does. With false, it uses the copy bundled with the server, which may be a different version. Set true only for projects whose dependencies you trust: the VS Code extension sends it only for trusted workspaces.
Keep trusted out of project files
Set trusted only in your own editor config: init.lua, ~/.config/helix/languages.toml, your global coc-settings.json and so on. Some editors also read config from the project, like .helix/languages.toml or .vim/coc-settings.json. A repository you clone could ship one with trusted: true and run its code when you open a .kick file.
Template names in controllers
The server also reads TypeScript and JavaScript files, for the names in ctx.render('…') and views.render('…'): it completes template names, goes to the template, and warns when a name has no template. It leaves the rest of the file to your TypeScript tooling, with no formatting and no highlighting. To use it, attach the server to TS and JS files as well as .kick, as each editor section below shows.
Neovim
Neovim 0.11 or later, no plugins:
vim.filetype.add({ extension = { kick = 'kick' } })
-- HTML highlighting for the markup; the server colours the template syntax with semantic tokens.
vim.treesitter.language.register('html', 'kick')
vim.lsp.config('kick_views', {
cmd = { 'npx', '-y', '-p', '@forinda/kickjs-view-language-server', 'kick-view-ls', '--stdio' },
-- TS / JS too, for template names in ctx.render('…')
filetypes = { 'kick', 'typescript', 'javascript', 'typescriptreact', 'javascriptreact' },
root_markers = { 'kick.config.ts', 'package.json' },
init_options = { trusted = true },
})
vim.lsp.enable('kick_views')Vim
Both setups below need .kick files to have the kick filetype, in your vimrc:
autocmd BufNewFile,BufRead *.kick setfiletype kickWith vim-lsp:
autocmd User lsp_setup call lsp#register_server({
\ 'name': 'kick-views',
\ 'cmd': {server_info -> ['npx', '-y', '-p', '@forinda/kickjs-view-language-server', 'kick-view-ls', '--stdio']},
\ 'allowlist': ['kick', 'typescript', 'javascript'],
\ 'initialization_options': {'trusted': v:true},
\ })With coc.nvim, in coc-settings.json:
{
"languageserver": {
"kick-views": {
"command": "npx",
"args": ["-y", "-p", "@forinda/kickjs-view-language-server", "kick-view-ls", "--stdio"],
"filetypes": ["kick", "typescript", "javascript"],
"rootPatterns": ["kick.config.ts", "package.json"],
"initializationOptions": { "trusted": true }
}
}
}Helix
In ~/.config/helix/languages.toml:
[language-server.kick-views]
command = "npx"
args = ["-y", "-p", "@forinda/kickjs-view-language-server", "kick-view-ls", "--stdio"]
config = { trusted = true }
[[language]]
name = "kick"
scope = "text.html.kick"
file-types = ["kick"]
roots = ["kick.config.ts", "package.json"]
language-id = "kick"
grammar = "html"
language-servers = ["kick-views"]For template names in controllers, add kick-views to TypeScript's servers. List the ones it already uses too, because this setting replaces Helix's default list:
[[language]]
name = "typescript"
language-servers = ["typescript-language-server", "kick-views"]Emacs
With Eglot (built in since Emacs 29):
(define-derived-mode kick-mode html-mode "Kick")
(add-to-list 'auto-mode-alist '("\\.kick\\'" . kick-mode))
(with-eval-after-load 'eglot
(add-to-list 'eglot-server-programs
'(kick-mode . ("npx" "-y" "-p" "@forinda/kickjs-view-language-server"
"kick-view-ls" "--stdio"
:initializationOptions (:trusted t)))))Run M-x eglot in a .kick file, or add eglot-ensure to kick-mode-hook.
Eglot runs one server per buffer, so it can't add this one to TypeScript files next to your TypeScript server. Template names in controllers aren't available with it.
JetBrains IDEs
With the free LSP4IJ plugin, which works in Community editions too:
Open Settings → Languages & Frameworks → Language Servers and click +.
Server: name it
KickJS Views. The most reliable command runs the server with Node, both by full path, so it doesn't depend on the IDE'sPATHor onnpx. Install the server once:bashnpm i -g @forinda/kickjs-view-language-serverthen use:
text<path-to-node> <npm-root>/@forinda/kickjs-view-language-server/bin/kick-view-ls.js --stdiocommand -v node(where nodeon Windows) prints<path-to-node>, andnpm root -gprints<npm-root>.With nvm, fnm or another version manager, both paths change when you switch Node versions: install again and update them.
npx -y -p @forinda/kickjs-view-language-server kick-view-ls --stdiois shorter, but depends on what the IDE can see:Cannot run program "npx"means it can't see Node. One installed with nvm, fnm, Volta or asdf is set up by your shell's startup files, which an IDE started from the desktop doesn't read. SetPATHto Node'sbinfolder under Environment variables, or start the IDE from a terminal. A full path tonpxalone isn't enough:npxstartsnodefrom thePATHtoo.npm error 404 … kick-view-lsmeans the command is missing-p @forinda/kickjs-view-language-server.- If the server still stops, use the full-path command above, and look in the Language Servers tool window's Log tab for the reason.
Mappings → File name patterns: add
*.kick, with the language IDkick. For template names in controllers, also add*.tsand*.js, with the language IDstypescriptandjavascript.Configuration → Initialization options:
{ "trusted": true }.
LSP4IJ shows the server's semantic tokens, so the template syntax is coloured without anything else. Optionally, for highlighting before the server starts or in files it hasn't checked yet, add the VS Code extension's TextMate grammar under Settings → Editor → TextMate Bundles: point it at the extension folder inside the extension's .vsix, which is a zip file.
Zed
Install the KickJS Views extension (forinda/kickjs-zed). It registers the .kick language with its own pinned HTML grammar for the markup, downloads the language server from npm, and runs it with Zed's Node. Until it's listed in Zed's extension registry, clone the repository and run zed: install dev extension on the folder.
Pass options under lsp.kick-views.initialization_options in your settings, for example { "viewsDir": "app/views" }. The extension always sends trusted: false: Zed merges a project's .zed/settings.json into the settings an extension reads, so it can't tell your choice from a cloned repository's.
Building on top
kick/templateNames: a custom request that returns every template name except components. The VS Code extension uses it to completectx.render('…')in TypeScript.kick/renderDefinition({ text, offset }→{ uri, range }ornull) andkick/renderDiagnostics({ text }→ diagnostics): the template-name features for a TS / JS file's text, for clients that don't send those files to the server. The VS Code extension uses them, so the server isn't registered as a TypeScript formatter.- The package as a library:
@forinda/kickjs-view-language-serverexports the Volar language plugin (kickLanguagePlugin), the service plugin (createKickServicePlugin), theWorkspacethat tracks templates, components and pipes, andstartServer. Use them to run the server in-process or to add.kicksupport to another Volar-based server. - Highlighting: the TextMate grammar, scope
text.html.kick, lives inpackages/vscode-extension/syntaxes.kick.tmLanguage.jsonis the base, and three injection grammars add interpolations, control flow and bindings.