This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
VS Code extension providing Hack language and HHVM debugger support. Published to the VS Code Marketplace as pranayagarwal.vscode-hack. Repository owned by Slack (slackhq/vscode-hack).
- Install dependencies:
npm install - Compile:
npm run compile(runstsc -p ./) - Watch mode:
npm run watch(runstsc -watch -p ./) - Run tests:
npm test(compiles first viapretest, then runs integration tests using@vscode/test-electronwhich downloads a VS Code instance). In headless environments (e.g. CI, VMs without a display), prefix withxvfb-run:xvfb-run npm test - Grammar snapshot tests:
npm run test:grammar(usesvscode-tmgrammar-snapto verify TextMate tokenization oftest/grammar/*.hackfiles against corresponding.hack.snapsnapshots). To update snapshots after changing the grammar (syntaxes/hack.json), runnpm run test:grammar:update. Grammar tests also run as part ofnpm test. - Package extension:
npm run package(usesvsce package)
To debug the extension in VS Code, use the "Run Extension" launch configuration which opens a new Extension Host window.
The extension activates when a workspace contains a .hhconfig file. Entry point is src/main.ts.
Key modules:
src/LSPHackTypeChecker.ts— Typechecker integration usinghh_clientin LSP mode viavscode-languageclient.src/Config.ts— Reads allhack.*VS Code settings at extension startup (not dynamically reloaded except forhack.remote.*which prompts a window reload)src/proxy.ts— Wrapshh_clientCLI invocations (version check, type-at-pos, autocomplete, format, etc.), always passing--jsonsrc/remote.ts— Translates commands/args for SSH or Docker remote execution based onhack.remote.*configsrc/LSPHHASTLint.ts— Separate LSP client for HHAST lintingsrc/debugger.ts— Standalone debug adapter (thin TCP-to-stdin/stdout bridge since HHVM speaks the debug protocol over TCP). Runs as a separate Node process (out/debugger)src/coveragechecker.ts— Hack type coverage percentage display using LSPtypeCoveragecapability
Type definitions are in src/types/hack.d.ts (Hack tool response types) and src/types/lsp.d.ts (custom LSP extensions).
- Target: ES2020, Module: NodeNext
- Strict mode enabled
- Uses project references: root
tsconfig.jsonhas noincludeof its own and referencessrc/tsconfig.jsonandtest/tsconfig.jsonas composite sub-projects - Source in
src/, tests intest/, compiled output inout/src/andout/test/respectively