@cssdoc/language-server
v0.14.2
Published
An editor-agnostic language server (LSP) for cssdoc: completion, hover, definition, and deprecation quick-fixes over the documented CSS surface.
Downloads
3,657
Maintainers
Readme
@cssdoc/language-server
An editor-agnostic LSP server for the
documented CSS surface, over @cssdoc/providers. It offers:
- completion — a component's modifiers inside
class/className, and declared custom properties insidevar(--…); - hover — a modifier's or custom property's documentation;
- definition — jump to the CSS rule that defines a class or
@property; - diagnostics + quick-fix — unknown and deprecated modifiers, with a one-click replace-with-canonical fix.
Use it
Editors spawn the built binary and pass the CSS paths as initializationOptions:
{
"command": "cssdoc-language-server",
"initializationOptions": { "css": ["dist/components.css"] },
}Or embed the pure service (no LSP runtime):
import { createIndex } from "@cssdoc/index";
import { CssDocLanguageService } from "@cssdoc/language-server";
const service = new CssDocLanguageService(createIndex(css, { file: "components.css" }));
service.completions(documentText, { line, character });
service.diagnostics(documentText);License
MIT
