Note
If you like to run biome with Eglot, check out https://github.com/cxa/eglot-lspx.
lsp-mode client for Biome.
To integrate lsp-biome into your Emacs setup, you can take either:
-
Clone this repo, add the
lsp-biome.elfile to your Emacsload-path.(add-to-list 'load-path "/path/to/lsp-biome/")
Replace "/path/to/lsp-biome/" with the actual path to the
lsp-biomedirectory. -
Alternatively, if you're using a package manager like
use-packagewithquelpa, add the following configuration:(use-package lsp-biome :vc (:url "https://github.com/cxa/lsp-biome" :rev :newest)) ;; or :quelpa (lsp-biome :fetcher github :repo "cxa/lsp-biome")) if are using Emacs below 30
Customize the behavior of lsp-biome using the following configuration options:
-
lsp-biome-active-file-types: file types thatlsp-biomeshould activate, default is:(list (rx "." (or "tsx" "jsx" "ts" "js" "mts" "mjs" "cts" "cjs" "json" "jsonc" "css") eos) -
lsp-biome-active-hook: Hooks to run after activation, default isnil. See below for a usage example.
Explore the following commands provided by lsp-biome:
lsp-biome-organize-imports: Organize imports in the current buffer.lsp-biome-fix-all: Apply automatic code fixes in current buffer.
Use with apheleia:
(use-package lsp-biome
:vc (:url "https://github.com/cxa/lsp-biome" :rev :newest)
:preface
(defun my/lsp-biome-active-hook ()
(setq-local apheleia-formatter '(biome)))
:config
(add-hook 'lsp-biome-active-hook #'my/lsp-biome-active-hook))
To use lsp-biome, you must install biome either within your project or globally (ensure that Emacs can locate your biome in the $PATH).