emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/php-mode a01bb220bf 09/15: Add php-ide-eglot-server-progra


From: ELPA Syncer
Subject: [nongnu] elpa/php-mode a01bb220bf 09/15: Add php-ide-eglot-server-program command
Date: Sat, 18 Mar 2023 18:01:27 -0400 (EDT)

branch: elpa/php-mode
commit a01bb220bfa1bf3991dbc79d50ea49342d7a6833
Author: USAMI Kenta <tadsan@zonu.me>
Commit: USAMI Kenta <tadsan@zonu.me>

    Add php-ide-eglot-server-program command
---
 lisp/php-ide.el | 27 ++++++++++++++++++++++++++-
 1 file changed, 26 insertions(+), 1 deletion(-)

diff --git a/lisp/php-ide.el b/lisp/php-ide.el
index c0bf2e6876..8d6cc758a6 100644
--- a/lisp/php-ide.el
+++ b/lisp/php-ide.el
@@ -84,10 +84,10 @@
 ;;
 
 ;;; Code:
+(require 'cl-lib)
 (require 'php-project)
 
 (eval-when-compile
-  (require 'cl-lib)
   (require 'php-ide-phpactor)
   (defvar eglot-server-programs)
   (declare-function lsp-bridge-mode "ext:lsp-bridge" ())
@@ -136,6 +136,31 @@
   :safe (lambda (v) (cl-loop for feature in (if (listp v) v (list v))
                              always (symbolp feature))))
 
+;;;###autoload
+(defcustom php-ide-eglot-executable nil
+  "Command name or path to the command of Eglot LSP executable."
+  :tag "PHP-IDE Eglot Executable"
+  :group 'php-ide
+  :type '(choice
+          (const intelephense)
+          (const phpactor)
+          string (repeat string))
+  :safe (lambda (v) (cond
+                     ((stringp v) (file-exists-p v))
+                     ((listp v) (cl-every #'stringp v))
+                     ((assq v php-ide-lsp-command-alist)))))
+
+;;;###autoload
+(defun php-ide-eglot-server-program ()
+  "Return a list of command to execute LSP Server."
+  (cond
+   ((stringp php-ide-eglot-executable) (list php-ide-eglot-executable))
+   ((listp php-ide-eglot-executable) php-ide-eglot-executable)
+   ((when-let (command (assq php-ide-eglot-executable 
php-ide-lsp-command-alist))
+      (cond
+       ((functionp command) (funcall command))
+       ((listp command) command))))))
+
 (defcustom php-ide-mode-lighter " PHP-IDE"
   "A symbol of PHP-IDE feature."
   :tag "PHP-IDE Mode Lighter"



reply via email to

[Prev in Thread] Current Thread [Next in Thread]