Skip to content

Commit

Permalink
Add PHP's php-language-server to built-in guessed servers
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
joaotavora committed May 15, 2018
1 parent a85bdc7 commit 1f8c238
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`:
Expand Down Expand Up @@ -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


5 changes: 4 additions & 1 deletion eglot.el
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 []))
Expand Down

0 comments on commit 1f8c238

Please sign in to comment.