-
Notifications
You must be signed in to change notification settings - Fork 14.8k
[emacs][lsp][tblgen] add tblgen-lsp-server support for emacs lsp-mode #76337
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Thank you for submitting a Pull Request (PR) to the LLVM Project! This PR will be automatically labeled and the relevant teams will be If you wish to, you can add reviewers by using the "Reviewers" section on this page. If this is not working for you, it is probably because you do not have write If you have received no comments on your PR for a week, you can request a review If you have further questions, they may be answered by the LLVM GitHub User Guide. You can also ask questions in a comment on this PR, on the LLVM Discord or on the forums. |
@llvm/pr-subscribers-mlir Author: None (mgcsysinfcat) ChangesFull diff: https://github.com/llvm/llvm-project/pull/76337.diff 1 Files Affected:
diff --git a/mlir/utils/emacs/tblgen-lsp.el b/mlir/utils/emacs/tblgen-lsp.el
new file mode 100644
index 00000000000000..607459549193a1
--- /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
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you very much for doing this!
Since the tblgen
name of the group is used in the customization UI names as Lsp Tblgen Server Args
or Lsp Tblgen Server Executable
, I wonder whether we should not rename any tblgen
to tablegen
in this file to be clearer.
Also this file could be renamed to tblgen-lsp-client.el
to follow mlir-lsp-client.el
.
Co-authored-by: Ronan Keryell <[email protected]>
Co-authored-by: Ronan Keryell <[email protected]>
Co-authored-by: Ronan Keryell <[email protected]>
Co-authored-by: Ronan Keryell <[email protected]>
Co-authored-by: Ronan Keryell <[email protected]>
Thank you for your feedback! It's been a while since I last worked on these, so I hope I didn't overlook anything. I've made the requested changes to the submission. |
I am sorry that nobody gave you feedback before. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Almost there.
Co-authored-by: Ronan Keryell <[email protected]>
Co-authored-by: Ronan Keryell <[email protected]>
@joker-eph could you please look at this, as you contributed |
@ftynse Thanks! |
No description provided.