8000 GitHub - 9fans/acme-lsp at v0.7.0
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

9fans/acme-lsp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status GoDoc 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. When Put is executed in an acme window, acme-lsp also organizes import paths in the window and formats it.

Currently, acme-lsp has been tested with gopls, go-langserver and pyls. Please report incompatibilities with those or other servers.

Installation

go get -u github.com/fhs/acme-lsp/cmd/acme-lsp
go get -u github.com/fhs/acme-lsp/cmd/L

gopls

First install the latest release of gopls:

GO111MODULE=on go get golang.org/x/tools/gopls@latest

Start acme-lsp like this:

acme-lsp -server '\.go$:gopls' -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 defenition), L refs (list of references), etc. within acme. Note: any output from these commands are printed to stdout by acme-lsp, so it's beneficial to start acme-lsp from within acme, where the output is written to +Errors window.

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 refs rn sig syms type assist ws ws+ ws-
do
	cat > L${cmd} <<EOF
#!/bin/sh
exec L ${cmd} "\$@"
EOF
	chmod +x L${cmd}
done
  • 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.

See also

About

Language Server Protocol tools for the acme text editor

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 7

0