|
| 1 | +;;; lsp-toml-tombi.el --- lsp-mode TOML integration -*- lexical-binding: t; -*- |
| 2 | + |
| 3 | +;; Copyright (C) 2025 Sibi Prabakaran |
| 4 | + |
| 5 | +;; Author: Sibi Prabakaran <[email protected]> |
| 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 |
0 commit comments