来自另一个包的 Atom 包命令
Atom package command from another package
假设在我的自定义 Atom 包中,我将一个 JSON 字符串插入到一个文件中。
之后,我想 运行 atom-beautify
包中的 beautify-language-json
自动。
如何从我的包中启动这个命令?
如 API 文档中所述,您可以为此使用 dispatch()
方法。
示例:
// Example - you *might* want to use a different target
const target = atom.views.getView(atom.workspace);
const commandName = 'atom-beautify:beautify-language-json';
atom.commands.dispatch(target, commandName);
假设在我的自定义 Atom 包中,我将一个 JSON 字符串插入到一个文件中。
之后,我想 运行 atom-beautify
包中的 beautify-language-json
自动。
如何从我的包中启动这个命令?
如 API 文档中所述,您可以为此使用 dispatch()
方法。
示例:
// Example - you *might* want to use a different target
const target = atom.views.getView(atom.workspace);
const commandName = 'atom-beautify:beautify-language-json';
atom.commands.dispatch(target, commandName);