| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
A few low-risk cleanups found while combing through the extension: - Remove the unused `getTimestampString()` from `src/utils.ts`. It's been dead since 2017 (`1b424000`), when "Add timestamps and log levels to all extension-side log messages" moved timestamping into the `Logger` and deleted its three call sites. It also had a latent bug: no zero-padding, so it rendered times like `[9:5:3]`. - Remove the unused `getWindowsSystemPowerShellPath()` from `src/platform.ts`. It's been dead since #2238 (2019), which introduced `PowerShellExeFinder` and deleted the `System32PowerShellPath` / `SysnativePowerShellPath` / `SysWow64PowerShellPath` constants that called it. The same path is now built inline in `findWinPS()`, with proper bitness handling in `getSystem32Path()`. - Replace `console.log` with `this.logger.writeDebug` in `writePidIfInDevMode` (`src/session.ts`), per our `ILogger` convention. While here, `await` the `fs.delete` it sits next to so the "Deleted PID file" message is actually true — previously it was a floating promise and the log ran before the delete resolved. - Point the PSScriptAnalyzer rule docs link at `learn.microsoft.com` instead of `docs.microsoft.com` (`src/features/CodeActions.ts`); the old URL just 301s there anyway. I left the Command Explorer's dead code alone since #5508 already rewrites that file. Compile, lint, and format all pass; the touched code has no test coverage so risk is low. Drafted by Copilot (Claude Opus 4.8). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
This PR performs small “tech debt” cleanups in the VS Code PowerShell extension by removing long-dead helpers, aligning logging with ILogger, and updating an external documentation link.
Changes:
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/utils.ts | Removes unused timestamp helper. |
| src/session.ts | Replaces console.log with ILogger and adjusts PID-file deletion behavior on process exit. |
| src/platform.ts | Removes unused Windows PowerShell path helper. |
| src/features/CodeActions.ts | Updates PSScriptAnalyzer documentation link base URL. |
Sorry, something went wrong.
The `onExited` listener in `writePidIfInDevMode` is `async`, but VS Code `Event` listeners are fire-and-forget: the returned promise is never awaited. As Copilot noted on #5515, that means a rejection from `fs.delete(...)` would surface as an unhandled promise rejection, and the debug log would be skipped on failure. I kept the `async`/`await` form for readability and wrapped the body in `try`/`catch` so nothing escapes: a fully-caught async body resolves normally, and any failure is now logged via `this.logger.writeError` instead of going unhandled. The original `main` version floated the delete promise and logged success unconditionally, swallowing errors. Drafted by Copilot (Claude Opus 4.8). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Justin Grote (@JustinGrote) got a minute for this one? |
Sorry, something went wrong.
`@vscode/extension-telemetry` exports `TelemetryReporter` as a named class with no default export. We were importing it as a default, which resolves to the module namespace object rather than the class, so using it as the `telemetryReporter` parameter type tripped `tsc --noEmit` with `error TS2709: Cannot use namespace 'TelemetryReporter' as a type`. `npm run compile` uses esbuild, which doesn't type-check, so this slipped through CI. This aligns `session.ts` with the named import already used in `extension.ts`. The symbol is only used as a type here, so there's no runtime change. Drafted by Copilot (Claude Opus 4.8). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The `onExited` listener in `writePidIfInDevMode` is `async`, but VS Code `Event` listeners are fire-and-forget: the returned promise is never awaited. As Copilot noted on #5515, that means a rejection from `fs.delete(...)` would surface as an unhandled promise rejection, and the debug log would be skipped on failure. I kept the `async`/`await` form for readability and wrapped the body in `try`/`catch` so nothing escapes: a fully-caught async body resolves normally, and any failure is now logged via `this.logger.writeError` instead of going unhandled. The original `main` version floated the delete promise and logged success unconditionally, swallowing errors. Drafted by Copilot (Claude Opus 4.8). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
LGTM, good catch on a missing logger copilot!
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
PR Summary
A few low-risk cleanups found while combing through the extension:
I left the Command Explorer's dead code alone since #5508 already rewrites that file. compile, lint, and format all pass; the touched code has no test coverage so risk is low.
Drafted by Copilot (Claude Opus 4.8).
PR Checklist