Skip to content
| Marketplace
Sign in
Visual Studio Code>Programming Languages>.Gram for VS CodeNew to Visual Studio Code? Get it now.
.Gram for VS Code

.Gram for VS Code

.Gram

|
1 install
| (0) | Free
Colours, diagnostics, completion, Quick Info, navigation, rename, folding and outline for .gram grammars, and colours, diagnostics, Quick Info and navigation for grammars written in C# strings, from the same language core as the DotGram source generator.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

.Gram for VS Code

Editing support for DotGram grammars in VS Code — .gram files and grammars written into C# strings — from the same language core the DotGram source generator and the Visual Studio extension compile: what you see is what the build reads.

A calculator grammar in a .gram file in VS Code, coloured by the language server

The same grammar inside a C# Gram attribute, coloured, with a diagnostic under a misspelled rule

What works

  • Diagnostics as the generator reports them, with their GRAM ids.
  • Colours: a first paint from a TextMate grammar, then the language server's classification of every token.
  • Completion of rules, keywords, built-in rules, captures, the standard library after Std., and C# inside @(...) (from Roslyn).
  • Hover on a rule (its definition and the rules it references), a keyword, a symbol, or C#.
  • Signature help for rules with parameters.
  • Go to Definition (F12), including into an included grammar — its file, or a read-only copy where only a referenced assembly carries it — and into the C# host for a C# name.
  • Find All References, highlights, Rename (F2) within the file, folding and the outline.
  • Snippets for grammars and their C# hosts.
  • Grammars in C# — a [Gram("""…""")]'s string, a string passed to a [StringSyntax("DotGram")] parameter, a DSL literal: diagnostics on the C# file, colours painted over whatever colours the C# file has (with or without the C# extension), hover, Go to Definition, Find All References, highlights and Rename inside the grammar.

A grammar's host — the C# class whose [Gram("….gram")] names the file — is looked for in the workspace folder's C# without a build, so its Lexical option and the grammars it includes are read as the build reads them. A folder with more than 2,000 C# files, and a file outside any folder, are read as they stand.

What does not

  • Completion, signature help, folding and the outline inside a grammar written in C#.
  • A grammar in C# is painted in the default themes' colours; another theme's are not read (the colours are dotgram.embedded.*, which workbench.colorCustomizations can set).
  • Diagnostics about the project rather than the grammar (a host that is not partial, a grammar that is not an additional file) are the build's.

Requirements

The language server runs on .NET 10. The extension asks the .NET Install Tool for the runtime, which finds an installed one or downloads it; dotgram.dotnetPath names a dotnet to use instead.

Settings

Setting
dotgram.server.path A language server to run instead of the one the extension carries.
dotgram.dotnetPath The dotnet that runs the server.
dotgram.trace.server messages or verbose traces the protocol in the .Gram output panel.
dotgram.embedded.enabled Whether grammars written into C# strings are analysed (on by default).
dotgram.embedded.diagnostics auto (default), on or off: whether their diagnostics are shown; auto leaves them to the build where the C# extension runs the DotGram generator.

Building from source, and troubleshooting: docs/vscode.md.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
  • Your Privacy Choices
  • Consumer Health Privacy
© 2026 Microsoft