Skip to content

Commit 0294681

Browse files
committed
feat: Add tombi LSP client for TOML
Adds support for the Tombi language server for TOML files. This introduces a new client definition, integrates it into the list of known clients, and provides documentation on how to use and select it. * Add `clients/lsp-toml-tombi.el` with client definition. * Add documentation page for the tombi client. * Register `lsp-toml-tombi` in `lsp-clients` variable. * Update mkdocs navigation to include the new doc page. * Clarify the existing TOML doc page as 'Taplo'.
1 parent bd77ed1 commit 0294681

File tree

4 files changed

+76
-2
lines changed

4 files changed

+76
-2
lines changed

clients/lsp-toml-tombi.el

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
;;; lsp-toml-tombi.el --- lsp-mode TOML integration -*- lexical-binding: t; -*-
2+
3+
;; Copyright (C) 2025 Sibi Prabakaran
4+
5+
;; Author: Sibi Prabakaran <sibi@psibi.in>
6+
;; Keywords: lsp, toml
7+
8+
;; This program is free software; you can redistribute it and/or modify
9+
;; it under the terms of the GNU General Public License as published by
10+
;; the Free Software Foundation, either version 3 of the License, or
11+
;; (at your option) any later version.
12+
13+
;; This program is distributed in the hope that it will be useful,
14+
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15+
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16+
;; GNU General Public License for more details.
17+
18+
;; You should have received a copy of the GNU General Public License
19+
;; along with this program. If not, see <https://www.gnu.org/licenses/>.
20+
21+
;;; Commentary:
22+
23+
;; Client for tombi
24+
25+
;;; Code:
26+
27+
(require 'lsp-mode)
28+
29+
(defgroup lsp-tombi-toml nil
30+
"LSP support for TOML, using Tombi."
31+
:group 'lsp-mode
32+
:link '(url-link "https://github.com/tombi-toml/tombi"))
33+
34+
(defcustom lsp-tombi-toml-command "tombi"
35+
"Path to tombi command."
36+
:type 'string
37+
:group 'lsp-tombi-toml
38+
:package-version '(lsp-mode . "9.0.0"))
39+
40+
(defun lsp-tombi-toml--check-enabled (_file-name _mode)
41+
"Check if the tombi language server should be enabled in this buffer."
42+
(when (string= (lsp-buffer-language) "toml")
43+
t))
44+
45+
(lsp-register-client
46+
(make-lsp-client
47+
:new-connection (lsp-stdio-connection (lambda () (list lsp-tombi-toml-command "lsp")))
48+
:activation-fn #'lsp-tombi-toml--check-enabled
49+
:multi-root t
50+
:server-id 'tombi
51+
:priority -2))
52+
53+
(lsp-consistency-check lsp-tombi-toml)
54+
55+
(provide 'lsp-toml-tombi)
56+
;;; lsp-toml-tombi.el ends here
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
author: psibi
3+
template: comment.html
4+
root_file: docs/manual-language-docs/lsp-toml-tombi.md
5+
---
6+
7+
## Server note
8+
9+
This page documents the Tombi's language server for Toml.
10+
11+
Note that currently lsp-mode supports two Toml language servers. This
12+
[FAQ entry](https://emacs-lsp.github.io/lsp-mode/page/faq/#i-have-multiple-language-servers-registered-for-language-foo-which-one-will-be-used-when-opening-a-project) shows how to choose a specific one. If you would want
13+
to go with the Tombi's server, set this:
14+
15+
``` emacs-lisp
16+
(setq lsp-disabled-clients '(taplo))
17+
```

lsp-mode.el

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ As defined by the Language Server Protocol 3.16."
191191
lsp-ruby-lsp lsp-ruby-syntax-tree lsp-ruff lsp-rust lsp-semgrep lsp-shader
192192
lsp-solargraph lsp-solidity lsp-sonarlint lsp-sorbet lsp-sourcekit
193193
lsp-sql lsp-sqls lsp-steep lsp-svelte lsp-tailwindcss lsp-terraform
194-
lsp-tex lsp-tilt lsp-toml lsp-trunk lsp-ts-query lsp-ttcn3 lsp-typeprof
194+
lsp-tex lsp-tilt lsp-toml lsp-toml-tombi lsp-trunk lsp-ts-query lsp-ttcn3 lsp-typeprof
195195
lsp-typespec lsp-v lsp-vala lsp-verilog lsp-vetur lsp-vhdl lsp-vimscript
196196
lsp-volar lsp-wgsl lsp-xml lsp-yaml lsp-yang lsp-zig)
197197
"List of the clients to be automatically required."

mkdocs.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,8 @@ nav:
180180
- TeX, LaTeX, etc (texlab): page/lsp-texlab.md
181181
- TeX, LaTeX, etc (texlab, external): page/lsp-latex.md
182182
- Tilt: page/lsp-tilt.md
183-
- TOML: page/lsp-toml.md
183+
- TOML (Taplo): page/lsp-toml.md
184+
- TOML (Tombi): page/lsp-toml-tombi.md
184185
- Tree-sitter Query: page/lsp-ts-query.md
185186
- Trunk: page/lsp-trunk.md
186187
- TTCN3: page/lsp-ttcn3.md

0 commit comments

Comments
 (0)