Skip to content

Commit c668a30

Browse files
authored
Remove LegacyHackTypeChecker and supporting code (#181)
`hh_client` has provided an LSP server since HHVM 3.23. There is thus no need to keep around `LegacyHackTypeChecker` and supporting code. Let's remove it.
1 parent fb26f6b commit c668a30

8 files changed

Lines changed: 11 additions & 685 deletions

File tree

CLAUDE.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,8 @@ To debug the extension in VS Code, use the "Run Extension" launch configuration
2020

2121
The extension activates when a workspace contains a `.hhconfig` file. Entry point is `src/main.ts`.
2222

23-
**Two type-checking modes:**
24-
- `LSPHackTypeChecker` — Primary mode using `hh_client` in LSP mode via `vscode-languageclient`. Requires HHVM API version >= 5.
25-
- `LegacyHackTypeChecker` — Fallback for older HHVM versions. Uses `hh_client` CLI directly through `src/proxy.ts` and registers VS Code providers manually (`src/providers.ts`).
26-
2723
**Key modules:**
24+
- `src/LSPHackTypeChecker.ts` — Typechecker integration using `hh_client` in LSP mode via `vscode-languageclient`.
2825
- `src/Config.ts` — Reads all `hack.*` VS Code settings at extension startup (not dynamically reloaded except for `hack.remote.*` which prompts a window reload)
2926
- `src/proxy.ts` — Wraps `hh_client` CLI invocations (version check, type-at-pos, autocomplete, format, etc.), always passing `--json`
3027
- `src/remote.ts` — Translates commands/args for SSH or Docker remote execution based on `hack.remote.*` config

package.json

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -207,12 +207,7 @@
207207
"default": false,
208208
"description": "Enable calculation of Hack type coverage percentage for every file and display in status bar."
209209
},
210-
"hack.useLanguageServer": {
211-
"type": "boolean",
212-
"default": true,
213-
"description": "Start hh_client in Language Server mode. Only works for HHVM version 3.23 and above."
214-
},
215-
"hack.useHhast": {
210+
"hack.useHhast": {
216211
"type": "boolean",
217212
"default": true,
218213
"description": "Enable linting (needs HHAST library set up and configured in project)",

src/Config.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,6 @@ export const enableCoverageCheck = hackConfig.get<boolean>(
1818
"enableCoverageCheck",
1919
true,
2020
);
21-
export const useLanguageServer = hackConfig.get<boolean>(
22-
"useLanguageServer",
23-
true,
24-
);
2521
export const useHhast = hackConfig.get<boolean>("useHhast", true);
2622
export const hhastLintMode: "whole-project" | "open-files" = hackConfig.get(
2723
"hhastLintMode",

src/LegacyHackTypeChecker.ts

Lines changed: 0 additions & 144 deletions
This file was deleted.

src/main.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
import * as vscode from "vscode";
66
import * as config from "./Config";
7-
import { LegacyHackTypeChecker } from "./LegacyHackTypeChecker";
87
import { LSPHackTypeChecker } from "./LSPHackTypeChecker";
98
import { LSPHHASTLint } from "./LSPHHASTLint";
109
import * as hh_client from "./proxy";
@@ -36,14 +35,16 @@ export async function activate(context: vscode.ExtensionContext) {
3635
},
3736
);
3837

38+
if (!LSPHackTypeChecker.IS_SUPPORTED(version)) {
39+
vscode.window.showErrorMessage(
40+
"The installed version of hh_client is too old and does not support LSP. Please upgrade HHVM to at least version 3.23.",
41+
);
42+
return;
43+
}
44+
3945
const services: Promise<void>[] = [];
4046
services.push(LSPHHASTLint.START_IF_CONFIGURED_AND_ENABLED(context));
41-
42-
if (LSPHackTypeChecker.IS_SUPPORTED(version) && config.useLanguageServer) {
43-
services.push(new LSPHackTypeChecker(context, version).run());
44-
} else {
45-
services.push(new LegacyHackTypeChecker(context).run());
46-
}
47+
services.push(new LSPHackTypeChecker(context, version).run());
4748

4849
vscode.debug.registerDebugConfigurationProvider(
4950
"hhvm",

0 commit comments

Comments
 (0)