Skip to content

Commit c9260e6

Browse files
committed
Add php-ide-eglot-server-program command
1 parent dbcd587 commit c9260e6

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

Diff for: lisp/php-ide.el

+26-1
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,10 @@
8484
;;
8585

8686
;;; Code:
87+
(require 'cl-lib)
8788
(require 'php-project)
8889

8990
(eval-when-compile
90-
(require 'cl-lib)
9191
(require 'php-ide-phpactor)
9292
(defvar eglot-server-programs)
9393
(declare-function lsp-bridge-mode "ext:lsp-bridge" ())
@@ -136,6 +136,31 @@
136136
:safe (lambda (v) (cl-loop for feature in (if (listp v) v (list v))
137137
always (symbolp feature))))
138138

139+
;;;###autoload
140+
(defcustom php-ide-eglot-executable nil
141+
"Command name or path to the command of Eglot LSP executable."
142+
:tag "PHP-IDE Eglot Executable"
143+
:group 'php-ide
144+
:type '(choice
145+
(const intelephense)
146+
(const phpactor)
147+
string (repeat string))
148+
:safe (lambda (v) (cond
149+
((stringp v) (file-exists-p v))
150+
((listp v) (cl-every #'stringp v))
151+
((assq v php-ide-lsp-command-alist)))))
152+
153+
;;;###autoload
154+
(defun php-ide-eglot-server-program ()
155+
"Return a list of command to execute LSP Server."
156+
(cond
157+
((stringp php-ide-eglot-executable) (list php-ide-eglot-executable))
158+
((listp php-ide-eglot-executable) php-ide-eglot-executable)
159+
((when-let (command (assq php-ide-eglot-executable php-ide-lsp-command-alist))
160+
(cond
161+
((functionp command) (funcall command))
162+
((listp command) command))))))
163+
139164
(defcustom php-ide-mode-lighter " PHP-IDE"
140165
"A symbol of PHP-IDE feature."
141166
:tag "PHP-IDE Mode Lighter"

0 commit comments

Comments
 (0)