Browse Source

Minor fixes

Saoud Rizwan 1 year ago
parent
commit
a477eadd77
3 changed files with 8 additions and 9 deletions
  1. 3 3
      src/ClaudeDev.ts
  2. 4 5
      src/utils/UrlScraper.ts
  3. 1 1
      src/utils/context-mentions.ts

+ 3 - 3
src/ClaudeDev.ts

@@ -776,7 +776,7 @@ export class ClaudeDev {
 
 			// Keep track of newly created directories
 			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
 			if (!fileExists) {
 				await fs.writeFile(absolutePath, "")
@@ -827,11 +827,11 @@ export class ClaudeDev {
 				.filter((tab) => tab.input instanceof vscode.TabInputText && tab.input.uri.fsPath === absolutePath)
 			for (const tab of tabs) {
 				await vscode.window.tabGroups.close(tab)
-				console.log(`Closed tab for ${absolutePath}`)
+				// console.log(`Closed tab for ${absolutePath}`)
 				documentWasOpen = true
 			}
 
-			console.log(`Document was open: ${documentWasOpen}`)
+			// console.log(`Document was open: ${documentWasOpen}`)
 
 			// edit needs to happen after we close the original tab
 			const edit = new vscode.WorkspaceEdit()

+ 4 - 5
src/utils/UrlScraper.ts

@@ -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
 	// https://stackoverflow.com/questions/52497252/puppeteer-wait-until-page-is-completely-loaded/61304202#61304202
 	private async waitTillHTMLRendered(page: Page, timeout = 10_000) {
-		const checkDurationMsecs = 500
+		const checkDurationMsecs = 500 // 1000
 		const maxChecks = timeout / checkDurationMsecs
 		let lastHTMLSize = 0
 		let checkCounts = 1
@@ -92,9 +92,8 @@ export class UrlScraper {
 			let html = await page.content()
 			let currentHTMLSize = html.length
 
-			let bodyHTMLSize = await page.evaluate(() => document.body.innerHTML.length)
-
-			console.log("last: ", lastHTMLSize, " <> curr: ", currentHTMLSize, " body html size: ", bodyHTMLSize)
+			// let bodyHTMLSize = await page.evaluate(() => document.body.innerHTML.length)
+			console.log("last: ", lastHTMLSize, " <> curr: ", currentHTMLSize)
 
 			if (lastHTMLSize !== 0 && currentHTMLSize === lastHTMLSize) {
 				countStableSizeIterations++
@@ -103,7 +102,7 @@ export class UrlScraper {
 			}
 
 			if (countStableSizeIterations >= minStableSizeIterations) {
-				console.log("Page rendered fully..")
+				console.log("Page rendered fully...")
 				break
 			}
 

+ 1 - 1
src/utils/context-mentions.ts

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