Skip to content

maddyblue/acre

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

acre

acre is a langserver client for acme in Rust.

This is very much in beta and purposefully crashes on most errors. If a crash occurs, please file a bug so the feature can be added. Lenses and some other features are not yet supported. Config files may change.

It functions by creating a new window in acme. The window lists all open supported files and commands. The commands can be run by right clicking on them. The currently focused window is prefixed by a *. Run the Get command in the acre window to clear the current output.

Note: while the open file list contains all supported file types, those files may or may not be supported by the server if, say, the project they are in has not been configured in acre.toml.

Demo

demo

Installation

The latest release is available for Linux and OSX.

Configuration

Configuration (which servers to run) is handled by a file at ~/.config/acre.toml (note: I'm not sure if this is true on OSX, but the location will be printed in an error if it does not exist). The file should contain a servers object with where names are LSP servers and values are an object:

  • executable (optional): the name of the binary to invoke. If not present, uses the name.
  • files: regex matching files that should be associated with this server.
  • root_uri (optional): Root URI of the workspace.
  • workspace_folders (optional): array of workspace folder URIs.
  • options (optional): list of options to be sent to the server.
  • format_on_put (optional): boolean (defaults to true) to run formatting on Put.
  • actions_on_put (optional): array of actions (strings) to run on Put. Only useful if format_on_put is not false.
  • env (optional): table of key = "value" pairs to add to the environment for executable.

URIs should look something like file:///home/user/project.

Here's an example file for rust-analyzer and gopls:

[servers.rust-analyzer]
files = "\\.rs$"
workspace_folders = [
	"file:///home/username/some-project",
	"file:///home/username/other-project",
]
[servers.rust-analyzer.env]
CARGO_TARGET_DIR = "target-ra"
RUSTFLAGS = ""

[servers.gopls]
files = '\.go$'
root_uri = "file:///home/username/go-project"
actions_on_put = ["source.organizeImports"]

This will execute the rust-analyzer-linux binary and associate it with all files ending in .rs. Two workspaces are configured. gopls will run on a single root for .go files. gopls will run the organizeImports command (i.e., goimports) on Put.

Options to pass to each server can be added:

[servers.name]
files = '\.ext$'
root_uri = "file:///home/username/project"
[servers.name.options]
enableSomething = true
hoverMode = "OneLine"

# Disable checkOnSave in rust-analyzer:
[servers.rust-analyzer.options]
checkOnSave.enable = false

Tested servers

The following is a list of servers that have been tested with acre and are expected to work.

Other clients

  • acme-lsp is another client for acme. It functions using Win commands instead of the new window method that acre uses.