Repository navigation
Investigate large number of configurationChange extension restarts #5837
Description
Stats show that a huge portion of extension restarts are "configurationChange". Which indicates that one of the following settings changed:
Dart-Code/src/extension/extension.ts
Lines 837 to 863 in 35dfe98
| function getSettingsThatRequireRestart() { | |
| // The return value here is used to detect when any config option changes that requires a project reload. | |
| // It doesn't matter how these are combined; it just gets called on every config change and compared. | |
| // Usually these are options that affect the analyzer and need a reload, but config options used at | |
| // activation time will also need to be included. | |
| return "CONF-" | |
| + config.sdkPath | |
| + config.sdkPaths?.length | |
| + config.analyzerPath | |
| + config.analyzerDiagnosticsPort | |
| + config.analyzerVmServicePort | |
| + config.analyzerInstrumentationLogFile | |
| + config.extensionLogFile | |
| + config.analyzerAdditionalArgs?.join(",") | |
| + config.analyzerVmAdditionalArgs?.join(",") | |
| + config.flutterSdkPath | |
| + config.flutterSdkPaths?.length | |
| + config.flutterSelectDeviceWhenConnected | |
| + config.closingLabels | |
| + config.analyzeAngularTemplates | |
| + config.analysisServerFolding | |
| + config.showMainCodeLens | |
| + config.showTestCodeLens | |
| + config.updateImportsOnRename | |
| + config.flutterOutline | |
| + config.flutterAdbConnectOnChromeOs; | |
| } |
Some of the logs I've seen recently made me wonder whether this was firing during startup (and this could perhaps explain some very short analyzer sessions), but I can't come up with a reason why this would fire automatically (maybe settings sync?).
It could be worth trying to trim this list right down (for example things like CodeLens could just be handled in the provider with onDidChangeCodeLensesEmitter), and then what's left could be appended to the reason string so we can see if there is a pattern to what's happening most common.
It's very possible that the use is legit (for example switching SDKs frequently, as I do), but since it could explain some of the short analyzer sessions, it's worth some investigation.
Activity
FMorschel commentedon Dec 10, 2025
If I'm understanding the issue correctly: something to have in mind would be auto-save on delay. If people are changing their configs inside a workspace configuration file that may be triggering this multiple times(?).
DanTup commentedon Dec 10, 2025
True, we but only fire if the specific values above have changed - so even if someone was typing a new SDK path very slowly and it was auto-saving constantly, it should still be a fairly low number (it takes time for us to restart before we'd start monitoring again, and probably users aren't manually typing these settings very frequently).
We could try adding a debounce, but since auto-save can be after a delay, I'm not sure it'd help much without the timeout being quite high.
DanTup commentedon Dec 15, 2025
From the limited stats I have (opted-in pre-release users from over the weekend), the configuration changing is always
flutterSdkPathandsdkPath. This made me wonder if there are other extensions that are providing some SDK-selection functionality.. I asked ChatGPT and Gemini to search and between them they found that both FVM and MSIE may be writing this setting:I don't know how many people use these or at which points they might write these settings. But if we find a managed version of
flutteronPATHand then startflutter daemon, and that triggers it to write, then that could explain at least some of these.I'll try these out and see if I can trigger any behaviour like this.
FMorschel commentedon Dec 15, 2025
Well, I'm not exactly sure how
fvmormsiedo this, butpuroalso does it. But it only changes when you actively writepuro use myEnvon your terminal.DanTup commentedon Dec 15, 2025
If it requires a command, it's probably not the cause of the ones that happen < 1s after activation. I found that mise doesn't seem to be available for Windows, and half of the stats are Windows, so probably it's not that. I'm going to try out fvm and see whether that does this automatically.
DanTup commentedon Dec 15, 2025
I did some testing of fvm, and it seems to also only write this file when you run
fvm use(at least, that's all I could trigger, and reviewing the source seems to only call this from the "use" path). So maybe it's not that either.FMorschel commentedon Dec 15, 2025
Maybe you could add a temporary toast to pre-release and trigger it for users when that happens? Like "Your SDK just changed" and ask for their help in what tools they use or something?
DanTup commentedon Dec 15, 2025
Yeah, I was thinking about something like that (if pre-release, it happens after < 1s, and you didn't interact with the built-in SDK manager). I'll wait for a little more data first though in case any patterns show up (the sample so far is only around 15 users so my assumption that it's only the sdk path might not hold true).
Add a prompt to file an issue if SDK path changes within 1s of starti…
Add a prompt to file an issue if SDK path changes within 1s of starti…
Increase window for showing the warning about SDK paths changing duri…