Language Servers#
toe uses gopls for Go language features. Other language servers can be selected and configured in languages.toml; each server must be installed on your PATH.
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 Language Server Features#
| Feature | Key | Command |
|---|---|---|
| Go to definition | gd | goto-definition |
| Go to declaration | gD | goto-declaration |
| Go to type definition | gy | goto-type-definition |
| Go to implementation | gi | goto-implementation |
| Go to references | gr | goto-reference |
| Select all references | Space+h | select-references-to-symbol-under-cursor |
| Hover docs | Space+k | hover |
| Rename symbol | Space+r | rename-symbol |
| Code actions | Space+a | code-action |
| Format selection | = | format-selections |
| Format document | :format | format |
| Signature help | (auto in Insert) | signature-help |
| Completion | Ctrl+x (or auto) | completion |
| Document symbols | Space+s | symbol-picker |
| Workspace symbols | Space+S | workspace-symbol-picker |
Workspace symbol searches query every running language server, not only the server for the focused document.
Completion is requested three ways: Ctrl+x at any time, automatically after a trigger character the language server advertises (. for most servers), and automatically once typing pauses, see Completion for the delay and trigger length.
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.
Completion Kinds#
The completion popup marks each candidate with its kind, colored by the theme scope in the last column. Terminals without a Nerd Font show the short label instead:
| Icon | Kind | Plain | Theme scope |
|---|---|---|---|
text | Txt | string | |
function | Fun | function | |
method | Mth | function | |
constructor | Ctr | function | |
field | Fld | variable.other.member | |
variable | Var | variable.parameter | |
class | Cls | type | |
interface | Ifc | type | |
module | Mod | namespace | |
property | Prp | variable.other.member | |
unit | Unt | type | |
value | Val | constant | |
enum | Enm | constant | |
keyword | Kwd | keyword | |
snippet | Snp | string | |
color | Clr | string | |
file | Fil | string | |
reference | Ref | variable.other.member | |
folder | Dir | string | |
constant | Cst | constant | |
struct | Sct | type | |
event | Evt | string | |
operator | Opr | operator | |
type param | Tpm | type | |
enum member | Emb | constant |
Restarting Servers#
:lsp-restart restart all servers for the current document
:lsp-restart gopls restart a specific server
:lsp-stop stop all serversFormatter#
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.