Skip to content

Editor GoLand and JetBrains

Oliver Atkinson edited this page May 31, 2026 · 1 revision

GoLand and JetBrains IDEs

GoLand and other JetBrains IDEs can participate in a Lexicon workflow today, but the current repository does not ship a JetBrains plugin.

There are two practical levels:

  • Use CLI validation and generation from GoLand now.
  • Build a JetBrains plugin wrapper for full lexicon-lsp completions and diagnostics.

JetBrains exposes LSP support through the IntelliJ Platform Plugin SDK. That means a plugin can launch lexicon-lsp, but users do not get a universal "attach any stdio LSP server" project setting equivalent to some editors.

1. Build the Tools

swift build -c release --product lexicon
swift build -c release --product lexicon-generate
swift build -c release --product lexicon-lsp

Keep the absolute paths:

/absolute/path/to/Lexicon/.build/release/lexicon
/absolute/path/to/Lexicon/.build/release/lexicon-generate
/absolute/path/to/Lexicon/.build/release/lexicon-lsp

2. Add Project Configuration

At the repository root:

{
  "lexicon": "lexicons/commerce.lexicon"
}

Save it as lexicon-lsp.json. This same file is used by Zed, VS Code clients, generic LSP clients, and a future JetBrains plugin.

3. Use GoLand External Tools

Create external tools for validation and generation:

Validation command:

swift run lexicon lint lexicons/commerce.lexicon

Generation command:

swift run lexicon-generate lexicons/commerce.lexicon \
	--type go \
	--go-package commerce \
	-o internal/commerce/lexicon

Then run the generated Go code through normal GoLand inspections, go test, and go vet.

4. Use File Watchers Carefully

If you use a File Watcher or before-build step, prefer generation into a stable generated directory:

internal/commerce/lexicon.go

Avoid regenerating on every keystroke in a large vocabulary. Run generation on save, before tests, or in CI.

5. Full LSP Requires a Plugin

For completions inside:

l("commerce.api.order.submit")

and diagnostics for unknown Lexicon paths, GoLand needs a JetBrains plugin that:

  • registers .lexicon files
  • starts lexicon-lsp
  • attaches it to Lexicon and optionally Go/Rust files
  • maps workspace roots to lexicon-lsp.json
  • forwards document open/change/completion/diagnostic traffic

The IntelliJ Platform Plugin SDK documents LSP integration here:

https://plugins.jetbrains.com/docs/intellij/language-server-protocol.html

6. Recommended Current GoLand Workflow

Until a Lexicon JetBrains plugin exists:

  1. Use generated Go selectors for application code:

    commerce.Commerce.Api.Order.Submit.ID()
  2. Use l("...") exact-path helpers sparingly, mostly in tests and migration data.

  3. Run lexicon lint before commits.

  4. Run lexicon-generate before Go tests or commit generated Go.

  5. Use Zed, VS Code with a client, or Neovim when authoring .lexicon files needs live path completion.

Clone this wiki locally