MCPcopy Index your code
hub / github.com/9fans/acme-lsp

github.com/9fans/acme-lsp @v0.14.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.14.0 ↗ · + Follow
484 symbols 1,248 edges 48 files 125 documented · 26% updated 3mo agov0.14.0 · 2026-03-31★ 23015 open issues
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

GitHub Actions Status Go Reference Go Report Card

acme-lsp

Language Server Protocol tools for acme text editor.

The main tool is acme-lsp, which listens for commands from the L command. It also watches for files created (New), loaded (Get), saved (Put), or deleted (Del) in acme, and tells the LSP server about these changes. The LSP server in turn responds by sending diagnostics information (compiler errors, lint errors, etc.) which are shown in an acme window unless its disabled by the user. When Put is executed in an acme window, acme-lsp also organizes import paths in the window and formats it.

Installation

Install the latest release:

go install 9fans.net/acme-lsp/cmd/acme-lsp@latest
go install 9fans.net/acme-lsp/cmd/L@latest

Language Servers

There are integration tests with some language servers. We aim to support any servers that follow the LSP protocol. Following is a compatibility table between language servers and the L sub-commands:

fmt def refs type sig hov impls comp syms rn wss
clangd
clojure-lsp U
dart
gopls
jdtls ?
kotlin-lsp
pylsp U U
rust
ty U U
typescript
  • U: Unsupported by the language server

gopls

First install the latest release of gopls:

go install golang.org/x/tools/gopls@latest

Start acme-lsp like this:

acme-lsp -server '([/\\]go\.mod)|([/\\]go\.sum)|(\.go)$:gopls serve' -workspaces /path/to/mod1:/path/to/mod2

where mod1 and mod2 are module directories with a go.mod file. The set of workspace directories can be changed at runtime by using the L ws+ and L ws- sub-commands.

When Put is executed in an acme window editing .go file, acme-lsp will update import paths and gofmt the window buffer if needed. It also enables commands like L def (jump to definition), L refs (list of references), etc. within acme. The L assist command opens a window where completion, hover, or signature help output is shown for the current cursor position in the .go file being edited.

If you want to change gopls settings, you can create a configuration file at UserConfigDir/acme-lsp/config.toml (the -showconfig flag prints the exact location) and then run acme-lsp without any flags. Example config file:

WorkspaceDirectories = [
    "/path/to/mod1",
    "/path/to/mod2",
]
FormatOnPut = true
CodeActionsOnPut = ["source.organizeImports"]

[Servers]
    [Servers.gopls]
    Command = ["gopls", "serve", "-rpc.trace"]
    StderrFile = "gopls.stderr.log"
    LogFile = "gopls.log"

        # These settings gets passed to gopls
        [Servers.gopls.Options]
        hoverKind = "FullDocumentation"

        # These settings gets passed to gopls on format.
        # Gopls ignores these, but other LSP servers recognize
        # them.
        [Servers.gopls.FormattingOptions]
        # Size of a tab in spaces.
        TabSize = 0
        # Prefer spaces over tabs.
        InsertSpaces = false
        # Trim trailing whitespace on a line.
        TrimTrailingWhitespace = true
        # Insert a newline character at the end of the file
        # if one does not exist.
        InsertFinalNewline = true
        # Trim all newlines after the final newline at the
        # end of the file.
        TrimFinalNewlines = true

[[FilenameHandlers]]
  Pattern = "[/\\\\]go\\.mod$"
  LanguageID = "go.mod"
  ServerKey = "gopls"

[[FilenameHandlers]]
  Pattern = "[/\\\\]go\\.sum$"
  LanguageID = "go.sum"
  ServerKey = "gopls"

[[FilenameHandlers]]
  Pattern = "\\.go$"
  # Don't run this LSP in files in /projects/example (for instance because that
  # project needs a gopls with a Bazel packages driver).
  Ignore = "/projects/example"
  LanguageID = "go"
  ServerKey = "gopls"

Hints & Tips

  • If a file gets out of sync in the LSP server (e.g. because you edited the file outside of acme), executing Get on the file will update it in the LSP server.

  • Create scripts like Ldef, Lrefs, Ltype, etc., so that you can easily execute those commands with a single middle click:

for(cmd in comp def fmt hov impls refs rn sig syms type assist ws ws+ ws-){
    > L^$cmd {
        echo '#!/bin/rc'
        echo exec L $cmd '$*'
    }
    chmod +x L^$cmd
}
  • Create custom keybindings that allow you to do completion (L comp -e) and show signature help (L sig) while you're typing. This can be achieved by using a general keybinding daemon (e.g. xbindkeys in X11) and running acmefocused.

Development

On MacOS, while running tests, you may see this error:

proxy failed: listen unix $WORK/ns.plan9/acme-lsp.rpc: bind: invalid argument

This is due to the unix domain socket path being too long. $WORK can look like this:

WORK=/private/var/folders/1d/pts9r6h116s1m5kx723m4q3w0000gn/T/go-test-script2157504515/script-gopls

As a workaround, run tests after setting TMPDIR=/tmp.

See also

  • A setup with Acme on Darwin using acme-lsp with ccls by Igor Böhm
  • https://github.com/davidrjenni/A - Similar tool but only for Go programming language
  • https://pkg.go.dev/9fans.net/go/acme/acmego - Implements formatting and import fixes for Go
  • https://pkg.go.dev/github.com/fhs/misc/cmd/acmepy - Python formatter based on acmego
  • https://github.com/ilanpillemer/acmecrystal - Crystal formatter

Extension points exported contracts — how you extend this code

Core symbols most depended-on inside this repo

Shape

Method 280
Function 145
Struct 43
Interface 10
TypeAlias 6

Languages

Go100%

Modules by API surface

internal/lsp/proxy/server.go89 symbols
internal/acme/acme.go54 symbols
internal/lsp/proxy/client.go25 symbols
internal/lsp/acmelsp/remote.go25 symbols
internal/lsp/text/edit.go24 symbols
internal/lsp/acmelsp/proxy.go23 symbols
internal/lsp/acmelsp/client.go22 symbols
internal/lsp/acmelsp/assist.go22 symbols
internal/lsp/acmelsp/exec.go20 symbols
internal/lsp/acmelsp/client_test.go17 symbols
internal/lsp/acmelsp/config/config.go16 symbols
internal/acmeutil/acme.go15 symbols

For agents

$ claude mcp add acme-lsp \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page