来自另一个软件包的Atom软件包命令

时间:2020-03-21 05:08:29

标签: javascript atom-editor

比方说,在我的自定义Atom包中,我将JSON字符串插入文件中。 之后,我想自动运行beautify-language-json程序包中的atom-beautify

如何从软件包中启动此命令?

1 个答案:

答案 0 :(得分:0)

如API文档中所述,您可以为此使用dispatch()方法。

示例:

const target = atom.views.getView(atom.workspace);
const commandName = 'atom-beautify:beautify-language-json';

atom.commands.dispatch(target, commandName);
相关问题