sublimelsp / LSP-intelephense

PHP support for Sublime's LSP plugin provided through intelephense.
MIT License
96 stars 3 forks source link

Show info about uncaught exceptions #95

Closed fadrian06 closed 10 months ago

fadrian06 commented 10 months ago

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

jfcherng commented 10 months ago

It just works?

image

jfcherng commented 10 months ago

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

jfcherng commented 10 months ago

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.

jfcherng commented 10 months ago

https://github.com/bmewburn/vscode-intelephense/issues/1859

fadrian06 commented 10 months ago

It just works?

image

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

fadrian06 commented 10 months ago

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 https://github.com/bmewburn/vscode-intelephense/issues/1859