Skip to main content
Language packs extend Fresh with support for new programming languages. They provide syntax highlighting, language-specific configuration, and LSP integration.

Quick Start

Scaffold a new language pack using the Fresh CLI:
This creates a complete package structure:

Package Structure

Package Manifest

The package.json configures all aspects of your language pack:
The $schema field enables validation and autocomplete in editors that support JSON Schema.

Grammar Configuration

The grammar section tells Fresh how to syntax-highlight your language:
Use ["py"] not [".py"] - extensions should NOT include the dot.

Language Configuration

The language section configures editor behavior for your language:

Formatter Examples

The file path is automatically appended to args. Some formatters expect stdin (use "-" as arg), others expect a file path.

LSP Integration

The lsp section configures Language Server Protocol support:

Finding LSP Servers

Official LSP Registry

Microsoft’s official list of LSP implementations

langserver.org

Community-maintained directory of language servers

Common LSP Servers

Advanced LSP Configuration

Some language servers accept custom initialization options:
Check your language server’s documentation for available initialization options. These vary by server.

Grammar Development

Fresh uses Sublime Text’s .sublime-syntax format (YAML-based) for syntax highlighting.

Finding Existing Grammars

Before writing a grammar from scratch, search for existing ones:
1

Search GitHub

Look for <language> sublime-syntax or <language> tmLanguage
2

Check VS Code Extensions

Many VS Code extensions use TextMate or Sublime grammars that you can adapt
3

Browse Package Control

Visit packagecontrol.io for Sublime Text packages

Grammar Compatibility

Fresh supports a subset of sublime-syntax features. Not all grammars will work.
Will NOT work:
  • Grammars using extends: Packages/... directive (grammar inheritance)
  • References to external grammars or packages
  • Dependencies on other grammar files
Will work:
  • Standalone, self-contained grammars
  • Grammars using only include for internal contexts
  • No external dependencies
Compatible examples:
  • See fresh-plugins/languages for working examples (templ, hare, solidity)
  • Standalone grammars from Package Control that don’t use extends

Testing Compatibility

Install your language pack locally (see Testing) and check logs:
Look for Failed to parse grammar errors.

Attribution Requirements

When using an existing grammar:
1

Check the License

Ensure it allows redistribution (MIT, Apache, BSD are common)
2

Include License File

Copy the license to grammars/LICENSE
3

Credit Original Author

Add attribution to your README and package description
Example attribution:

Writing Grammars from Scratch

Recommendation: Start with an existing grammar from fresh-plugins/languages and adapt it, rather than writing from scratch.

Minimal Example

Documentation Resources

Sublime Syntax Reference

Complete format specification

Scope Naming Guide

Standard scope names for syntax elements

TextMate Grammars

Additional background information

Working Examples

Real grammars from fresh-plugins

Complete Working Example

From the Templ language pack:

Testing and Local Development

The fastest way to test during development:
1

Open Fresh

Open Fresh with a test file for your language
2

Open Command Palette

Press Ctrl+P then type >
3

Install from Local Path

Type package and select “Package: Install from URL”Enter the full path to your language pack directory:
4

Check for Errors

Open command palette and run “Show Warnings”Look for grammar parse errors or missing files
5

Iterate

Edit your grammar, then reinstall from the same local path to reload

Alternative: Manual Installation

1

Copy Package

2

Validate Manifest

3

Restart Fresh

Restart Fresh to load the new grammar

Validation

Always validate before publishing:

Troubleshooting

Debugging Commands

Common Issues

Possible causes:
  1. Grammar uses extends directive - Most common issue. Fresh doesn’t support grammar inheritance.
    • Check logs for Failed to parse grammar
    • Find a standalone grammar or manually merge the base grammar
  2. Wrong file extension format - Use ["py"] not [".py"]
  3. Incorrect grammar file path - Check that the path in package.json matches the actual file location
Debugging steps:
  1. Verify server is installed:
  2. Check LSP logs:
  3. Test server manually:
  4. Check LSP registry - Verify correct command and args at microsoft.github.io/language-server-protocol
Debugging steps:
  1. Verify formatter is installed:
  2. Test formatter manually:
  3. Check formatter documentation - Ensure you’re using correct arguments
    • Some formatters need stdin: ["-"]
    • Others need file path: ["--write"] (path added automatically)
  4. Check Fresh logs for formatter errors
Common validation errors:
  1. Invalid JSON - Use a JSON validator or editor with schema support
  2. Missing required fields:
  3. Invalid schema URL - Copy the exact URL from working examples

Publishing

Once your language pack is tested and working:
1

Push to Git Repository

Create a public Git repository (GitHub, GitLab, etc.) and push your package
2

Submit to Registry

Submit a PR to fresh-plugins-registryAdd your package to languages.json:
3

Wait for Approval

Maintainers will review your submission. Once merged, users can install via the command palette.

User Installation

After your package is in the registry, users can install it:
1

Open Command Palette

Press Ctrl+P then type >
2

Select Install Command

Type package and select “Package: Install from URL”
3

Enter Package Name

Type your package name or Git URL:
or

Examples

Solidity

Minimal example - just grammar and basic config

Templ

Complete self-contained grammar with no external dependencies

Hare

Systems language with LSP integration

Fresh Plugins Registry

Browse all published language packs

Next Steps

Plugin Development

Learn how to build plugins with custom functionality

Sublime Syntax Docs

Master the grammar format

LSP Specification

Understand the Language Server Protocol

Example Grammars

Study working language packs