Skip to content

axle lsp

Terminal window
axle lsp

Starts the language server for every axle.toml in the repository. An editor starts it and talks to it over standard input and output with the Language Server Protocol; you don’t run it yourself. The VS Code extension and the JetBrains plugin start it for you.

It gives the editor:

  • Errors as you type. It reads the unsaved text the way axle run reads the file, so it finds the same mistakes, with the same code and a link to the error’s message page. A plugin that fails while it reads the repository is a warning on its table in the root axle.toml, and everything else keeps working without that plugin’s projects.
  • Completion of keys and their values, such as continue = "never", of task names in dependsOn and with, such as ^build or web#build, and of package names in implicitDependencies. A package’s axle.toml only offers the keys it can have.
  • Hover: what a key does, and what a task reference such as ^build or a [tasks.<name>] table runs in each package, with the task’s description.
  • Go to definition from a task reference or a [tasks.<name>] table to the script in package.json or the command it runs, from a package in implicitDependencies to its package.json, and from a preset in extends to its file.

It reads the repository when it starts and again whenever an axle.toml is saved. It also asks the editor to tell it when any package.json or axle.toml changes, and reads the repository again then, in editors that let a server watch files.

Any editor with a language client can use it. Start axle lsp in the repository’s root for files named axle.toml. In Neovim:

vim.lsp.config('axle', {
cmd = { 'axle', 'lsp' },
filetypes = { 'toml' },
root_markers = { 'axle.toml', 'package.json' },
})
vim.lsp.enable('axle')

In Helix, in languages.toml:

[language-server.axle]
command = "axle"
args = ["lsp"]
[[language]]
name = "toml"
language-servers = ["taplo", "axle"]

If axle isn’t on your PATH, use the path of the binary the repository installs, such as node_modules/.bin/axle.