vimeo / psalm

A static analysis tool for finding errors in PHP applications
https://psalm.dev
MIT License
5.58k stars 664 forks source link

Error with untitled document on hover #9450

Open MoonE opened 1 year ago

MoonE commented 1 year ago

It's no big deal to save the document, but maybe this could be handled more gracefully?

[INFO - 1:13:58 AM] Psalm Version was detected as 5.7.7 [Error - 1:20:25 AM] Request textDocument/hover failed. Message: InvalidArgumentException: Not a valid file URI: untitled:Untitled-4 in /phpmyadmin/vendor/vimeo/psalm/src/Psalm/Internal/LanguageServer/LanguageServer.php:532 Stack trace:

​0 /phpmyadmin/vendor/vimeo/psalm/src/Psalm/Internal/LanguageServer/Server/TextDocument.php(205): Psalm\Internal\LanguageServer\LanguageServer::uriToPath()

​1 /phpmyadmin/vendor/felixfbecker/advanced-json-rpc/lib/Dispatcher.php(168): Psalm\Internal\LanguageServer\Server\TextDocument->hover()

​2 /phpmyadmin/vendor/vimeo/psalm/src/Psalm/Internal/LanguageServer/LanguageServer.php(144): AdvancedJsonRpc\Dispatcher->dispatch()

​3 [internal function]: Psalm\Internal\LanguageServer\LanguageServer->Psalm\Internal\LanguageServer{closure}()

​4 /phpmyadmin/vendor/amphp/amp/lib/Coroutine.php(67): Generator->current()

​5 /phpmyadmin/vendor/amphp/amp/lib/functions.php(96): Amp\Coroutine->__construct()

​6 /phpmyadmin/vendor/amphp/amp/lib/functions.php(61): Amp\call()

​7 /phpmyadmin/vendor/vimeo/psalm/src/Psalm/Internal/LanguageServer/EmitterTrait.php(85): Amp{closure}()

​8 /phpmyadmin/vendor/vimeo/psalm/src/Psalm/Internal/LanguageServer/ProtocolStreamReader.php(114): Psalm\Internal\LanguageServer\ProtocolStreamReader->emit()

​9 /phpmyadmin/vendor/vimeo/psalm/src/Psalm/Internal/LanguageServer/ProtocolStreamReader.php(63): Psalm\Internal\LanguageServer\ProtocolStreamReader->readMessages()

​10 [internal function]: Psalm\Internal\LanguageServer\ProtocolStreamReader->Psalm\Internal\LanguageServer{closure}()

​11 /phpmyadmin/vendor/amphp/amp/lib/Coroutine.php(118): Generator->send()

​12 /phpmyadmin/vendor/amphp/amp/lib/Internal/Placeholder.php(149): Amp\Coroutine->Amp{closure}()

​13 /phpmyadmin/vendor/amphp/amp/lib/Deferred.php(53): Amp\Promise@anonymous->resolve()

​14 /phpmyadmin/vendor/amphp/byte-stream/lib/ResourceInputStream.php(101): Amp\Deferred->resolve()

​15 /phpmyadmin/vendor/amphp/amp/lib/Loop/NativeDriver.php(327): Amp\ByteStream\ResourceInputStream::Amp\ByteStream{closure}()

​16 /phpmyadmin/vendor/amphp/amp/lib/Loop/NativeDriver.php(127): Amp\Loop\NativeDriver->selectStreams()

​17 /phpmyadmin/vendor/amphp/amp/lib/Loop/Driver.php(138): Amp\Loop\NativeDriver->dispatch()

​18 /phpmyadmin/vendor/amphp/amp/lib/Loop/Driver.php(72): Amp\Loop\Driver->tick()

​19 /phpmyadmin/vendor/amphp/amp/lib/Loop.php(95): Amp\Loop\Driver->run()

​20 /phpmyadmin/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/ProjectAnalyzer.php(516): Amp\Loop::run()

​21 /phpmyadmin/vendor/vimeo/psalm/src/Psalm/Internal/Cli/LanguageServer.php(331): Psalm\Internal\Analyzer\ProjectAnalyzer->server()

​22 /phpmyadmin/vendor/vimeo/psalm/psalm-language-server(9): Psalm\Internal\Cli\LanguageServer::run()

​23 {main}

Code: -32603

psalm-github-bot[bot] commented 1 year ago

Hey @MoonE, can you reproduce the issue on https://psalm.dev ?

orklah commented 1 year ago

Hey @tm1000! Seems like something that could be improved in LanguageServer

tm1000 commented 1 year ago

@MoonE whats the context of this situation. Seems like a file that doesn't exist on the disk?

MoonE commented 1 year ago

@tm1000 Yeah, I use VSCode with the psalm-vscode-plugin. Made a new file with a php class. This error message is printed when hovering over any code with the mouse pointer.

tm1000 commented 1 year ago

@orklah @weirdan assign to me please

orklah commented 1 year ago

Done!