gram/packages/language-server
Repository files (latest commit first)
Filename Latest commit message Latest commit date
abiwab bca30e7a9d
All checks were successful
CI / ci (push) Successful in 2m3s
chore: release v1.0.0
2026-08-06 12:00:19 +02:00
..
src feat(vscode-extension): add Gantt Chart timeline panel and shared renderer module 2026-07-25 20:02:23 +02:00
tests feat(format): unify CLI and language-server .gram formatters into @gram-lang/format 2026-07-24 21:09:31 +02:00
build.cjs refactor: migrate project to ESM, upgrade to TS 6.0, and unify type definitions across packages 2026-06-18 13:11:36 +02:00
CHANGELOG.md chore: release v1.0.0 2026-08-06 12:00:19 +02:00
package.json chore: release v1.0.0 2026-08-06 12:00:19 +02:00
README.md chore: preparing for v1 release 2026-08-06 10:40:53 +02:00
tsconfig.json chore: bump all dependencies and migrate to typescript 7 dual setup 2026-07-13 13:17:12 +02:00

@gram-lang/language-server

npm version License: GPL v3

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 .gram files 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.