5

我开始为Sublime Text 2编写插件。

我在“Packages/RailsQuick”中创建了一个新文件夹

并创建了 2 个文件:

RailsQuick.py

import sublime, sublime_plugin

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

RailsQuick.sublime-commands

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

RailsQuick: Generators问题是我在 Command Platte (CTRL + SHIFT + P) 中找不到

Sublime Text 2 命令盘

保存两个文件后的控制台日志:

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

我究竟做错了什么 ?

4

1 回答 1

4

我的幸运猜测:

你的班级名称是错误的。应与( )GeneratorsCommand中定义的匹配。Sublime Text 2 需要这些名称之间有 1:1 的映射关系,否则无法知道哪个插件属于哪个快捷方式。RailsQuick.sublime-commandsrails_quick_generators

例子:

https://github.com/witsch/SublimePythonTidy

于 2012-10-23T18:08:10.900 回答