mirror of
https://github.com/pacnpal/Roo-Code.git
synced 2025-12-20 12:21:13 -05:00
Wait for diagnostics to update before continuing
This commit is contained in:
@@ -1855,9 +1855,11 @@ ${this.customInstructions.trim()}
|
|||||||
await delay(300) // delay after saving file to let terminals/diagnostics catch up
|
await delay(300) // delay after saving file to let terminals/diagnostics catch up
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let terminalWasBusy = false
|
||||||
if (allTerminals.length > 0) {
|
if (allTerminals.length > 0) {
|
||||||
// wait for terminals to cool down
|
// wait for terminals to cool down
|
||||||
// note this does not mean they're actively running just that they recently output something
|
// note this does not mean they're actively running just that they recently output something
|
||||||
|
terminalWasBusy = allTerminals.some((t) => this.terminalManager.isProcessHot(t.id))
|
||||||
await pWaitFor(() => allTerminals.every((t) => !this.terminalManager.isProcessHot(t.id)), {
|
await pWaitFor(() => allTerminals.every((t) => !this.terminalManager.isProcessHot(t.id)), {
|
||||||
interval: 100,
|
interval: 100,
|
||||||
timeout: 15_000,
|
timeout: 15_000,
|
||||||
@@ -1866,7 +1868,7 @@ ${this.customInstructions.trim()}
|
|||||||
|
|
||||||
// we want to get diagnostics AFTER terminal cools down for a few reasons: terminal could be scaffolding a project, dev servers (compilers like webpack) will first re-compile and then send diagnostics, etc
|
// we want to get diagnostics AFTER terminal cools down for a few reasons: terminal could be scaffolding a project, dev servers (compilers like webpack) will first re-compile and then send diagnostics, etc
|
||||||
let diagnosticsDetails = ""
|
let diagnosticsDetails = ""
|
||||||
const diagnostics = await this.diagnosticsMonitor.getCurrentDiagnostics(this.didEditFile) // if claude edited the workspace then wait a bit for updated diagnostics
|
const diagnostics = await this.diagnosticsMonitor.getCurrentDiagnostics(this.didEditFile || terminalWasBusy) // if claude ran a command (ie npm install) or edited the workspace then wait a bit for updated diagnostics
|
||||||
for (const [uri, fileDiagnostics] of diagnostics) {
|
for (const [uri, fileDiagnostics] of diagnostics) {
|
||||||
const problems = fileDiagnostics.filter(
|
const problems = fileDiagnostics.filter(
|
||||||
(d) =>
|
(d) =>
|
||||||
|
|||||||
@@ -47,8 +47,8 @@ class DiagnosticsMonitor {
|
|||||||
|
|
||||||
public async getCurrentDiagnostics(shouldWaitForChanges: boolean): Promise<FileDiagnostics> {
|
public async getCurrentDiagnostics(shouldWaitForChanges: boolean): Promise<FileDiagnostics> {
|
||||||
const currentDiagnostics = this.getDiagnostics() // get all diagnostics for files open in workspace (not just errors/warnings so our did update check is more likely to detect updated diagnostics)
|
const currentDiagnostics = this.getDiagnostics() // get all diagnostics for files open in workspace (not just errors/warnings so our did update check is more likely to detect updated diagnostics)
|
||||||
|
|
||||||
if (!shouldWaitForChanges) {
|
if (!shouldWaitForChanges) {
|
||||||
|
this.lastDiagnostics = currentDiagnostics
|
||||||
return currentDiagnostics
|
return currentDiagnostics
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -68,6 +68,7 @@ class DiagnosticsMonitor {
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
if (hasErrorsOrWarnings) {
|
if (hasErrorsOrWarnings) {
|
||||||
|
console.log("Existing errors or warnings detected, extending timeout", currentDiagnostics)
|
||||||
timeout = 5_000
|
timeout = 5_000
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -84,8 +85,12 @@ class DiagnosticsMonitor {
|
|||||||
}, timeout)
|
}, timeout)
|
||||||
|
|
||||||
const disposable = this.diagnosticsChangeEmitter.event(() => {
|
const disposable = this.diagnosticsChangeEmitter.event(() => {
|
||||||
|
const updatedDiagnostics = this.getDiagnostics() // I thought this would only trigger when diagnostics changed, but that's not the case.
|
||||||
|
if (deepEqual(this.lastDiagnostics, updatedDiagnostics)) {
|
||||||
|
// diagnostics have not changed, ignoring...
|
||||||
|
return
|
||||||
|
}
|
||||||
cleanup()
|
cleanup()
|
||||||
const updatedDiagnostics = this.getDiagnostics()
|
|
||||||
this.lastDiagnostics = updatedDiagnostics
|
this.lastDiagnostics = updatedDiagnostics
|
||||||
resolve(updatedDiagnostics)
|
resolve(updatedDiagnostics)
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user