sublimelsp / LSP-intelephense

PHP support for Sublime's LSP plugin provided through intelephense.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Show info about uncaught exceptions

fadrian06 opened this issue Β· comments

Someone tell me if there is ever support for Info messages about uncaught exceptions thanks to the @throws tag in the docblock. Similar to the Info message about the @deprecated tagπŸ™ŒπŸ½πŸ™ŒπŸ½πŸ™ŒπŸ½

When I took a java course with lsp-jdtls I noticed that when I don't handle possible exceptions it gives me an info, even a quickFix to group the code in a try/catch.

It would be great to have the same functionality in php

It just works?

image

Nonetheless, if the features you requested are not there, nothing we can do here. LSP-intelephense is more of just a UI layer which shows what the serve responses. You should file a feature request to the server's repository instead. https://github.com/bmewburn/vscode-intelephense

No. There doesn't seem to be info about "uncaught exceptions" from my experiments.

<?php

/**
 * This is foo.
 *
 * @deprecated don't use this function
 *
 * @throws     JsonException
 * @throws     RuntimeException
 */
function foo()
{
    $rand = rand(0, 100);

    if ($rand > 50) {
        throw new RuntimeException('A');
    } else {
        throw new JsonException('B');
    }
}


try {
    foo();
} catch (Throwable $e) {
    echo 'Throwable: ' . $e->getMessage();
}

At the same time, I may not want to caught them here but at a more upper level.

It just works?

image

Yes, it works for the @deprecated tag, but it would be great if it worked for the @throws tag

Nonetheless, if the features you requested are not there, nothing we can do here. LSP-intelephense is more of just a UI layer which shows what the serve responses. You should file a feature request to the server's repository instead. https://github.com/bmewburn/vscode-intelephense

Thanks for the almost immediate response, it is indeed a feature that they are already requesting in the vs repository Diagnostic for Uncaught Exception Β· Issue #1859 Β· bmewburn/vscode-intelephense
bmewburn/vscode-intelephense#1859