Sublimetext3 升华文本3,侧边栏项目不显示
我正在为Sublime Text 3制作一个简单的插件,它应该在一个或多个文件夹中创建一个Sublimetext3 升华文本3,侧边栏项目不显示,sublimetext3,sublimetext,sublime-text-plugin,Sublimetext3,Sublimetext,Sublime Text Plugin,我正在为Sublime Text 3制作一个简单的插件,它应该在一个或多个文件夹中创建一个.gitignore文件。到目前为止,该包包含两个命令,可以使用window.command(…)从ST3控制台调用它们 我希望能够右键单击侧边栏中的文件夹,然后从弹出的菜单中选择一个命令。我添加了侧栏。升华菜单,其中包含调用方法的项,但右键单击侧栏中的文件夹或文件时,菜单项不显示 从下面的信息中,有人知道这里缺少什么吗 插件树: ~/Library/Application Support/Sublime
.gitignore
文件。到目前为止,该包包含两个命令,可以使用window.command(…)
从ST3控制台调用它们
我希望能够右键单击侧边栏中的文件夹,然后从弹出的菜单中选择一个命令。我添加了侧栏。升华菜单
,其中包含调用方法的项,但右键单击侧栏中的文件夹或文件时,菜单项不显示
从下面的信息中,有人知道这里缺少什么吗
插件树:
~/Library/Application Support/Sublime Text 3/Packages/GitIgnoreFolderContents
├── Side\ Bar.sublime-menu
├── git_ignore_folder_contents.py
├── git_ignore_folder_contents.sublime-settings
├── libs
│ ├── settings.py
│ └── util.py
└── notes_use_later.txt
侧栏。升华菜单:
[
{
"caption": "-"
},
{
"caption": "Git Ignore Folder Contents",
"id": "git_ignore_folder_contents",
"children:": [
{
"caption": "Create .gitignore",
"command": "create_folder_gitignore",
"args": {
"paths": []
}
},
{
"caption": "Create .gitkeep",
"command": "create_folder_gitkeep",
"args": {
"paths": []
}
}
]
}
]
git_ignore_folder_contents.py:
import sublime
import sublime_plugin
from .libs.util import print_debug
class BaseCreateFolderIgnoreFileCommand(sublime_plugin.WindowCommand):
def run(self, paths=[]):
print_debug('[GIFC] running {}'.format(self.__class__.__name__))
print_debug('[GIFC] paths:', paths)
if not paths:
print_debug('[GIFC] paths is empty, halting function')
return
for path in paths:
# ToDo: create files here
pass
def is_enabled(self, paths=[]):
# ToDo: disable when one of paths is not a folder
return True
class CreateFolderGitignoreCommand(BaseCreateFolderIgnoreFileCommand):
filename = '.gitignore'
contents = '*\n!.gitignore'
class CreateFolderGitkeepCommand(BaseCreateFolderIgnoreFileCommand):
filename = '.gitkeep'
contents = ''
环境:
- 从macOS的开发频道构建3160
- 安装了软件包“SideBarEnhancements”(在其他软件包中,有些软件包带有工作侧栏菜单项)
崇高菜单
文件被微妙地破坏了;子项
键中有一个游离的:
字符
特别是,当我用您在这里提供的文件创建一个包时(与Sublime的版本相同,但在Windows而不是MacOS上),顶级菜单项出现在菜单中,但它没有任何子菜单项。选择Git Ignore Folder Contents
命令会在控制台中生成错误。我猜这是因为它没有直接执行的命令,因为它不应该是可选的
修正这一行,使其键内没有冒号,应该可以解决您的问题;或者至少对我来说是这样的:
“子项:”:[
Hah,我知道它必须很简单。非常感谢!现在请原谅,我要去facepalm;-)哈哈,如果它有帮助的话,在我意识到它为什么没有做我认为应该做的事情之前,我不得不重新创建你的包,并困惑了一会儿。:D