Skip to content

Commit

Permalink
插件支持同步函数
Browse files Browse the repository at this point in the history
  • Loading branch information
sumneko committed Jul 15, 2024
1 parent 1b5c301 commit 95e48ba
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/plugin/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`);
}
});

Expand Down
4 changes: 2 additions & 2 deletions src/plugin/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`;
});
}
}
Expand Down

0 comments on commit 95e48ba

Please sign in to comment.