Skip to content
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

Workspace symbol picker doesn't seem to work with Intelephense #3619

Closed
ejulen opened this issue Aug 31, 2022 · 4 comments · Fixed by #5055
Closed

Workspace symbol picker doesn't seem to work with Intelephense #3619

ejulen opened this issue Aug 31, 2022 · 4 comments · Fixed by #5055
Labels
A-language-server Area: Language server client C-bug Category: This is a bug

Comments

@ejulen
Copy link

ejulen commented Aug 31, 2022

Summary

Using Intelephense, workspace symbol lookup doesn't seem to work. Works fine in VS Code.

Reproduction Steps

I tried this:

Made a new directory, ran composer init, chose the namespace TestHelix, made two files in the src directory like so:

.
├── composer.json
├── src
│   ├── Bar.php
│   └── Foo.php
└── vendor
    ├── autoload.php
    └── composer
        ├── autoload_classmap.php
        ├── autoload_namespaces.php
        ├── autoload_psr4.php
        ├── autoload_real.php
        ├── autoload_static.php
        ├── ClassLoader.php
        └── LICENSE

With the following contents:

composer.json
{
    "name": "ejulen/test-hx-php",
    "autoload": {
        "psr-4": {
            "TestHelix\\": "src/"
        }
    },
    "require": {}
}
Foo.php
<?php

namespace TestHelix;

class Foo {}
Bar.php
<?php

namespace TestHelix;

class Bar {}

Then:

  1. hx -vvv src/Foo.php
  2. <space>S

I expected this to happen:
For a list of workspace symbols to show up.

Instead, this happened:
An empty picker shows up.

Helix log

