Skip to content

Harden showButton, align engine with ddb50, update dependencies - #1

Merged
rongxin-liu merged 2 commits into
mainfrom
help50-fixes
Sep 21, 2026
Merged

rongxin-liu merged 2 commits into
mainfrom
help50-fixes

Conversation

@rongxin-liu

Copy link
Copy Markdown
Contributor

Prep for wiring the terminal into help50 via command50 help50.showButton <ask|say> "<message>" (see cs50/cli#210 and the codespace help50-canary branch).

Main changes

showButton no longer throws on bad input. It read args.length before checking args was an array, so running it from the Command Palette (or with no args) crashed. It now validates the shape and logs the offending value, and an empty message is treated as hideButton: a command that fails silently should not produce a button that sends an empty question to cs50.ai.

First click works before ddb50 has activated. help50.ask/help50.say read ddb50!.exports directly, which is undefined until ddb50 activates. They now await ddb50.activate() (a no-op once active) and show a clear error if ddb50 is not installed.

Engine aligned with ddb50. engines.vscode ^1.107.0 -> ^1.132.0, @types/vscode pinned to 1.134.0 (the lowest published version satisfying that range, and what ddb50 resolves to).

Smaller changes

  • Lightbulb icon on the terminal button so it is visible among the other terminal-panel actions
  • Dependencies updated: ESLint 10 with typescript-eslint (replacing the two @typescript-eslint/* packages), TypeScript 6, @vscode/test-electron 3, @types/node 26. TypeScript 7 is held back because typescript-eslint does not support it yet (same as ddb50)
  • tsconfig.json lists types explicitly; TypeScript 6 no longer includes every @types/* package by default

Testing

npm run compile and npm run lint pass; vsce package produces help50-0.0.1.vsix, the filename the codespace Dockerfile expects.

- Guard against non-array or malformed args (e.g., from the Command Palette)
  instead of throwing on args.length
- Treat an empty message as hideButton, so a silent failure doesn't show a
  button that sends an empty question to cs50.ai
- Use await ddb50.activate() rather than ddb50!.exports, so the first click
  works before ddb50 has activated; report a missing ddb50 clearly
- Log the offending value in error paths instead of a stale variable
- engines.vscode ^1.107.0 -> ^1.132.0 (same as ddb50.vsix); @types/vscode 1.134.0
- ESLint 10 with typescript-eslint (replaces @typescript-eslint/parser and
  eslint-plugin), TypeScript 6 (typescript-eslint does not yet support 7),
  @vscode/test-electron 3, @types/node 26
- tsconfig: list types explicitly, as TypeScript 6 no longer includes all @types
- Add a lightbulb icon to the help50 terminal button and a description
@rongxin-liu rongxin-liu self-assigned this Sep 21, 2026
@rongxin-liu
rongxin-liu merged commit 11ee560 into main Sep 21, 2026
rongxin-liu added a commit that referenced this pull request Sep 21, 2026
#1 set the range to ^1.132.0 in package.json after npm had recorded
^1.134.0 in the lockfile's root entry; the resolved version (1.134.0) is
unchanged.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant