Quick Start
Scaffold a new language pack using the Fresh CLI:Package Structure
Package Manifest
Thepackage.json configures all aspects of your language pack:
The
$schema field enables validation and autocomplete in editors that support JSON Schema.Grammar Configuration
Thegrammar section tells Fresh how to syntax-highlight your language:
Language Configuration
Thelanguage 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
Thelsp 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: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> tmLanguage2
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
Will NOT work:- Grammars using
extends: Packages/...directive (grammar inheritance) - References to external grammars or packages
- Dependencies on other grammar files
- Standalone, self-contained grammars
- Grammars using only
includefor internal contexts - No external dependencies
- 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: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/LICENSE3
Credit Original Author
Add attribution to your README and package description
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
Testing with Local Path (Recommended)
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
Syntax highlighting not working
Syntax highlighting not working
Possible causes:
-
Grammar uses
extendsdirective - 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
- Check logs for
-
Wrong file extension format - Use
["py"]not[".py"] -
Incorrect grammar file path - Check that the path in
package.jsonmatches the actual file location
LSP server not starting
LSP server not starting
Debugging steps:
-
Verify server is installed:
-
Check LSP logs:
-
Test server manually:
- Check LSP registry - Verify correct command and args at microsoft.github.io/language-server-protocol
Formatter not working
Formatter not working
Debugging steps:
-
Verify formatter is installed:
-
Test formatter manually:
-
Check formatter documentation - Ensure you’re using correct arguments
- Some formatters need stdin:
["-"] - Others need file path:
["--write"](path added automatically)
- Some formatters need stdin:
- Check Fresh logs for formatter errors
Package validation fails
Package validation fails
Common validation errors:
- Invalid JSON - Use a JSON validator or editor with schema support
-
Missing required fields:
- 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
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