~/.cache/helix/helix.log
2022-08-31T20:34:19.777 helix_loader [DEBUG] Located configuration folders: []
2022-08-31T20:34:19.781 helix_view::clipboard::provider [WARN] No clipboard provider found! Yanking and pasting will be internal to Helix
2022-08-31T20:34:19.801 mio::poll [TRACE] registering event source with poller: token=Token(1), interests=READABLE | WRITABLE
2022-08-31T20:34:19.801 mio::poll [TRACE] registering event source with poller: token=Token(2), interests=READABLE | WRITABLE
2022-08-31T20:34:19.801 mio::poll [TRACE] registering event source with poller: token=Token(3), interests=READABLE | WRITABLE
2022-08-31T20:34:19.801 mio::poll [TRACE] registering event source with poller: token=Token(4), interests=READABLE | WRITABLE
2022-08-31T20:34:19.801 mio::poll [TRACE] registering event source with poller: token=Token(5), interests=READABLE | WRITABLE
2022-08-31T20:34:19.801 helix_lsp::client [INFO] Using custom LSP config: {}
2022-08-31T20:34:19.801 mio::poll [TRACE] registering event source with poller: token=Token(0), interests=READABLE
2022-08-31T20:34:19.801 helix_lsp::transport [INFO] -> {"jsonrpc":"2.0","method":"initialize","params":{"capabilities":{"textDocument":{"codeAction":{"codeActionLiteralSupport":{"codeActionKind":{"valueSet":["","quickfix","refactor","refactor.extract","refactor.inline","refactor.rewrite","source","source.organizeImports"]}}},"completion":{"completionItem":{"resolveSupport":{"properties":["documentation","detail","additionalTextEdits"]},"snippetSupport":false},"completionItemKind":{}},"hover":{"contentFormat":["markdown"]},"publishDiagnostics":{},"rename":{"dynamicRegistration":false,"honorsChangeAnnotations":false,"prepareSupport":false},"signatureHelp":{"signatureInformation":{"activeParameterSupport":true,"documentationFormat":["markdown"],"parameterInformation":{"labelOffsetSupport":true}}}},"window":{"workDoneProgress":true},"workspace":{"applyEdit":true,"configuration":true,"didChangeConfiguration":{"dynamicRegistration":false},"symbol":{"dynamicRegistration":false},"workspaceFolders":true}},"initializationOptions":{},"processId":1135379,"rootPath":"/home/johannes/dev/test-hx-php","rootUri":"file:///home/johannes/dev/test-hx-php","workspaceFolders":[{"name":"test-hx-php","uri":"file:///home/johannes/dev/test-hx-php"}]},"id":0}
2022-08-31T20:34:19.801 mio::poll [TRACE] registering event source with poller: token=Token(1), interests=READABLE
2022-08-31T20:34:20.133 helix_lsp::transport [INFO] <- {"jsonrpc":"2.0","method":"window/logMessage","params":{"type":3,"message":"Initialising intelephense 1.8.2"}}
2022-08-31T20:34:20.133 helix_term::application [INFO] window/logMessage: LogMessageParams { typ: Info, message: "Initialising intelephense 1.8.2" }
2022-08-31T20:34:20.135 helix_lsp::transport [INFO] <- {"jsonrpc":"2.0","method":"window/logMessage","params":{"type":3,"message":"Reading state from /tmp/intelephense/4e5e2af1."}}
2022-08-31T20:34:20.135 helix_term::application [INFO] window/logMessage: LogMessageParams { typ: Info, message: "Reading state from /tmp/intelephense/4e5e2af1." }
2022-08-31T20:34:20.269 helix_lsp::transport [INFO] <- {"jsonrpc":"2.0","method":"window/logMessage","params":{"type":3,"message":"Intelephense premium features enabled."}}
2022-08-31T20:34:20.269 helix_lsp::transport [INFO] <- {"jsonrpc":"2.0","method":"window/logMessage","params":{"type":3,"message":"Initialised in 137 ms"}}
2022-08-31T20:34:20.269 helix_term::application [INFO] window/logMessage: LogMessageParams { typ: Info, message: "Intelephense premium features enabled." }
2022-08-31T20:34:20.269 helix_lsp::transport [INFO] <- {"jsonrpc":"2.0","id":0,"result":{"capabilities":{"textDocumentSync":2,"documentSymbolProvider":true,"workspaceSymbolProvider":true,"completionProvider":{"triggerCharacters":["$",">",":","\\","/","*",".","<"],"resolveProvider":true},"signatureHelpProvider":{"triggerCharacters":["(",",",":"]},"definitionProvider":true,"documentFormattingProvider":true,"documentRangeFormattingProvider":true,"referencesProvider":true,"hoverProvider":true,"documentHighlightProvider":true,"foldingRangeProvider":true,"implementationProvider":true,"declarationProvider":true,"workspace":{"workspaceFolders":{"supported":true,"changeNotifications":true}},"renameProvider":{"prepareProvider":true},"typeDefinitionProvider":true,"selectionRangeProvider":true,"codeActionProvider":true,"executeCommandProvider":{"commands":["intelephense.import.symbol","intelephense.implement.abstract.method.all","intelephense.phpdoc.add"]}}}}
2022-08-31T20:34:20.269 helix_term::application [INFO] window/logMessage: LogMessageParams { typ: Info, message: "Initialised in 137 ms" }
2022-08-31T20:34:20.269 helix_lsp::transport [INFO] <- {"capabilities":{"codeActionProvider":true,"completionProvider":{"resolveProvider":true,"triggerCharacters":["$",">",":","\\","/","*",".","<"]},"declarationProvider":true,"definitionProvider":true,"documentFormattingProvider":true,"documentHighlightProvider":true,"documentRangeFormattingProvider":true,"documentSymbolProvider":true,"executeCommandProvider":{"commands":["intelephense.import.symbol","intelephense.implement.abstract.method.all","intelephense.phpdoc.add"]},"foldingRangeProvider":true,"hoverProvider":true,"implementationProvider":true,"referencesProvider":true,"renameProvider":{"prepareProvider":true},"selectionRangeProvider":true,"signatureHelpProvider":{"triggerCharacters":["(",",",":"]},"textDocumentSync":2,"typeDefinitionProvider":true,"workspace":{"workspaceFolders":{"changeNotifications":true,"supported":true}},"workspaceSymbolProvider":true}}
2022-08-31T20:34:20.269 helix_lsp::transport [INFO] -> {"jsonrpc":"2.0","method":"initialized","params":{}}
2022-08-31T20:34:20.270 helix_lsp::transport [INFO] -> {"jsonrpc":"2.0","method":"workspace/didChangeConfiguration","params":{"settings":{}}}
2022-08-31T20:34:20.270 helix_lsp::transport [INFO] -> {"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"languageId":"php","text":"<?php\n\nnamespace TestHelix;\n\nclass Foo {}\n","uri":"file:///home/johannes/dev/test-hx-php/src/Foo.php","version":0}}}
2022-08-31T20:34:20.271 helix_lsp::transport [INFO] <- {"jsonrpc":"2.0","id":0,"method":"workspace/configuration","params":{"items":[{"section":"intelephense"},{"section":"intelephense","scopeUri":"file:///home/johannes/dev/test-hx-php"}]}}
2022-08-31T20:34:20.271 helix_lsp::transport [INFO] -> {"jsonrpc":"2.0","result":[null,null],"id":0}
2022-08-31T20:34:20.291 helix_lsp::transport [INFO] <- {"jsonrpc":"2.0","method":"window/logMessage","params":{"type":3,"message":"Searching file:///home/johannes/.fnm/node-versions/v16.15.0/installation/lib/node_modules/intelephense/lib/stub for files to index."}}
2022-08-31T20:34:20.291 helix_term::application [INFO] window/logMessage: LogMessageParams { typ: Info, message: "Searching file:///home/johannes/.fnm/node-versions/v16.15.0/installation/lib/node_modules/intelephense/lib/stub for files to index." }
2022-08-31T20:34:20.304 helix_lsp::transport [INFO] <- {"jsonrpc":"2.0","method":"window/logMessage","params":{"type":3,"message":"Searching file:///home/johannes/dev/test-hx-php for files to index."}}
2022-08-31T20:34:20.304 helix_term::application [INFO] window/logMessage: LogMessageParams { typ: Info, message: "Searching file:///home/johannes/dev/test-hx-php for files to index." }
2022-08-31T20:34:20.783 helix_lsp::transport [INFO] <- {"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"uri":"file:///home/johannes/dev/test-hx-php/src/Foo.php","diagnostics":[]}}
2022-08-31T20:34:22.311 helix_lsp::transport [INFO] <- {"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"uri":"file:///home/johannes/dev/test-hx-php/src/Foo.php","diagnostics":[]}}
2022-08-31T20:34:25.515 helix_lsp::transport [INFO] -> {"jsonrpc":"2.0","method":"workspace/symbol","params":{"query":""},"id":1}
2022-08-31T20:34:25.516 helix_lsp::transport [INFO] <- {"jsonrpc":"2.0","id":1,"result":[]}
2022-08-31T20:34:25.516 helix_lsp::transport [INFO] <- []
2022-08-31T20:34:27.385 helix_term::ui::picker [DEBUG] picker score 1.342µs
2022-08-31T20:34:27.644 helix_term::ui::picker [DEBUG] picker score 3.346µs
2022-08-31T20:34:27.713 helix_term::ui::picker [DEBUG] picker score 1.372µs
2022-08-31T20:34:30.951 helix_term::job [DEBUG] waiting on jobs...
2022-08-31T20:34:30.951 helix_lsp::transport [INFO] -> {"jsonrpc":"2.0","method":"shutdown","params":null,"id":2}
2022-08-31T20:34:31.453 helix_term::application [ERROR] Timed out waiting for language servers to shutdown
2022-08-31T20:34:31.453 mio::poll [TRACE] deregistering event source from poller
2022-08-31T20:34:31.454 mio::poll [TRACE] deregistering event source from poller
2022-08-31T20:34:31.454 mio::poll [TRACE] deregistering event source from poller
2022-08-31T20:34:31.454 mio::poll [TRACE] deregistering event source from poller
2022-08-31T20:34:31.454 mio::poll [TRACE] deregistering event source from poller
2022-08-31T20:34:31.454 mio::poll [TRACE] deregistering event source from poller

Platform

Linux

Terminal Emulator

Windows Terminal (SSH)

Helix Version

helix 22.08

@ejulen ejulen added the C-bug Category: This is a bug label Aug 31, 2022
@the-mikedavis
Copy link
Member

The log lines

2022-08-31T20:34:25.515 helix_lsp::transport [INFO] -> {"jsonrpc":"2.0","method":"workspace/symbol","params":{"query":""},"id":1}
2022-08-31T20:34:25.516 helix_lsp::transport [INFO] <- {"jsonrpc":"2.0","id":1,"result":[]}

say that the intelephense is returning no symbols for the initial (empty) query. There might need to be some additional configuration in languages.toml to enable it or it may just not give symbols for an empty query (there's a PR to re-query as you type #3110). With intelephense being source-unavailable this will probably not be very easy to debug 😅

@ejulen
Copy link
Author

ejulen commented Sep 2, 2022

Yeah, I thought that looked suspicious. Unfortunately, while I'd call myself an avid LSP user, debugging is another story. Wouldn't be surprised if it wasn't returning anything for empty queries. There is some limited documentation here, but I couldn't find anything that sounded relevant for fixing this via some configuration value.

@archseer
Copy link
Member

archseer commented Sep 3, 2022

You could test out #3110

@ejulen
Copy link
Author

ejulen commented Sep 3, 2022

You could test out #3110

For some reason that did not occur to me. I've tried it now and... it works! So it seems like @the-mikedavis surmised correctly, Intelephense does indeed not seem to reply with any symbols given an empty query.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-language-server Area: Language server client C-bug Category: This is a bug
Projects
None yet
4 participants