Language server

The Brossa language server provides rich IDE features to help you write and debug Brossa code more effectively. This page covers the key features and how to use them.

Features

Code completion

The language server provides intelligent code completion for:

  • Built-in types and type aliases.

  • Datapoints and functions.

  • Field names in records.

  • Annotations (e.g. @derived, @hidden, etc.).

  • Module names and imports.

  • Meta keys.

Completion is triggered automatically when typing, or manually with:

  • . for field access.

  • ^ for annotations.

  • > for advanced completions.

  • @ for meta keys.

  • : for type annotations.

Diagnostics

Real-time error checking and warnings:

  • Syntax errors.

  • Type errors.

  • Unreachable code.

  • Debug information (optional).

  • Configure via:

    {
      "brossa.languageServer": {
        "diagnostics": {
          "unreachable": true,
          "debug": false
        }
      }
    }

Document symbols

View the structure of your Brossa files:

  • Open the outline view to see all symbols.

  • Includes functions, variables, and type aliases.

  • Shows symbol hierarchy and relationships.

  • Helps navigate large files.

Find references

Find all usages of a symbol across your codebase:

  • Right-click and select "Find All References".

  • Shift + F12 keyboard shortcut.

Go to definition

Navigate to the definition of any symbol by:

  • Clicking while holding Ctrl/Cmd.

  • Using the "Go to Definition" command.

  • F12 keyboard shortcut.

The language server will take you to the original declaration, even if it’s in a different file.

Hover information

Hover over any symbol to see:

  • Type information.

  • Documentation for built-in functions.

  • Usage information for type aliases.

  • List of dependent goals that use the symbol.

  • Additional context about the symbol’s purpose.

Inlay hints

Get inline type information:

  • Shows inferred types for expressions.

  • Displays parameter names in function calls.

  • Configurable through settings:

    {
      "brossa.languageServer": {
        "inlayHints": {
          "enabled": true,
          "cutoff": 80
        }
      }
    }

Signature help

Get parameter information while writing function calls:

  • Triggered automatically when typing (.

  • Shows parameter types and names.

  • Updates as you type additional parameters.

  • Indicates the current parameter position.

Configuration

The language server can be configured through VS Code settings:

{
  "brossa.languageServer": {
    "path": "/path/to/brossa-lsp-server",
    "inlayHints": {
      "enabled": true,
      "cutoff": 80
    },
    "diagnostics": {
      "unreachable": true,
      "debug": false
    }
  }
}

Troubleshooting

If you encounter issues:

  1. Check the language server is properly installed and in your PATH..

  2. Verify VS Code settings are correctly configured

  3. Look for errors in the VS Code "Output" panel (select "Brossa Language Server").

  4. Try restarting the language server:.

    • Command Palette → "Developer: Restart Language Server".

    • Or reload VS Code window.