我想为现有插件添加功能,并希望在插件的菜单中添加其他选项。
我希望该选项看起来像“无标题”条目:
选项的行为类似于我们在eclipse“自动构建”切换中的现有功能。
我希望只要用户在Atom插件菜单中看到此选项,他就会知道它是否已启用。
我们在ATOM视图中是否存在某些内容。所以,我可以寻找参考。
答案 0 :(得分:1)
您可以通过多种方式在包设置菜单而不是Atom菜单中添加它。
首先,有将其直接放入代码的方法。请在我的包main.js
的{{1}}中考虑以下内容:
linter-ansible-linting
您也可以将其放在config: {
ansibleLintExecutablePath: {
title: 'Ansible-Lint Executable Path',
type: 'string',
description: 'Path to Ansible-Lint executable (e.g. /usr/bin/ansible-lint) if not in shell env path.',
default: 'ansible-lint',
},
useRulesDirs: {
title: 'Use non-default rules directories with Ansible-Lint.',
type: 'boolean',
default: false,
},
rulesDirs: {
title: 'Rules Directories',
type: 'array',
description: 'Non-default rules directories to use with Ansible-Lint. (only if use non-default rules directories checked)',
default: ['/usr/local/lib/python2.7/site-packages/ansiblelint/rules', '/usr/local/lib/python2.7/dist-packages/ansiblelint/rules'],
items: {
type: 'string'
}
}
}
中。请考虑以下内容:Atom-Linter组织中的其他人放入我维护的包中package.json
:
linter-puppet-lint
这些将使您的包的“设置”菜单中的配置设置可用。您的具体设置将是"configSchema": {
"executablePath": {
"title": "Executable path",
"type": "string",
"description": "Path to puppet-lint executable",
"default": "puppet-lint"
},
"automaticFix": {
"title": "Attempt to automatically fix warnings and errors",
"type": "boolean",
"default": false
},
}
,因此我建议您遵循该类型的格式。
boolean