-
Notifications
You must be signed in to change notification settings - Fork 200
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Getting eglot to work with php-language-server #1
Comments
Of course! At least that's Eglot's main point, to work with any language server. Do you have php-language-server installed and ready to run in your project? If so then it's a matter of evaluating this tiny piece of elisp (add-to-list 'eglot-server-programs
'(php-mode . ("php" "vendor/felixfbecker/language-server/bin/php-language-server.php"))) Then place yourself in a .php file and type M-x eglot. Report here if it works, and I can help you troubleshoot it. If everything goes OK, I can add that piece of elisp to eglot itself, so you won't have to have in your .emacs. |
I have setup a minimal php environment and am trying to get this to work. I'm hitting a problem, but it shouldn't take me long to solve it, I believe... |
Okay, I was trying it out myself and had a problem too. I tried it using XAMPP on windows, so I decided to try using msys2 instead and see if that will make it work. Thanks a ton for helping me out. Sorry for not replying til now I wanted to bring good news so I wanted to try msys2 |
I got it to work using a separately started server $ cd path/to/your/project
$ php vendor/felixfbecker/language-server/bin/php-language-server.php --tcp-server=localhost:9009
DEBUG Checking PHPLS_ALLOW_XDEBUG
DEBUG The xdebug extension is not loaded
DEBUG Server listening on localhost:9009 Then in Emacs, go to a php-mode file and type For some reason that I will ask @felixfbecker about tomorrow, when starting with the normal stdio version, I get an error for the
And this is what I passed it: {
"jsonrpc": "2.0",
"id": 187,
"method": "initialize",
"params": {
"processId": 10335,
"capabilities": {
"workspace": {
"applyEdit": true,
"workspaceEdit": {
"documentChanges": false
},
"didChangeWatchesFiles": {
"dynamicRegistration": true
},
"symbol": {
"dynamicRegistration": false
}
},
"textDocument": {
"synchronization": {
"dynamicRegistration": false,
"willSave": true,
"willSaveWaitUntil": true,
"didSave": true
},
"completion": {
"dynamicRegistration": false
},
"hover": {
"dynamicRegistration": false
},
"signatureHelp": {
"dynamicRegistration": false
},
"references": {
"dynamicRegistration": false
},
"definition": {
"dynamicRegistration": false
},
"documentSymbol": {
"dynamicRegistration": false
},
"documentHighlight": {
"dynamicRegistration": false
},
"rename": {
"dynamicRegistration": false
},
"publishDiagnostics": {
"relatedInformation": false
}
},
"experimental": null
},
"rootUri": "file:///home/capitaomorte/Source/PhP/hello-world/",
"initializationOptions": []
}
} |
Weird, looks like it is passing the |
Isn't this it already? When that JSON is given as the first input, the failure happens. |
Indeed if I pass |
@felixfbecker So I also discovered that if you pass it the (deprecated) "rootPath" option, the bug doesn't happen. Because there's nothing wrong in doing so, I have amended eglot to also pass that field. @LeviHarman Install felix's server according to the instructions and you should be good to go. Let me know if you run into any more problems. |
@joaotavora sorry, I was offering to assist in case you wanted to write a test and potentially a bug fix for the library. Unfortunately I currently don't have time to look into it. |
Hey, it's your bug :) that'll eventually happen with other clients. And
I've never written a line of PHP in my life :)
Anyway, eglot has a workaround in place now so don't worry about it.
…On Tue, May 15, 2018, 17:59 Felix Becker ***@***.***> wrote:
@joaotavora <https://github.com/joaotavora> sorry, I was offering to
assist in case you wanted to write a test and potentially a bug fix for the
library. Unfortunately I currently don't have time to look into it.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAXnw-56oKEDm87gCPEG0v7KhTnGTqorks5tywlSgaJpZM4T-Z6h>
.
|
Hi again. I'm getting a timeout problem. I am using the new version of eglot (I tried the one on melpa and cloning the repo here to try out afterwards.) with emacs 26.1. I am not sure what is the cause right now. In the Warnings buffer I'm getting I'm using Cygwin, since I couldn't build emacs 26.1 with MSYS2 . P.S. I'd like to say thank you for eglot it is very nice of you to put your time into supporting lsp in emacs. In *~ stderr* I'm getting
In EGLOT server (~/php-mode) events I'm getting these messages
|
@LeviHarman is your php executable a "cygwin-installed" php, or is it some other php? Check with Then try selecting some part of some buffer, any buffer, and typing Also, can you try first with the "host:port" solution as I described above? I think the problem may lie in the fact that windows doesn't allow stdin/stdout communication the way unix-based operating system do. However, cygwin should emulate this if you work with cygwin-enabled programs (which can be a pain). I don't have access to a cygwin box right now to test. The network approach is a common solution to this problem. Right now, it is slightly more complicated, since you have the extra step of starting a server, but I am working on ways to simplify that in eglot.el. |
@LeviHarman let's continue this in #2. I finally tested on windows and fixed some serious problems that may have been causing your issues. |
Okay @joaotavora, I'll continue there. I've been rebuilding emacs 26.1. I am getting a few warning which I'm trying to take care of but I should have the information you asked about by today probably in 12 hours since it takes a while to build on my PC. |
You might want to build from scratch, but if you just want to try the Emacs 26.1 Release Candidate 1 on Windows, you can get a pre-built one from here (64 bits) or here (32 bits) |
I think I just got lucky and it's built now. I'll try those in a bit. Thank you. I'll post in issue #2 after I try out what you suggested yesterday. |
Closes joaotavora/eglot#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.
Closes joaotavora/eglot#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.
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. #1: joaotavora/eglot#1
Closes joaotavora/eglot#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.
Is there any way to get eglot to work with other language servers? I'm interested in using https://github.com/felixfbecker/php-language-server and don't mind setting it up myself similar to how is described in lsp-mode.
The text was updated successfully, but these errors were encountered: