Open dearieme opened 8 months ago
Hi @dearieme, thanks for filing the issue. I'm able to reproduce the problem:
In this case, the Inquistor.pm code is already intercepting the warning itself and re-issuing the warning with a prefix of =PerlWarning=
as shown in your inquisitor output. This is to allow us to detect the difference between a warning and an error. Code here: https://github.com/bscan/PerlNavigator/blob/8353d5370c91bf457798276749633b9976c6108f/server/src/perl/Inquisitor.pm#L14
I suspect the solution here would be to change this function to format the warning onto a single line. Perhaps replacing newlines with \n
or similar replacement character, and then restoring the newlines before posting the warnings to vscode: https://github.com/bscan/PerlNavigator/blob/8353d5370c91bf457798276749633b9976c6108f/server/src/diagnostics.ts#L108
A pull request would be welcome here, or I will eventually get around to it. Thanks!
Hi @bscan thanks for looking so quickly! That seems like a neat solution - I'll have a go and send a PR.
I get spurious syntax errors when working with a particular codebase and I think the culprit is Moose using Carp::cluck to emit warnings at compile time.
As far as I can tell, the problem is that the clucked line get's correctly flagged as a warning but the following stacktrace lines are not, so you end up with a syntax error reported for each line of stacktrace, and with Moose stacktraces are deep! I've had a look through the Inquisitor code but I can't see an obvious way to fix it. All the stacktrace lines are indented, but it might be a bit brittle to rely on that.
Yes, I should just not ignore the warnings and fix them, and I will eventually, but it's huge untested codebase and fixing all of them would require extensive re-factoring. Specifically I'm hitting a warning about accessors having the same name as existing functions in the namespace.
Here's a minimal test case to demonstrate...