Minor fixes

This commit is contained in:
Saoud Rizwan
2024-09-18 20:44:03 -04:00
parent 17c70003e8
commit a477eadd77
3 changed files with 8 additions and 9 deletions

View File

@@ -776,7 +776,7 @@ export class ClaudeDev {
// Keep track of newly created directories // Keep track of newly created directories
const createdDirs: string[] = await this.createDirectoriesForFile(absolutePath) const createdDirs: string[] = await this.createDirectoriesForFile(absolutePath)
console.log(`Created directories: ${createdDirs.join(", ")}`) // console.log(`Created directories: ${createdDirs.join(", ")}`)
// make sure the file exists before we open it // make sure the file exists before we open it
if (!fileExists) { if (!fileExists) {
await fs.writeFile(absolutePath, "") await fs.writeFile(absolutePath, "")
@@ -827,11 +827,11 @@ export class ClaudeDev {
.filter((tab) => tab.input instanceof vscode.TabInputText && tab.input.uri.fsPath === absolutePath) .filter((tab) => tab.input instanceof vscode.TabInputText && tab.input.uri.fsPath === absolutePath)
for (const tab of tabs) { for (const tab of tabs) {
await vscode.window.tabGroups.close(tab) await vscode.window.tabGroups.close(tab)
console.log(`Closed tab for ${absolutePath}`) // console.log(`Closed tab for ${absolutePath}`)
documentWasOpen = true documentWasOpen = true
} }
console.log(`Document was open: ${documentWasOpen}`) // console.log(`Document was open: ${documentWasOpen}`)
// edit needs to happen after we close the original tab // edit needs to happen after we close the original tab
const edit = new vscode.WorkspaceEdit() const edit = new vscode.WorkspaceEdit()

View File

@@ -81,7 +81,7 @@ export class UrlScraper {
// page.goto { waitUntil: "networkidle0" } may not ever resolve, and not waiting could return page content too early before js has loaded // page.goto { waitUntil: "networkidle0" } may not ever resolve, and not waiting could return page content too early before js has loaded
// https://stackoverflow.com/questions/52497252/puppeteer-wait-until-page-is-completely-loaded/61304202#61304202 // https://stackoverflow.com/questions/52497252/puppeteer-wait-until-page-is-completely-loaded/61304202#61304202
private async waitTillHTMLRendered(page: Page, timeout = 10_000) { private async waitTillHTMLRendered(page: Page, timeout = 10_000) {
const checkDurationMsecs = 500 const checkDurationMsecs = 500 // 1000
const maxChecks = timeout / checkDurationMsecs const maxChecks = timeout / checkDurationMsecs
let lastHTMLSize = 0 let lastHTMLSize = 0
let checkCounts = 1 let checkCounts = 1
@@ -92,9 +92,8 @@ export class UrlScraper {
let html = await page.content() let html = await page.content()
let currentHTMLSize = html.length let currentHTMLSize = html.length
let bodyHTMLSize = await page.evaluate(() => document.body.innerHTML.length) // let bodyHTMLSize = await page.evaluate(() => document.body.innerHTML.length)
console.log("last: ", lastHTMLSize, " <> curr: ", currentHTMLSize)
console.log("last: ", lastHTMLSize, " <> curr: ", currentHTMLSize, " body html size: ", bodyHTMLSize)
if (lastHTMLSize !== 0 && currentHTMLSize === lastHTMLSize) { if (lastHTMLSize !== 0 && currentHTMLSize === lastHTMLSize) {
countStableSizeIterations++ countStableSizeIterations++
@@ -103,7 +102,7 @@ export class UrlScraper {
} }
if (countStableSizeIterations >= minStableSizeIterations) { if (countStableSizeIterations >= minStableSizeIterations) {
console.log("Page rendered fully..") console.log("Page rendered fully...")
break break
} }

View File

@@ -151,5 +151,5 @@ async function getWorkspaceDiagnostics(cwd: string): Promise<string> {
return "No problems detected." return "No problems detected."
} }
return diagnosticsDetails return diagnosticsDetails.trim()
} }