diff --git a/src/plugin/index.ts b/src/plugin/index.ts index 56a4ac6..47c7349 100644 --- a/src/plugin/index.ts +++ b/src/plugin/index.ts @@ -153,7 +153,7 @@ export async function init() { try { await pluginManager.run(uri, funcName ?? 'main'); } catch (error) { - vscode.window.showErrorMessage(`运行物编脚本出错:${error}`); + vscode.window.showErrorMessage(`运行插件脚本出错:${error}`); } }); diff --git a/src/plugin/plugin.ts b/src/plugin/plugin.ts index cd83404..b401c59 100644 --- a/src/plugin/plugin.ts +++ b/src/plugin/plugin.ts @@ -32,10 +32,10 @@ export class Plugin { lines[i] = line.replace(/export\s+(async\s+)?function\s+([\w_\u10000-\uFFFFFFFF]+)/, (_, async, name) => { this.exports[name] = { name, - async: async !== '', + async: async !== undefined, line: i, }; - return `${async}function ${name}`; + return `${async ?? ''}function ${name}`; }); } }