Language Servers#

toe is a Go editor. LSP support is built around gopls for Go, with additional servers available for web languages (TypeScript, HTML, CSS) and other tools in the Go ecosystem. Each language specifies which server to use; you configure servers in your languages.toml.

Configuring a Language Server#

Add a [language-server.<name>] section and reference it from the language:

# $XDG_CONFIG_HOME/toe/languages.toml

[language-server.gopls]
command = "gopls"
args = ["-remote=auto"]          # optional
environment = { GOFLAGS = "-mod=mod" }  # optional
timeout = 30                     # optional, seconds

[[language]]
name = "go"
language-servers = ["gopls"]

Workspace Config#

Language server config in .toe/languages.toml is merged on top of user config, letting you override per-project without touching global settings.

Available LSP Features#

FeatureKeyCommand
Go to definitiongdgoto_definition
Go to declarationgDgoto_declaration
Go to type definitiongygoto_type_definition
Go to implementationgigoto_implementation
Go to referencesgrgoto_reference
Select all referencesSpace+hselect_references_to_symbol_under_cursor
Hover docsSpace+khover
Rename symbolSpace+rrename_symbol
Code actionsSpace+acode_action
Format document=format_selections
Signature help(auto in Insert)signature-help
CompletionCtrl+x (or auto)completion
Document symbolsSpace+ssymbol_picker
Workspace symbolsSpace+Sworkspace_symbol_picker

Diagnostics (errors and warnings) appear as underlines in the document, markers in the gutter, counts in the status bar, and a popup when the cursor rests on a diagnostic.

Restarting Servers#

:lsp-restart             restart all servers for the current document
:lsp-restart gopls       restart a specific server
:lsp-stop                stop all servers

Formatter#

You can also configure a standalone formatter (runs when auto-format = true or when you invoke =):

[[language]]
name = "go"
auto-format = true
formatter = { command = "gofmt" }

If a language server and formatter are both configured, the language server’s formatting is used.