Skip to content

Commit 1184e0e

Browse files
committedJun 3, 2022
Add Eglot activation to php-ui.el
1 parent 40c3a92 commit 1184e0e

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed
 

‎lisp/php-ui.el

+22
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@
4141
;;
4242
;; - none
4343
;; Does not launch any IDE features.
44+
;; - eglot
45+
;; https://github.com/joaotavora/eglot
4446
;; - lsp-mode
4547
;; https://emacs-lsp.github.io/lsp-mode/
4648
;; https://github.com/emacs-lsp/lsp-mode
@@ -95,6 +97,9 @@
9597
(phpactor :test (lambda () (and (require 'phpactor nil t) (featurep 'phpactor)))
9698
:activate php-ui-phpactor-activate
9799
:deactivate php-ui-phpactor-activate)
100+
(eglot :test (lambda () (and (require 'eglot nil t) (featurep 'eglot)))
101+
:activate eglot-ensure
102+
:deactivate eglot--managed-mode-off)
98103
(lsp-mode :test (lambda () (and (require 'lsp nil t) (featurep 'lsp)))
99104
:activate lsp
100105
:deactivate lsp-workspace-shutdown)))
@@ -105,6 +110,13 @@
105110
:prefix "php-ui-"
106111
:group 'php)
107112

113+
(defcustom php-ui-eglot-executable nil
114+
"A symbol of PHP-UI feature"
115+
:tag "PHP-UI Eglot Executable"
116+
:group 'php-ui
117+
:type '(repeat string)
118+
:safe (lambda (v) (or (stringp v) (listp v))))
119+
108120
(defcustom php-ui-feature nil
109121
"A symbol of PHP-UI feature"
110122
:tag "PHP-UI Feature"
@@ -146,6 +158,16 @@
146158
(let ((php-ui-feature feature))
147159
(php-ui-mode +1)))
148160

161+
;;;###autoload
162+
(defun php-ui-eglot-server-program ()
163+
"Return a list of command to execute LSP Server."
164+
(if (stringp php-ui-eglot-executable)
165+
(list php-ui-eglot-executable)
166+
php-ui-eglot-executable))
167+
168+
(defun php-ui--eglot-current-server ()
169+
(php-project-get-root-dir))
170+
149171
(defun php-ui--activate-buffer (ui-plist)
150172
"Activate php-ui implementation by UI-PLIST."
151173
(funcall (plist-get ui-plist :activate)))

0 commit comments

Comments
 (0)