C2console - 功能示意图本文作者为
简书-melo的微博 / 掘金-melo的微博
Github-meloalright / Medium-@meloalright
转载请注明出处哦。
编写一个简单的类似 c2console 的 Sublime 插件
ps: 该插件目前已经被 package-control 收录
Step 1 - 编写插件代码
1.点击 Tools => Developer => New Plugin 创建插件用例
2.使用 Python 编写插件
import sublime
import sublime_plugin
def plugin_loaded():
# write your code here
pass
class c2console(sublime_plugin.EventListener):
def on_query_completions(self, view, prefix, locations):
# write your code here
pass
Step 2 - 编写菜单配置
编写 Main.sublime-menu - 示例如下:
[
{
"caption": "Preferences",
"mnemonic": "n",
"id": "preferences",
"children":
[
{
"caption": "Package Settings",
"mnemonic": "P",
"id": "package-settings",
"children":
[
{
"caption": "c2console",
"children": [
{
"command": "open_url", "args":
{
"url": "https://github.com/meloalright/c2console"
},
"caption": "Github - c2console"
}
]
}
]
}
]
}
]
Step 3 - 上传 Github
完成插件[README] + 上传[Github]
Step 4 - 提交 package-control
1. 去把 package_control_channel 仓库 fork 下来
2. 把你的插件添加到仓库的索引里 - 示例如下:
}
]
},
+ {
+ "name": "C2console",
+ "details": "https://github.com/meloalright/c2console",
+ "labels": ["javascript", "console", "log"],
+ "releases": [
+ {
+ "sublime_text": "*",
+ "tags": true
+ }
+ ]
+ },
{
"name": "C99",
"details": "https://github.com/noct/sublime-c99",
3. 提交 Pull-Request
ps: 如果作者觉得你的作品没什么问题会把PR合并
ps: 如果PR合并成功即可在 package-control 搜到
ps: 如果PR合并成功即可在 sublime 里直接 install package
结语:
完整[DEMO]请参考: https://github.com/meloalright/c2console
(∩_∩)求给个☆哦
网友评论