Skip to content

Commit af0ad80

Browse files
authored
Handle if plugin doesnt specify name (#42720)
Fixes microsoft/vscode#116219
1 parent c329d68 commit af0ad80

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

Diff for: src/server/project.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1569,8 +1569,8 @@ namespace ts.server {
15691569

15701570
protected enablePlugin(pluginConfigEntry: PluginImport, searchPaths: string[], pluginConfigOverrides: Map<any> | undefined) {
15711571
this.projectService.logger.info(`Enabling plugin ${pluginConfigEntry.name} from candidate paths: ${searchPaths.join(",")}`);
1572-
if (parsePackageName(pluginConfigEntry.name).rest) {
1573-
this.projectService.logger.info(`kipped loading plugin ${pluginConfigEntry.name} because only package name is allowed plugin name`);
1572+
if (!pluginConfigEntry.name || parsePackageName(pluginConfigEntry.name).rest) {
1573+
this.projectService.logger.info(`Skipped loading plugin ${pluginConfigEntry.name || JSON.stringify(pluginConfigEntry)} because only package name is allowed plugin name`);
15741574
return;
15751575
}
15761576

Diff for: src/testRunner/unittests/tsserver/plugins.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,12 @@ namespace ts.projectSystem {
2424
const tsconfig: File = {
2525
path: "/tsconfig.json",
2626
content: JSON.stringify({
27-
compilerOptions: { plugins: [...expectedToLoad, ...notToLoad].map(name => ({ name })) }
27+
compilerOptions: {
28+
plugins: [
29+
...[...expectedToLoad, ...notToLoad].map(name => ({ name })),
30+
{ transform: "some-transform" }
31+
]
32+
}
2833
})
2934
};
3035
const { host, pluginsLoaded } = createHostWithPlugin([aTs, tsconfig, libFile]);

0 commit comments

Comments
 (0)