The Neovim editor plugin for webjs, the counterpart to the webjs VS Code
extension (packages/editors/vscode). Phase 4 of the editor-plugin epic (#381).
Framework-wide rules (workflow, no-build, commit conventions) live in the
framework root ../../AGENTS.md. This file covers what is
specific to the Neovim plugin.
- Highlighting (
queries/{typescript,javascript}/injections.scm): treesitter injection queries that injecthtml/css/svginto the matching tagged templates. They begin with; extendsso they ADD to nvim-treesitter's built-in injections rather than replacing them. A webjs template parses as(call_expression (identifier) (template_string)); the captured tag name IS the injected language (@injection.language). Neovim auto-loads anyqueries/<lang>/<kind>.scmon the runtimepath, so no Lua wires this up. - Lua (
lua/webjs/):init.lua(setup(), the:WebjsCheckcommand, thewith_tsserver_plugin()LSP helper for ts_ls ANDwith_vtsls_plugin()for vtsls/LazyVim, #405),check.lua(webjs check --jsontovim.diagnostic+ quickfix),health.lua(:checkhealth webjs).plugin/webjs.luaregisters:WebjsCheckso it works without an explicitsetup(). - Bundled language service (
vendor/node_modules/@webjsdev/intellisense/): a committed verbatim copy of the standalone@webjsdev/intellisense(#386).with_tsserver_plugin()pointstsserverat it viaplugins[].location(->pluginProbeLocations), so intelligence works with NO@webjsdev/intellisensein the app (beforenpm install, pruned trees, non-scaffolded apps). When the app ALSO wires it viatsconfig,tsserverdedupes by name (verified), so no double-load. This copy is GENERATED, never hand-edit a file undervendor/node_modules/@webjsdev/intellisense/. To change its behaviour, editpackages/editors/intellisense/src/(the source of truth) and regenerate:node packages/editors/nvim/scripts/vendor-intellisense.mjsthengit add -f packages/editors/nvim/vendor(the output is under a gitignorednode_modules/). Thetest/vendor-sync.test.mjsdrift guard FAILS the "Unit + integration" CI job ("vendored intellisense src is byte-identical ...") whenever the copy andsrc/diverge, whether you forgot to re-vendor after an intellisense edit OR hand-edited the copy. Confirm green withnode --test packages/editors/nvim/test/vendor-sync.test.mjs. - Docs:
doc/webjs.txt(:help webjs),README.md.
- No Lit dependency. Highlighting is our own treesitter queries;
intelligence is the standalone
@webjsdev/intellisense(Phase 3, #386). Never depend on a Lit treesitter/LSP plugin. - Highlighting needs no
setup(). The queries auto-load from the runtimepath.setup()only registers commands and applies config, so it must stay optional. - Never break the user's editor. Lua must not error at load; guard
risky calls (the
checkjob, parser probes) withpcalland surface problems viavim.notify, never a raw error. ${…}substitutions render as injected-language text, not re-scoped TypeScript (a treesitter injection limitation). Do not claim otherwise in docs; the VS Code extension is the precise path.
test/selftest.lua is the real suite: it runs inside headless Neovim (the
only place the Lua + treesitter injections execute), asserting the modules
load, :WebjsCheck registers, with_tsserver_plugin is idempotent,
check.project builds quickfix entries, and each tagged template injects the
right parser. test/nvim.test.mjs wraps it for the repo's npm test and
SKIPS when nvim is not installed (so CI without Neovim stays green). Run
directly with nvim --headless -l packages/editors/nvim/test/selftest.lua.
Developed here; published to the standalone webjsdev/webjs.nvim repo (a git
subtree split) so lazy.nvim / packer can install it by repo name. See
PUBLISHING.md.
It is NOT an npm package, but it IS tracked in the unified changelog (#413).
package.json exists here ONLY as the version source: bump its version
and the pre-commit gate requires a changelog/nvim/<version>.md (backfill
generates it). The entry carries npm: false, so the publish-* scripts
skip the registry while the version still renders on the website
/changelog feed. Keep package.json's version in step with the
webjsdev/webjs.nvim git tag.
Framework-wide rules and full API reference:
@../../AGENTS.md