fix: Save all documents freezing progress

This commit is contained in:
FalsePattern 2024-11-28 13:20:56 +01:00
parent 93d8deeec8
commit a32068ce23
Signed by: falsepattern
GPG key ID: E930CDEC50C50E23
2 changed files with 9 additions and 8 deletions

View file

@ -17,6 +17,11 @@ Changelog structure reference:
## [Unreleased]
### Fixed
- Project
- "Save all documents" hanging when trying to run a zig file
## [20.0.2]
### Added

View file

@ -48,6 +48,7 @@ import org.jetbrains.concurrency.Promise
abstract class ZigProgramRunner<ProfileState : ZigProfileState<*>>(protected val executorId: String) : AsyncProgramRunner<RunnerSettings>() {
@OptIn(ExperimentalCoroutinesApi::class)
override fun execute(environment: ExecutionEnvironment, state: RunProfileState): Promise<RunContentDescriptor?> {
FileDocumentManager.getInstance().saveAllDocuments()
return environment.project.zigCoroutineScope.async {
withModalProgress(ModalTaskOwner.project(environment.project), "Starting zig program...", TaskCancellation.cancellable()) {
executeAsync(environment, state)
@ -71,13 +72,8 @@ abstract class ZigProgramRunner<ProfileState: ZigProfileState<*>>(protected val
}
return reportProgress { reporter ->
reporter.indeterminateStep("Saving all documents") {
withEDTContext {
FileDocumentManager.getInstance().saveAllDocuments()
}
}
return@reportProgress reporter.indeterminateStep {
return@indeterminateStep execute(state, toolchain, environment)
reporter.indeterminateStep {
execute(state, toolchain, environment)
}
}