branch: externals/eglot commit 1f8c2387ddcb753659ecf2c912069e12072b1814 Author: João Távora <joaotav...@gmail.com> Commit: João Távora <joaotav...@gmail.com>
Add PHP's php-language-server to built-in guessed servers Closes #1. The problem in that issue is that php-language-server has a bug when it's not passed it the deprecated ":rootPath" field. The bug doesn't happen if the ":processId" field is also absent. Eglot was triggering the bug, because it didn't pass ":rootPath", but there's nothing wrong in doing so. * README.md: Add php-language-server to the built-in list. * eglot.el (eglot-server-programs): Add php-language-server. (eglot--connect): Also pass (deprecated) rootPath. --- README.md | 4 +++- eglot.el | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 2bac974..b87666c 100644 --- a/README.md +++ b/README.md @@ -15,12 +15,13 @@ M-x eglot *That's it*. If you're lucky, this guesses the LSP executable to start for the language of your choice. Otherwise, it prompts you to enter one: -`M-x eglot` currently guesses and works out-of-the-box with: +`M-x eglot` can guess and work out-of-the-box with these servers: * Javascript's [javascript-typescript-stdio][javascript-typescript-langserver] * Rust's [rls][rls] * Python's [pyls][pyls] * Bash's [bash-language-server][bash-language-server] +* PHP's [php-language-server][php-language-server] I'll add to this list as I test more servers. In the meantime you can customize `eglot-server-programs`: @@ -193,6 +194,7 @@ Under the hood: [emacs-lsp]: https://github.com/emacs-lsp/lsp-mode [emacs-lsp-plugins]: https://github.com/emacs-lsp [bash-language-server]: https://github.com/mads-hartmann/bash-language-server +[php-language-server]: https://github.com/felixfbecker/php-language-server [company-mode]: https://github.com/company-mode/company-mode diff --git a/eglot.el b/eglot.el index 4ff6204..da3a09f 100644 --- a/eglot.el +++ b/eglot.el @@ -71,7 +71,9 @@ (defvar eglot-server-programs '((rust-mode . ("rls")) (python-mode . ("pyls")) (js-mode . ("javascript-typescript-stdio")) - (sh-mode . ("bash-language-server" "start"))) + (sh-mode . ("bash-language-server" "start")) + (php-mode . ("php" "vendor/felixfbecker/\ +language-server/bin/php-language-server.php"))) "Alist mapping major modes to server executables.") (defface eglot-mode-line @@ -276,6 +278,7 @@ INTERACTIVE is t if inside interactive call." 'network) (emacs-pid)) :capabilities(eglot--client-capabilities) + :rootPath (car (project-roots project)) :rootUri (eglot--path-to-uri (car (project-roots project))) :initializationOptions []))