Oni: Support PHP language server

Created on 22 Aug 2017  路  7Comments  路  Source: onivim/oni

Why isn't there any support for PHP in Roadmap?

enhancement help wanted language-integration

Most helpful comment

Thanks for the update @wxactly ! That's great news that it's working with the latest version of php-language-server! 馃帀 Really appreciate you sharing the config and settings that worked.

The log output is very helpful. It looks like in general it's working - but I do see one issue in particular:

bundle.js:1 Error: Method completionItem/resolve is not implemented
    at new ResponseError (/Applications/Oni.app/Contents/Resources/app/node_modules/vscode-jsonrpc/lib/messages.js:46)
    at handleResponse (/Applications/Oni.app/Contents/Resources/app/node_modules/vscode-jsonrpc/lib/main.js:430)
    at processMessageQueue (/Applications/Oni.app/Contents/Resources/app/node_modules/vscode-jsonrpc/lib/main.js:258)
    at Immediate._onImmediate (/Applications/Oni.app/Contents/Resources/app/node_modules/vscode-jsonrpc/lib/main.js:242)
    at runCallback (timers.js:781)
    at tryOnImmediate (timers.js:743)
    at processImmediate [as _immediateCallback] (timers.js:714)
t.error @ bundle.js:1
r._currentPromise.the

It seems we are always sending a completionItem/resolve request, even in the case where the language server doesn't support it. If the language server does not specify support for this in the initialize call, then we should respect that.

The other issue I saw in the logs is not being able to find a specialized textmate grammar for syntax highlighting - this is harmless, but it will actually be resolved in the next release, as @Akin909 added support for it in #2068 馃挴

So these are the outstanding issues I see remaining:

  • [ ] Fix the completionItem/resolve behavior such that it respects the configuration specified by the language server
  • [ ] Add an automated test case to verify that Oni works with php (similiar to what we added for Reason: #1189)
  • [ ] Add documentation in our wiki page: https://github.com/onivim/oni/wiki/Language-Support

All 7 comments

Ah, sorry if that wasn't clear! Issue #504 is tracking having a generalized language server integratoin.

Once this is in, it'd be easy to integrate Oni with one of the PHP language servers listed at http://langserver.org:

  • github.com/felixfbecker/php-language-server
  • github.com/HvyIndustries/crane/blob/master/server

By using a configuration setting. I'll leave this open to track validating that generalized solution works against one of those PHP servers. Thanks for the question, @azzsh !

I installed felixfbecker/php-language-server and added this configuration:

`"language.php.languageServer": {
        "command": "php",
        "arguments": ["/path/to/home/.composer/vendor/felixfbecker/language-server/bin/php-language-server.php"],`

When I open a PHP file with oni, there's a lightning sign in the status bar, and a language server process is launched, however nothing seems to happen: no completion, impossible to go to definition... What went wrong?

@bryphe Awesome IDE(a) and we cannot wait to have PHP running with it. How can we help, what can we do to get php language support? Currently using just neovim but the features provided by oni is exactly what one wants.. Beautiful GUI with the power of vim/neovim..

When do you think we will have the chance to run php lang with it?

@bryphe Awesome IDE(a) and we cannot wait to have PHP running with it.

Cheers, thanks!

How can we help, what can we do to get php language support?

Unfortunately I don't have a PHP environment set up at the moment to test with. But if you're up for debugging, that would be great!

This configuration looks like a good start:

`"language.php.languageServer": {
        "command": "php",
        "arguments": ["/path/to/home/.composer/vendor/felixfbecker/language-server/bin/php-language-server.php"],`

But I believe there may be a bug where it only accepts the string form right now, so collapsing the configuration options is worth a shot:

"language.php.languageServer.command": "php",     
"language.php.languageServer.arguments": ["/path/to/home/.composer/vendor/felixfbecker/language-server/bin/php-language-server.php"],

The next step would be to grab the debug output from our console - I'm interested if there are any errors. You can do that by:

  • Control+Shift+P (or Apple+Shift+P on OSX) to open the command palette
  • Select 'Open Dev Tools':
    image

Once the dev tools are open, please enable debug logging:
image
by running Oni.log.enableDebugLogging() in the console

Then, if you could navigate to a php file and share the output, that would be able to help us see if the server is being initialized, and if there are any errors.

Thanks @felmab & @Sydney-o9 for your help & interest in the project!

Actually, I could not make it work with the string form. Apparently it does make requests to the language server, either there is no answer or Oni cannot deal with it... I do not know how one is supposed to debug a language server, though.

1512123026383.log
1512123494432.log

Hey everyone - new user here. So excited to have discovered Oni, and this thread! Wanted to drop a note here to say that the latest version of php-language-server seems to be working great with Oni.

I installed php-language-server per the instructions here: https://github.com/felixfbecker/php-language-server#installation

cd /your/composer/path
composer require felixfbecker/language-server
composer run-script --working-dir=vendor/felixfbecker/language-server parse-stubs

And this oni config:

export const configuration = {
    //...

    "language.php.languageServer.command": "php",
    "language.php.languageServer.arguments": [
      "/your/composer/path/vendor/felixfbecker/language-server/bin/php-language-server.php"
    ],
}

@bryphe - here's the log output I'm seeing. Like I said, the server is working for me. But I do see a couple errors in there, in case those are helpful for debugging. Thanks all!

php-language-server-20180423.log

Thanks for the update @wxactly ! That's great news that it's working with the latest version of php-language-server! 馃帀 Really appreciate you sharing the config and settings that worked.

The log output is very helpful. It looks like in general it's working - but I do see one issue in particular:

bundle.js:1 Error: Method completionItem/resolve is not implemented
    at new ResponseError (/Applications/Oni.app/Contents/Resources/app/node_modules/vscode-jsonrpc/lib/messages.js:46)
    at handleResponse (/Applications/Oni.app/Contents/Resources/app/node_modules/vscode-jsonrpc/lib/main.js:430)
    at processMessageQueue (/Applications/Oni.app/Contents/Resources/app/node_modules/vscode-jsonrpc/lib/main.js:258)
    at Immediate._onImmediate (/Applications/Oni.app/Contents/Resources/app/node_modules/vscode-jsonrpc/lib/main.js:242)
    at runCallback (timers.js:781)
    at tryOnImmediate (timers.js:743)
    at processImmediate [as _immediateCallback] (timers.js:714)
t.error @ bundle.js:1
r._currentPromise.the

It seems we are always sending a completionItem/resolve request, even in the case where the language server doesn't support it. If the language server does not specify support for this in the initialize call, then we should respect that.

The other issue I saw in the logs is not being able to find a specialized textmate grammar for syntax highlighting - this is harmless, but it will actually be resolved in the next release, as @Akin909 added support for it in #2068 馃挴

So these are the outstanding issues I see remaining:

  • [ ] Fix the completionItem/resolve behavior such that it respects the configuration specified by the language server
  • [ ] Add an automated test case to verify that Oni works with php (similiar to what we added for Reason: #1189)
  • [ ] Add documentation in our wiki page: https://github.com/onivim/oni/wiki/Language-Support
Was this page helpful?
0 / 5 - 0 ratings

Related issues

keforbes picture keforbes  路  19Comments

phaazon picture phaazon  路  21Comments

jordwalke picture jordwalke  路  25Comments

badosu picture badosu  路  20Comments

hboon picture hboon  路  21Comments