From c6ba12942c584d3e4cefea0f9c84ed3092dde81c Mon Sep 17 00:00:00 2001 From: Asher Date: Sun, 11 Oct 2020 01:14:43 -0500 Subject: [PATCH] Filter blank plugin directories (#2187) I neglected to realize that "".split(":") is an array with "" in it. --- src/node/plugin.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/node/plugin.ts b/src/node/plugin.ts index e17a9909..7469f317 100644 --- a/src/node/plugin.ts +++ b/src/node/plugin.ts @@ -75,12 +75,18 @@ export const loadPlugins = async (httpServer: HttpServer, args: Args): Promise _loadPlugins(path.resolve(dir), httpServer, args)), + ...pluginPath + .split(":") + .filter((p) => !!p) + .map((dir) => _loadPlugins(path.resolve(dir), httpServer, args)), // Individual plugins so you don't have to symlink or move them into a // directory specifically for plugins. This lets you load plugins that are // on the same level as other directories that are not plugins (if you tried // to use CS_PLUGIN_PATH code-server would try to load those other // directories as plugins). Intended for development. - ...plugin.split(":").map((dir) => loadPlugin(path.resolve(dir), httpServer, args)), + ...plugin + .split(":") + .filter((p) => !!p) + .map((dir) => loadPlugin(path.resolve(dir), httpServer, args)), ]) }