Skip to content

Commit

Permalink
Ensure ts object passed to plugins contains deprecatedCompat declarat…
Browse files Browse the repository at this point in the history
…ions

We pass the entire "ts" object into plugins. However, we need to make
sure that that object contains the debug compat helpers.

In the old codebase, the deprecated compat code would tack things onto
the actual ts object, after the server code was executed, and later that
same object would be given to plugins.

But in modules, each TS project only sees the view of the "ts" namespace
that their references implied, not the ts object as some sort of
singleton. To ensure that plugins get the debug compat code, we have to
bring that into each project's view of the ts namespace, and not add it
on later in the executable projects.
  • Loading branch information
jakebailey committed Oct 25, 2022
1 parent 3d30fcf commit 1f616d1
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 7 deletions.
2 changes: 2 additions & 0 deletions src/server/_namespaces/ts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,7 @@
export * from "../../compiler/_namespaces/ts";
export * from "../../jsTyping/_namespaces/ts";
export * from "../../services/_namespaces/ts";
// Pull this in here so that plugins loaded by the server see compat wrappers.
export * from "../../deprecatedCompat/_namespaces/ts";
import * as server from "./ts.server";
export { server };
3 changes: 2 additions & 1 deletion src/server/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"references": [
{ "path": "../compiler" },
{ "path": "../jsTyping" },
{ "path": "../services" }
{ "path": "../services" },
{ "path": "../deprecatedCompat" }
],
"include": ["**/*"]
}
1 change: 0 additions & 1 deletion src/tsserver/_namespaces/ts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,5 @@ export * from "../../services/_namespaces/ts";
export * from "../../jsTyping/_namespaces/ts";
export * from "../../server/_namespaces/ts";
export * from "../../webServer/_namespaces/ts";
export * from "../../deprecatedCompat/_namespaces/ts";
import * as server from "./ts.server";
export { server };
3 changes: 1 addition & 2 deletions src/tsserver/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
{ "path": "../services" },
{ "path": "../jsTyping" },
{ "path": "../server" },
{ "path": "../webServer" },
{ "path": "../deprecatedCompat" }
{ "path": "../webServer" }
],
"include": ["**/*"]
}
1 change: 0 additions & 1 deletion src/tsserverlibrary/_namespaces/ts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,5 @@ export * from "../../compiler/_namespaces/ts";
export * from "../../jsTyping/_namespaces/ts";
export * from "../../services/_namespaces/ts";
export * from "../../server/_namespaces/ts";
export * from "../../deprecatedCompat/_namespaces/ts";
import * as server from "./ts.server";
export { server };
3 changes: 1 addition & 2 deletions src/tsserverlibrary/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
{ "path": "../compiler" },
{ "path": "../jsTyping" },
{ "path": "../services" },
{ "path": "../server" },
{ "path": "../deprecatedCompat" }
{ "path": "../server" }
],
"include": ["**/*"]
}

0 comments on commit 1f616d1

Please sign in to comment.