@samveys/lsp
Dari packages/lsp/README.md di repository framework.
Halaman ini belum diterjemahkan. Kamu sedang membaca versi bahasa Inggris.
A language server for @samveys/template files (.tpl.html), with no dependencies. It speaks LSP 3.17 over stdio: samveys-lsp --stdio.
| Feature | Behaviour |
|---|---|
| Completion | <x- lists components from resources/views/components; @ lists directives |
| Hover | A component shows its file and the props it reads; a directive shows its syntax |
| Diagnostics | The real template compiler runs on every change; its SVS_E109 errors appear on their line. An unknown <x-name> is a warning |
| Go to definition | <x-card>, @include('…') and @layout('…') open the file |
VS Code
packages/lsp/vscode is a thin extension built on vscode-languageclient. It starts node_modules/.bin/samveys-lsp of the workspace for .tpl.html files; the samveys.lsp.command setting points it elsewhere. Package it with npx @vscode/vsce package in that folder.
Other editors
Any LSP client works. Start samveys-lsp --stdio with the workspace root as rootUri; views are read from <root>/resources/views.
Use it from code
import { createTemplateLanguageService } from '@samveys/lsp'
const service = createTemplateLanguageService({ viewsDir: 'resources/views' })
const diagnostics = service.diagnose(source, 'resources/views/home.tpl.html')