gram/packages/language-server
Repository files (latest commit first)
Filename Latest commit message Latest commit date
abiwab b243f5aa19
All checks were successful
CI / Build, Test & Publish (pull_request) Successful in 4m1s
chore(release): v1.3.0
2026-09-29 19:09:55 +02:00
..
src feat(lsp): add cross-file quick-fix to re-export an unbound module intermediate 2026-08-22 09:56:08 +02:00
tests fix(parser): accept dotted unit abbreviations and reject malformed quantities 2026-09-29 11:03:50 +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.3.0 2026-09-29 19:09:55 +02:00
package.json chore(release): v1.3.0 2026-09-29 19:09:55 +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.