Open incendial opened 10 months ago
Which IDE are you using?
VS Code
@DanTup Is this an error you recognize?
Based on a quick search, this appears to happen to several of the language servers, not just Dart's. The only "fix" I could find (in https://www.codeproject.com/Tips/5163886/Fixing-VS-Code-Extension-Errors) is to delete the language server's install directory. The implication appears to be that the install directory is sometimes corrupted in a way that VS Code can't recover from.
I'm guessing that the equivalent here would be to delete the DartCode plugin and force it to be downloaded again. I haven't seen the error so I haven't tried the "fix". I don't know how reliable the suggestion is or whether it's safe for you to try it, but that's all the information I have at this point, so I'm passing it along.
Well, the server (sometimes) crashes on a hover with pressed cmd (which is a known issue, AFAIK). The problem is that true
as the output is not very informative (and it's not clear where it comes from).
And I'm not sure that reinstalling the extension is the solution here.
Btw, for the past 2 days it crashed 15 times...
The error message comes from the VS Code LSP client:
This happens when the server terminates (the LSP client is connected to the stdout/stdin streams), so perhaps there's some exception happening here that's causing us to shut the server down.
My first suggestion would be to enable both the server instrumentation log and the client-side log and see whether any error/exception text is being recorded.
If you have any steps to trigger this I can take a look too (it might depend on your exact SDK version and possibly contents of your file(s) if it's something like an exception during parsing).
(I also suspect reinstalling the extension won't change anything here)
Well, the server (sometimes) crashes on a hover with pressed cmd (which is a known issue, AFAIK)
I just noticed this... I don't recall this being a known issue (unless it's something fixed and just not shipped yet).
The problem is that true as the output is not very informative (and it's not clear where it comes from).
Agreed, that's a useless message, though it's not clear to me where it's coming from yet. If you have repro steps I can debug - otherwise the logs noted above might help (it's not clear to me if it's coming from the server or something in the client).
I see you are using a beta version of the Dart SDK, 3.3.0-174.2.beta
, have you tried using the stable version? Having a confirmation that this isn't happening to you on stable, but is happening on beta would be helpful to know.
I don't know if it's related, but this if
https://github.com/dart-lang/sdk/blob/a4e15669eccae7919ed3766c8aafe8bad5a30470/pkg/analyzer/lib/src/dart/analysis/driver.dart#L2368-L2370 is missing a _hasWork.notify();
or some other way to keep the program running.
Once the while loop arrives at https://github.com/dart-lang/sdk/blob/a4e15669eccae7919ed3766c8aafe8bad5a30470/pkg/analyzer/lib/src/dart/analysis/driver.dart#L2322 after the continue
the program will silently exit with an exit code 0 because it tries to await the future of a completer that hasn't completed. It can be reproduced with this code:
import 'dart:async';
void main() async {
print('creating completer');
final completer = Completer<void>();
print('awaiting completer.future');
await completer.future;
print('done');
}
It'll print
creating completer
awaiting completer.future
Process finished with exit code 0
And/Or maybe awaiting completer.future
shouldn't silently exit the program.
@denniskaselow the reason your example script terminates is that there is nothing keeping the VM alive. That's caught me out too - I thought if main
returned a Future
the runtime would stay alive until it completes.
I don't think that applies to the server here though - my expectation is for the server to keep running because there is a listener on stdin
. If you add stdin.listen((_) {});
to your example app, it will no longer terminate (but instead just wait forever at await completer.future;
).
Noticed the analysis server silently restarting 9 times within ~5 hours with
true
as the only output message. I'm not sure what that supposed to mean, so let me know if I can provide any additional logs.What makes these restarts visible is the "your project has some issues that dart fix can fix" message 🙂.
Dart version: Dart SDK version: 3.3.0-174.2.beta