diff --git a/lsp-sourcekit.el b/lsp-sourcekit.el index 8be4b62..b31b177 100644 --- a/lsp-sourcekit.el +++ b/lsp-sourcekit.el @@ -29,9 +29,9 @@ ;;; Commentary: ;; -;; Call (lsp) after visiting a file in swift-mode major mode. -;; -;; TODO: Configure the Objective-C/C++ LSP client (requires clangd). +;; Call (lsp) after visiting a file in a major mode supported by +;; sourcekit-lsp. + ;;; Code: @@ -41,17 +41,25 @@ ;; Customization ;; --------------------------------------------------------------------- -(defcustom lsp-sourcekit-executable - "sourcekit" - "Path of the lsp-sourcekit executable." + +(defgroup lsp-sourcekit nil + "LSP support for Swift & C-family languages (C, C++, +Objective-C, Objective-C++) using sourcekit-lsp." + :group 'lsp-mode + :tag "Language Server" + :link '(url-link "https://github.com/apple/sourcekit-lsp")) + +(defcustom lsp-sourcekit-executable "sourcekit-lsp" + "The sourcekit-lsp executable to use. +Leave as just the executable name to use the default behavior of +finding the executable with `exec-path'." :type 'file - :group 'sourcekit) + :group 'lsp-sourcekit) -(defcustom lsp-sourcekit-extra-args - nil - "Additional command line options passed to the lsp-sourcekit executable." +(defcustom lsp-sourcekit-extra-args nil + "Extra arguments for the sourcekit-lsp executable." :type '(repeat string) - :group 'sourcekit) + :group 'lsp-sourcekit) ;; --------------------------------------------------------------------- ;; Register lsp client @@ -59,13 +67,13 @@ (defun lsp-sourcekit--lsp-command () "Generate the language server startup command." - `(,lsp-sourcekit-executable - ,@lsp-sourcekit-extra-args)) + `(,lsp-sourcekit-executable ,@lsp-sourcekit-extra-args)) (lsp-register-client - (make-lsp-client :new-connection (lsp-stdio-connection 'lsp-sourcekit--lsp-command) - :major-modes '(swift-mode) - :server-id 'sourcekit-ls)) + (make-lsp-client :new-connection (lsp-stdio-connection + 'lsp-sourcekit--lsp-command) + :major-modes '(swift-mode c-mode c++-mode objc-mode) + :server-id 'sourcekit-lsp)) (provide 'lsp-sourcekit) ;;; lsp-sourcekit.el ends here