46 lines · plain
1;;; tblgen-lsp-client.el --- Description -*- lexical-binding: t; -*-2;;3;; Package-Requires: ((emacs "24.3"))4;;5;; This file is not part of GNU Emacs.6;;7;;; Commentary:8;; LSP client to use with `tablegen-mode' that uses `tblgen-lsp-server' or any9;; user made compatible server.10;;11;;12;;; Code:13(require 'lsp-mode)14 15(defgroup lsp-tblgen nil16 "LSP support for Tablegen."17 :group 'lsp-mode18 :link '(url-link "https://mlir.llvm.org/docs/Tools/MLIRLSP/"))19 20(defcustom lsp-tblgen-server-executable "tblgen-lsp-server"21 "Command to start the mlir language server."22 :group 'lsp-tblgen23 :risky t24 :type 'file)25 26 27(defcustom lsp-tblgen-server-args ""28 "Args of LSP client for TableGen, for example '--tablegen-compilation-database=.../build/tablegen_compile_commands.yml'"29 :group 'lsp-tblgen30 :risky t31 :type 'file)32 33(defun lsp-tblgen-setup ()34 "Setup the LSP client for TableGen."35 (add-to-list 'lsp-language-id-configuration '(tablegen-mode . "tablegen"))36 37 (lsp-register-client38 (make-lsp-client39 :new-connection (lsp-stdio-connection (lambda () (cons lsp-tblgen-server-executable (split-string-shell-command lsp-tblgen-server-args))))40 :activation-fn (lsp-activate-on "tablegen")41 :priority -142 :server-id 'tblgen-lsp)))43 44(provide 'tblgen-lsp)45;;; tblgen-lsp-client.el ends here46