@gram-lang/language-server
v1.2.1
Published
LSP server for the Gram recipe language
Readme
@gram-lang/language-server
Part of the Gram monorepo.
The official Language Server Protocol (LSP) implementation for the Gram recipe language. It provides language intelligence such as diagnostics (syntax and logic errors), auto-completion, hover information, and semantic tokens.
📚 General Documentation
For full syntax specifications, command reference, and best practices, please refer to the Gram Documentation.
🛠️ Installation
npm install @gram-lang/language-server
# or
bun add @gram-lang/language-server⚡ Usage
This package is intended to be consumed by editor extensions or IDEs that support the Language Server Protocol (e.g., VS Code, Neovim, Emacs, Zed, Monaco Editor).
If you are developing a client extension, you can launch the server process using Node.js:
import { LanguageClient } from 'vscode-languageclient/node';
const serverModule = require.resolve('@gram-lang/language-server');
const client = new LanguageClient(
'gramLanguageServer',
'Gram Language Server',
{
run: { module: serverModule, transport: TransportKind.ipc },
debug: { module: serverModule, transport: TransportKind.ipc }
},
{
documentSelector: [{ scheme: 'file', language: 'gram' }]
}
);
client.start();🏗️ Capabilities
The Gram Language Server currently supports:
- Diagnostics: Real-time syntax and semantic validation.
- Semantic Tokens: Rich semantic highlighting for ingredients, quantities, cookware, and timers.
- Hover: Nutritional information and scaled quantities on hover.
- Completion: Suggestions for units, ingredients (based on the user's local ingredient DB), and cookware.
- Document Formatting: Automatic formatting of
.gramfiles to the standard canonical style (powered by@gram-lang/format). - Live Preview & Gantt Streams: Pushes rendered HTML (
gram/previewUpdated) and interactive Gantt chart HTML fragments (gram/ganttUpdated) to editor client webviews on document edits.
📄 License
This project is licensed under the GPL-3.0 License.
