fix: run module dependency sync off the write action thread (#149)
- fix: run module dependency sync off the write action thread
DefaultModuleDependenciesService called syncAllModules() inline from its init block and from rootsChanged(). The IDE delivers rootsChanged from inside a write action (PythonSdkUpdater committing an SDK on startup, via DumbServiceImpl.publishDumbModeChangedEvent), and the collection calls PythonPackageManager.forSdk(), which asserts it is not run in a write action:
IllegalStateException: ‘runBlockingCancellable’ is forbidden in the Write Action because it may start a long-running computation. This can cause UI freezes. Consider running this ‘runBlockingCancellable’ under a read action outside your Write Action
Dispatch the collection onto the service’s own scope and take a read action around it, which is what the assertion asks for. Providers read the project model (SDKs, order entries, VFS children), so the read action is required now that the collection no longer runs on the EDT.
Refs https://github.com/Amazon-Q-Developer/amazon-q-jetbrains/issues/74
版权所有:中国计算机学会技术支持:开源发展技术委员会
京ICP备13000930号-9
京公网安备 11010802047560号
Amazon Q for JetBrains
Amazon Q for JetBrains is an AI-powered assistant plugin for JetBrains IDEs that helps you build applications faster on Amazon Web Services.
Amazon Q for JetBrains is open source because we want you to be involved. We appreciate issues, feature requests, pull requests, code reviews or any other contributions.
Feedback
We want your feedback!
Supported IDEs
All JetBrains IDEs 2025.3+
Installation
See Installing Amazon Q for JetBrains in the Amazon Q Developer User Guide.
Installing From Source
Please see CONTRIBUTING for instructions.
Features
Licensing
The plugin is distributed according to the terms outlined in our LICENSE.