如何在 github 原子编辑器插件中添加复选框切换
How to add checkbox toggle in github atom editor plugin
我想向现有插件添加功能,并想在插件的菜单中添加其他选项。
我希望该选项看起来像下面的 "untitled" 条目:
选项将像我们在 eclipse "Build Automatically" 中的现有功能一样运行。
我希望只要用户在 Atom 插件菜单中看到这个选项,他就知道它是否启用。
我们在 ATOM view.So 中是否有一些现有的东西,我可以寻找参考。
您可以通过多种方式将其添加到程序包设置菜单中而不是 Atom 菜单中。
首先,有一种方法是直接把它放在你的代码中。在 main.js
中为我的包 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'
}
}
}
你也可以把它放在package.json
里。考虑以下 Atom-Linter 组织内的其他人放入我维护的包中的内容 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
,因此我建议您遵循该类型的格式。
buildAutomatically: {
title: 'Build Automatically',
type: 'boolean',
default: false,
}
"buildAutomatically: {
"title": "Build Automatically",
"type": "boolean",
"default": false
}
我想向现有插件添加功能,并想在插件的菜单中添加其他选项。
我希望该选项看起来像下面的 "untitled" 条目:
选项将像我们在 eclipse "Build Automatically" 中的现有功能一样运行。
我希望只要用户在 Atom 插件菜单中看到这个选项,他就知道它是否启用。
我们在 ATOM view.So 中是否有一些现有的东西,我可以寻找参考。
您可以通过多种方式将其添加到程序包设置菜单中而不是 Atom 菜单中。
首先,有一种方法是直接把它放在你的代码中。在 main.js
中为我的包 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'
}
}
}
你也可以把它放在package.json
里。考虑以下 Atom-Linter 组织内的其他人放入我维护的包中的内容 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
,因此我建议您遵循该类型的格式。
buildAutomatically: {
title: 'Build Automatically',
type: 'boolean',
default: false,
}
"buildAutomatically: {
"title": "Build Automatically",
"type": "boolean",
"default": false
}