Skip to main content
Fresh has native support for the Language Server Protocol (LSP), providing powerful code intelligence features across multiple programming languages.

Core Features

Fresh’s LSP integration provides:

Real-time Diagnostics

See errors and warnings in your code as you type

Code Completion

Get intelligent code completion suggestions

Go-to-Definition

Quickly jump to the definition of a symbol

Diagnostics Panel

The diagnostics panel provides a centralized view of all errors and warnings in your code.
1

Open the Panel

Open the diagnostics panel with Show Diagnostics Panel or Toggle Diagnostics Panel from the command palette.
2

Navigate Issues

  • Up/Down: Scroll the editor to preview each diagnostic’s location
  • Enter: Jump to the diagnostic and focus the editor
  • F8: Jump to next diagnostic without the panel
  • Shift+F8: Jump to previous diagnostic

Code Folding

When the LSP server provides foldingRange, fold indicators appear in the gutter. See Editing — Code Folding for more details.

Built-in LSP Support

Fresh includes built-in LSP configurations for many languages. Simply install the server and Fresh will use it automatically:
LanguageLSP ServerInstall Command
Rustrust-analyzerrustup component add rust-analyzer
Gogoplsgo install golang.org/x/tools/gopls@latest
TypeScript/JavaScripttypescript-language-servernpm install -g typescript-language-server typescript
Pythonpylsppip install python-lsp-server
Javajdtlsbrew install jdtls
Zigzlsbrew install zls
LaTeXtexlabbrew install texlab
Markdownmarksmanbrew install marksman
C/C++clangdbrew install llvm

Python LSP Configuration

The default Python server is pylsp. Fresh also supports several alternative Python language servers:
Recommended for type checking with strong TypeScript-like type analysis.
{
  "lsp": {
    "python": {
      "command": "pyright-langserver",
      "args": ["--stdio"],
      "enabled": true
    }
  }
}
Install: npm install -g pyright or pip install pyright

Configuring LSP for a New Language

To add LSP support for a language, configure two sections in your ~/.config/fresh/config.json:
1

Define the language

Add the language to the languages section with file extensions:
{
  "languages": {
    "csharp": {
      "extensions": ["cs"],
      "grammar": "c_sharp",
      "comment_prefix": "//",
      "auto_indent": true
    }
  }
}
2

Configure the LSP server

Add the language server configuration to the lsp section:
{
  "lsp": {
    "csharp": {
      "command": "/path/to/csharp-language-server",
      "args": [],
      "enabled": true
    }
  }
}
The language name (e.g., "csharp") must match in both sections. Fresh includes built-in language definitions for Rust, JavaScript, TypeScript, and Python.

Configuring Language Detection via Settings UI

You can also configure language detection using the Settings UI instead of editing config.json directly:
1

Open Settings

Use Edit → Settings… or the command palette (Ctrl+P) and search for “Settings”
2

Navigate to Languages

Go to the Languages section
3

Add or Edit a Language

Click on an existing language to edit it, or add a new one
4

Configure Detection

Set the following fields:
  • Extensions: File extensions that should use this language (e.g., cs for C#, rs for Rust)
  • Filenames: Specific filenames without extensions (e.g., Makefile, .bashrc, .zshrc)
  • Grammar: The syntax highlighting grammar to use (must match a grammar name from syntect)

Example: Adding Shell Script Detection for Dotfiles

To make Fresh recognize .bashrc, .zshrc, and similar files as shell scripts:
1

Open Settings

Open Settings (Edit → Settings…)
2

Configure bash language

Go to Languages → bash (or create a new bash entry)
3

Add filenames

Add filenames: .bashrc, .zshrc, .bash_profile, .profile
4

Set grammar

The grammar should be set to Bourne Again Shell (bash) or similar
The filenames field supports glob patterns like *.conf, *rc, or /etc/**/rc.* for matching files without standard extensions. Fresh checks filenames first, then extensions, allowing dotfiles without traditional extensions to get proper syntax highlighting.

Build docs developers (and LLMs) love