Skip to content

Commit

Permalink
Handle if plugin doesnt specify name
Browse files Browse the repository at this point in the history
  • Loading branch information
sheetalkamat committed Feb 9, 2021
1 parent 1b19af0 commit 925aba6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/server/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1581,8 +1581,8 @@ namespace ts.server {

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

Expand Down
7 changes: 6 additions & 1 deletion src/testRunner/unittests/tsserver/plugins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,12 @@ namespace ts.projectSystem {
const tsconfig: File = {
path: "/tsconfig.json",
content: JSON.stringify({
compilerOptions: { plugins: [...expectedToLoad, ...notToLoad].map(name => ({ name })) }
compilerOptions: {
plugins: [
...[...expectedToLoad, ...notToLoad].map(name => ({ name })),
{ transform: "some-transform" }
]
}
})
};
const { host, pluginsLoaded } = createHostWithPlugin([aTs, tsconfig, libFile]);
Expand Down

0 comments on commit 925aba6

Please sign in to comment.