Skip to content

Commit a9a30d7

Browse files
author
Andy
authored
Fix parsing of globalPlugins and pluginProbeLocations: Don't include empty string (microsoft#17143)
1 parent 382785a commit a9a30d7

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

src/server/server.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -760,8 +760,16 @@ namespace ts.server {
760760
const typingSafeListLocation = findArgument(Arguments.TypingSafeListLocation);
761761
const npmLocation = findArgument(Arguments.NpmLocation);
762762

763-
const globalPlugins = (findArgument("--globalPlugins") || "").split(",");
764-
const pluginProbeLocations = (findArgument("--pluginProbeLocations") || "").split(",");
763+
function parseStringArray(argName: string): string[] {
764+
const arg = findArgument(argName);
765+
if (arg === undefined) {
766+
return emptyArray as string[]; // TODO: https://github.com/Microsoft/TypeScript/issues/16312
767+
}
768+
return arg.split(",").filter(name => name !== "");
769+
}
770+
771+
const globalPlugins = parseStringArray("--globalPlugins");
772+
const pluginProbeLocations = parseStringArray("--pluginProbeLocations");
765773
const allowLocalPluginLoads = hasArgument("--allowLocalPluginLoads");
766774

767775
const useSingleInferredProject = hasArgument("--useSingleInferredProject");

0 commit comments

Comments
 (0)