This project provides a language server and editor extensions for using Web Components and custom elements. It offers advanced HTML diagnostics, completion, and validation for custom elements, including support for attribute types, deprecation, and duplicate attribute detection.
- HTML diagnostics for custom elements and attributes
- Attribute type validation (boolean, number, enum, string)
- Deprecated element and attribute warnings
- Duplicate attribute detection
- Completion and hover support for custom elements
- Configurable diagnostics severity
- Self-contained executable - no Node.js runtime required
- Works with any Web Components library that provides a Custom Elements Manifest
The language server is distributed as a self-contained executable that embeds its own runtime. This eliminates the need for Node.js to be installed on the target system for runtime execution.
- Standalone installation:
npm install -g @wc-toolkit/language-server(requires Node.js for installation only) - Direct executable download: Download platform-specific executables from GitHub Releases. Available executables include:
wc-language-server.js- Single-file JavaScript bundle (requires Node.js)wc-language-server-linux-x64- Linux x64 executablewc-language-server-linux-arm64- Linux ARM64 executablewc-language-server-macos-x64- macOS x64 executablewc-language-server-macos-arm64- macOS ARM64 executablewc-language-server-windows-x64.exe- Windows x64 executable
- Editor integrations: Available as plugins for VS Code, JetBrains IDEs, Neovim, and Zed
- Development: Requires Node.js 18+ for building and testing
packages/language-server: Core language server implementationpackages/vscode: VS Code extension clientpackages/jetbrains: JetBrains plugin (WebStorm, IntelliJ IDEA)packages/neovim: Neovim plugin that wires the language server into the built-in LSP clientpackages/wctools: CLI utilities for parsing custom element manifests
-
Install dependencies:
pnpm install
-
Build the project:
pnpm run build
-
Open in VSCode:
- Open this folder in VSCode.
- Press
Ctrl+Shift+Bto compile the client and server.
-
Debug the extension:
- Switch to the Debug view.
- Select
Launch Clientand start debugging. - Optionally, use
Attach to Serverto debug the server process.
-
Try it out:
- Open an HTML file and use custom elements.
- See diagnostics for invalid attributes, deprecated usage, and duplicates.
This repository uses Node's built-in test runner. The root test script runs node --test and executes test files that use the Node test API.
Quick commands
- Run all repository tests (root):
pnpm run test- Run a single test file with Node directly:
node --test path/to/test-file.mjs- Run tests for a specific package (example for CLI):
node --test packages/wctools/test/*.mjsNotes
package.jsonincludes"type": "module", so ES module test files (.js/.mjs) are treated as ESM and you should not see module-type warnings when runningnode --test.- Tests are written against Node's
testAPI (importtestfromnode:testandassertfromassert).
CI recommendations
- Install dependencies with a frozen lockfile:
pnpm install --frozen-lockfile. - Run
pnpm run buildbefore tests to catch TypeScript issues. - Run
pnpm run testto execute the Node tests.
If you'd like a separate npm script name for the Node runner, add a test:node script in package.json (optional).
- To create a local
.vsixpackage run:pnpm vscode:pack
- The
.vsixfile will be created inpackages/vscode/for manual installation. - To publish the package run:
pnpm vscode:release
- To build the plugin:
pnpm jetbrains:build
- The plugin ZIP will be created in
packages/jetbrains/build/distributions/ - To test locally in WebStorm:
pnpm jetbrains:run
- For detailed testing instructions, see
packages/jetbrains/TESTING.md
You can customize diagnostics and other behaviors via a wc.config.js file in your workspace root. See the documentation in packages/language-server/src/services/configuration-service.ts for available options.