From 37426fdfa5f36f4b0a0ffca18e7f1007debe9d1f Mon Sep 17 00:00:00 2001 From: Adam Ward Date: Tue, 16 Sep 2025 13:37:39 -0400 Subject: [PATCH 1/2] Fix sourcekit diagnostics counter --- src/commands/captureDiagnostics.ts | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/commands/captureDiagnostics.ts b/src/commands/captureDiagnostics.ts index 5f31e66c2..a7732e944 100644 --- a/src/commands/captureDiagnostics.ts +++ b/src/commands/captureDiagnostics.ts @@ -332,9 +332,15 @@ async function sourcekitDiagnose(ctx: FolderContext, dir: string) { }, async progress => { progress.report({ message: "Diagnosing SourceKit-LSP..." }); - const writableStream = progressUpdatingWritable(percent => - progress.report({ message: `Diagnosing SourceKit-LSP: ${percent}%` }) - ); + let lastProgress = 0; + const writableStream = progressUpdatingWritable(percentStr => { + const percent = parseInt(percentStr, 10); + progress.report({ + message: `Diagnosing SourceKit-LSP: ${percent}%`, + increment: percent - lastProgress, + }); + lastProgress = percent; + }); await execFileStreamOutput( serverPath, @@ -362,7 +368,7 @@ function progressUpdatingWritable(updateProgress: (str: string) => void): Writab return new Writable({ write(chunk, _encoding, callback) { const str = (chunk as Buffer).toString("utf8").trim(); - const percent = /^([0-9])+%/.exec(str); + const percent = /^([0-9]+)%/.exec(str); if (percent && percent[1]) { updateProgress(percent[1]); } From 3772aa424d67bf22e943814bee2290942f3a7d0b Mon Sep 17 00:00:00 2001 From: Adam Ward Date: Tue, 16 Sep 2025 13:41:38 -0400 Subject: [PATCH 2/2] Update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index db04ddd24..38307fd2e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ - Improve error handling when the swift path is misconfigured ([#1801](https://github.com/swiftlang/vscode-swift/pull/1801)) - Fix an error when performing "Run/Debug Tests Multiple Times" on Linux ([#1824](https://github.com/swiftlang/vscode-swift/pull/1824)) - Fix the `> Swift: Run Swift Script` command not running unless a Swift Package folder is open ([#1832](https://github.com/swiftlang/vscode-swift/pull/1832)) +- Fix the SourceKit-LSP diagnostics reported progress ([#1799](https://github.com/swiftlang/vscode-swift/pull/1799)) ## 2.11.20250806 - 2025-08-06