From b530c6dfc9d2e098b3634ea720f0b0bfde0d411f Mon Sep 17 00:00:00 2001 From: mgcsysinfcat Date: Sun, 24 Dec 2023 23:00:00 +0800 Subject: [PATCH 1/9] add tblgen-lsp-server support for lsp-mode --- mlir/utils/emacs/tblgen-lsp.el | 45 ++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 mlir/utils/emacs/tblgen-lsp.el diff --git a/mlir/utils/emacs/tblgen-lsp.el b/mlir/utils/emacs/tblgen-lsp.el new file mode 100644 index 0000000000000..607459549193a --- /dev/null +++ b/mlir/utils/emacs/tblgen-lsp.el @@ -0,0 +1,45 @@ +;;; tblgen-lsp.el --- Description -*- lexical-binding: t; -*- +;; +;; Package-Requires: ((emacs "24.3")) +;; +;; This file is not part of GNU Emacs. +;; +;;; Commentary: +;; LSP clinet to use with `tablegen-mode' that uses `tblgen-lsp-server' or any +;; user made compatible server. +;; +;; +;;; Code: + + +(defgroup lsp-tblgen nil + "LSP support for Tablegen." + :group 'lsp-mode + :link '(url-link "https://mlir.llvm.org/docs/Tools/MLIRLSP/")) + +(defcustom lsp-tblgen-server-executable "tblgen-lsp-server" + "Command to start the mlir language server." + :group 'lsp-tblgen + :risky t + :type 'file) + + +(defcustom lsp-tblgen-server-args "" + "Args of LSP client for TableGen " + :group 'lsp-tblgen + :risky t + :type 'file) + +(defun lsp-tblgen-setup () + "Setup the LSP client for TableGen." + (add-to-list 'lsp-language-id-configuration '(tablegen-mode . "tablegen")) + + (lsp-register-client + (make-lsp-client + :new-connection (lsp-stdio-connection (lambda () (cons lsp-tblgen-server-executable lsp-tblgen-server-args))); (concat "--tablegen-compilation-database=" lsp-tblgen-compilation-database-location) ))) + :activation-fn (lsp-activate-on "tablegen") + :priority -1 + :server-id 'tblgen-lsp-server))) + +(provide 'tblgen-lsp) +;;; tblgen-lsp.el ends here From bda821407d1ce2a956a5a9ba06ae7bedd1635837 Mon Sep 17 00:00:00 2001 From: mgcsysinfcat <143941278+mgcsysinfcat@users.noreply.github.com> Date: Thu, 9 Jan 2025 03:07:38 +0800 Subject: [PATCH 2/9] Update mlir/utils/emacs/tblgen-lsp.el Co-authored-by: Ronan Keryell --- mlir/utils/emacs/tblgen-lsp.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mlir/utils/emacs/tblgen-lsp.el b/mlir/utils/emacs/tblgen-lsp.el index 607459549193a..d0e9a4e8dbc38 100644 --- a/mlir/utils/emacs/tblgen-lsp.el +++ b/mlir/utils/emacs/tblgen-lsp.el @@ -36,7 +36,7 @@ (lsp-register-client (make-lsp-client - :new-connection (lsp-stdio-connection (lambda () (cons lsp-tblgen-server-executable lsp-tblgen-server-args))); (concat "--tablegen-compilation-database=" lsp-tblgen-compilation-database-location) ))) + :new-connection (lsp-stdio-connection (lambda () (cons lsp-tblgen-server-executable (split-string-shell-command lsp-tblgen-server-args)))) :activation-fn (lsp-activate-on "tablegen") :priority -1 :server-id 'tblgen-lsp-server))) From 7735afb94b5acf7ab463a0cb8366b91fdcc1247c Mon Sep 17 00:00:00 2001 From: mgcsysinfcat <143941278+mgcsysinfcat@users.noreply.github.com> Date: Thu, 9 Jan 2025 03:07:48 +0800 Subject: [PATCH 3/9] Update mlir/utils/emacs/tblgen-lsp.el Co-authored-by: Ronan Keryell --- mlir/utils/emacs/tblgen-lsp.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mlir/utils/emacs/tblgen-lsp.el b/mlir/utils/emacs/tblgen-lsp.el index d0e9a4e8dbc38..a585e044e5ff9 100644 --- a/mlir/utils/emacs/tblgen-lsp.el +++ b/mlir/utils/emacs/tblgen-lsp.el @@ -5,7 +5,7 @@ ;; This file is not part of GNU Emacs. ;; ;;; Commentary: -;; LSP clinet to use with `tablegen-mode' that uses `tblgen-lsp-server' or any +;; LSP client to use with `tablegen-mode' that uses `tblgen-lsp-server' or any ;; user made compatible server. ;; ;; From eb9a2b18935b764bf336cd4e92f358828a8d237b Mon Sep 17 00:00:00 2001 From: mgcsysinfcat <143941278+mgcsysinfcat@users.noreply.github.com> Date: Thu, 9 Jan 2025 03:07:56 +0800 Subject: [PATCH 4/9] Update mlir/utils/emacs/tblgen-lsp.el Co-authored-by: Ronan Keryell --- mlir/utils/emacs/tblgen-lsp.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mlir/utils/emacs/tblgen-lsp.el b/mlir/utils/emacs/tblgen-lsp.el index a585e044e5ff9..69e30f35c2e6a 100644 --- a/mlir/utils/emacs/tblgen-lsp.el +++ b/mlir/utils/emacs/tblgen-lsp.el @@ -39,7 +39,7 @@ :new-connection (lsp-stdio-connection (lambda () (cons lsp-tblgen-server-executable (split-string-shell-command lsp-tblgen-server-args)))) :activation-fn (lsp-activate-on "tablegen") :priority -1 - :server-id 'tblgen-lsp-server))) + :server-id 'tblgen-lsp))) (provide 'tblgen-lsp) ;;; tblgen-lsp.el ends here From cdb6c4c5ecf4ccdf3ac43271dfc81b618c85a65f Mon Sep 17 00:00:00 2001 From: mgcsysinfcat <143941278+mgcsysinfcat@users.noreply.github.com> Date: Thu, 9 Jan 2025 03:08:07 +0800 Subject: [PATCH 5/9] Update mlir/utils/emacs/tblgen-lsp.el Co-authored-by: Ronan Keryell --- mlir/utils/emacs/tblgen-lsp.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mlir/utils/emacs/tblgen-lsp.el b/mlir/utils/emacs/tblgen-lsp.el index 69e30f35c2e6a..e6f541a994987 100644 --- a/mlir/utils/emacs/tblgen-lsp.el +++ b/mlir/utils/emacs/tblgen-lsp.el @@ -10,7 +10,7 @@ ;; ;; ;;; Code: - +(require 'lsp-mode) (defgroup lsp-tblgen nil "LSP support for Tablegen." From 676b06c5bdc3e2637357be9ed92a63dc73630343 Mon Sep 17 00:00:00 2001 From: mgcsysinfcat <143941278+mgcsysinfcat@users.noreply.github.com> Date: Thu, 9 Jan 2025 03:08:16 +0800 Subject: [PATCH 6/9] Update mlir/utils/emacs/tblgen-lsp.el Co-authored-by: Ronan Keryell --- mlir/utils/emacs/tblgen-lsp.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mlir/utils/emacs/tblgen-lsp.el b/mlir/utils/emacs/tblgen-lsp.el index e6f541a994987..e40477abb7fee 100644 --- a/mlir/utils/emacs/tblgen-lsp.el +++ b/mlir/utils/emacs/tblgen-lsp.el @@ -25,7 +25,7 @@ (defcustom lsp-tblgen-server-args "" - "Args of LSP client for TableGen " + "Args of LSP client for TableGen, for example '--tablegen-compilation-database=.../build/tablegen_compile_commands.yml'" :group 'lsp-tblgen :risky t :type 'file) From 7940272a6104f1bed9aba52db7d2a579a8beb181 Mon Sep 17 00:00:00 2001 From: mgcsysinfcat <143941278+mgcsysinfcat@users.noreply.github.com> Date: Thu, 9 Jan 2025 03:11:43 +0800 Subject: [PATCH 7/9] Rename tblgen-lsp.el to tblgen-lsp-client.el to follow mlir-lsp-client.el --- mlir/utils/emacs/{tblgen-lsp.el => tblgen-lsp-client.el} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename mlir/utils/emacs/{tblgen-lsp.el => tblgen-lsp-client.el} (100%) diff --git a/mlir/utils/emacs/tblgen-lsp.el b/mlir/utils/emacs/tblgen-lsp-client.el similarity index 100% rename from mlir/utils/emacs/tblgen-lsp.el rename to mlir/utils/emacs/tblgen-lsp-client.el From edc188c9ada2f0f542d56adaed7053955f2e9db7 Mon Sep 17 00:00:00 2001 From: mgcsysinfcat <143941278+mgcsysinfcat@users.noreply.github.com> Date: Fri, 10 Jan 2025 04:50:18 +0800 Subject: [PATCH 8/9] Update mlir/utils/emacs/tblgen-lsp-client.el Co-authored-by: Ronan Keryell --- mlir/utils/emacs/tblgen-lsp-client.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mlir/utils/emacs/tblgen-lsp-client.el b/mlir/utils/emacs/tblgen-lsp-client.el index e40477abb7fee..b989316865d95 100644 --- a/mlir/utils/emacs/tblgen-lsp-client.el +++ b/mlir/utils/emacs/tblgen-lsp-client.el @@ -42,4 +42,4 @@ :server-id 'tblgen-lsp))) (provide 'tblgen-lsp) -;;; tblgen-lsp.el ends here +;;; tblgen-lsp-client.el ends here From e2f339550866df7838657f8d04a437ca45c7d688 Mon Sep 17 00:00:00 2001 From: mgcsysinfcat <143941278+mgcsysinfcat@users.noreply.github.com> Date: Fri, 10 Jan 2025 04:50:28 +0800 Subject: [PATCH 9/9] Update mlir/utils/emacs/tblgen-lsp-client.el Co-authored-by: Ronan Keryell --- mlir/utils/emacs/tblgen-lsp-client.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mlir/utils/emacs/tblgen-lsp-client.el b/mlir/utils/emacs/tblgen-lsp-client.el index b989316865d95..6830e328eb8de 100644 --- a/mlir/utils/emacs/tblgen-lsp-client.el +++ b/mlir/utils/emacs/tblgen-lsp-client.el @@ -1,4 +1,4 @@ -;;; tblgen-lsp.el --- Description -*- lexical-binding: t; -*- +;;; tblgen-lsp-client.el --- Description -*- lexical-binding: t; -*- ;; ;; Package-Requires: ((emacs "24.3")) ;;