简体   繁体   English

Sublime Text 2插件不会出现在Command Platte中

[英]Sublime Text 2 plugin won't show up in Command Platte

I started writing a Plugin for Sublime Text 2 . 我开始为Sublime Text 2编写插件。

I created a new folder in "Packages/RailsQuick" 我在“Packages / RailsQuick”中创建了一个新文件夹

And Created 2 files: 并创建了2个文件:

RailsQuick.py RailsQuick.py

import sublime, sublime_plugin

class GeneratorsCommand(sublime_plugin.WindowCommand):
  def run(self):
    self.window.show_quick_panel(["test"], None)

RailsQuick.sublime-commands RailsQuick.sublime的命令

[
  {
    "caption": "RailsQuick: Generators",
    "command": "rails_quick_generators"
  }
]

The problem is that i cant find RailsQuick: Generators in the Command Platte (CTRL + SHIFT + P) 问题是我找不到RailsQuick: Generators Command Platte中的RailsQuick: Generators (CTRL + SHIFT + P)

Sublime Text 2 Command Platte

Console logs after saving both files: 保存两个文件后的控制台日志:

Writing file /home/danpe/.config/sublime-text-2/Packages/RailsQuick/RailsQuick.py with encoding UTF-8
Reloading plugin /home/danpe/.config/sublime-text-2/Packages/RailsQuick/RailsQuick.py
Writing file /home/danpe/.config/sublime-text-2/Packages/RailsQuick/RailsQuick.sublime-commands with encoding UTF-8

What am i doing wrong ? 我究竟做错了什么 ?

My lucky guess: 我的幸运猜测:

Your class name is wrong. 你的班级名字错了。 GeneratorsCommand should match the one defined in RailsQuick.sublime-commands ( rails_quick_generators ). GeneratorsCommand应该与RailsQuick.sublime-commandsrails_quick_generators )中定义的匹配。 Sublime Text 2 needs to have 1:1 mapping between these names, otherwise it cannot know which plug-in belongs to which shortcut. Sublime Text 2需要在这些名称之间进行1:1映射,否则无法知道哪个插件属于哪个快捷方式。

Example: 例:

https://github.com/witsch/SublimePythonTidy https://github.com/witsch/SublimePythonTidy

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM