Sublime Text 2 Comment/Doc Block

笑着哭i 提交于 2019-12-02 17:28:57

And now an even better solution has become available:

https://github.com/spadgos/sublime-jsdocs

It is called DocBlockr, and it has PHPDoc support. It automatically adds the doc block based on the function parameters. Nice...

Handfeger

Just had the same problem and wrote a little snippet. Since it is a keybinding it has to be stored in a .sublime-keymap File. If you're on a Mac just goto Sublime Text 2 > Preferences > Key Bindings - User or similar on some other OS.

Here is my Code:

[
{"keys": ["enter"], "command": "insert", "args" : {"characters": "\n * "}, "context": [
    {"key": "selection_empty", "operator": "equal", "operand": true},
    {"key": "preceding_text", "operator": "regex_contains", "operand": "\\/\\*\\*$", "match_all": true}
]},
{"keys": ["enter"], "command": "insert", "args" : {"characters": "\n* "}, "context": [
    //{"key": "selection_empty", "operator": "equal", "operand": true},
    {"key": "preceding_text", "operator": "regex_contains", "operand": "^[\t ]*\\*[^\\/]", "match_all": true}
]}
]
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!