Php class library is completed to sublime.
In the previous article, I wrote about the reflection class to generate the php quick look table. It's all right at home after the Spring Festival. I want to complete the automatic file generation of sublime that I want to achieve. That is, after entering keywords in sublime, press tab to automatically complete a complete function name and parameters, and press tab to switch to the last. It is also a promise to others that sublime's tp5 plug-in will definitely be implemented this year.
The address is at https://github.com/yangweijie/SublimeThinkPHP5.0
Make clear the words "HTML_FILE_SUFFIX", "TEMPLATE_NAME", {"trigger": "_ ad", "contents": "protected function _ after_delete (\\ $data,\\ $options) {\ n ${1:}\ n} $0"}, {"trigger": "_ af", "contents": "protected function _ after_find (&\\ $result") completed by sublime. \ $options) {\ n ${1:}\ n} $0 "}, {" trigger ":" _ ai "," contents ":" protected function _ after_insert (\\ $data,\\ $options) {\ n ${1:}\ n} $0 "}, {" trigger ":" _ as "," contents ":" protected function _ after_select (&\\ $result ") \ $options) {\ n $1:foreach (\\ $result as &\\ $record)\ n ${2:\\ $this- > _ after_find (\\ $record,\\ $options) }\ n\\}\ n} $0 "}, {" trigger ":" _ au "," contents ":" protected function _ after_update (\\ $data,\\ $options) {\ n ${1:}\ n} $0 "}, {" trigger ":" _ bi "," contents ":" protected function _ before_insert (&\\ $data,\\ $options) {\ n ${1:}\ n} $0 "} {"trigger": "_ bu", "contents": "protected function _ before_update (&\\ $data,\\ $options) {\ n ${1:}\ n} $0"}, {"trigger": "- > _ empty", "contents": "\\ $this- > _ empty () $0"}, {"trigger": "_ get" "contents": "_ get ('${1:\\ name}') $0"}, {"trigger": "_ post", "contents": "_ post ('${1:\\ $name}') $0"}, {"trigger": "- > _ sql", "contents": "- > _ sql ('${1:\\ $name}') $0"}, {"trigger": "- > addAll" "contents": "- > addAll (\\ ${1:dataList},\\ ${2:options},\\ ${3:replace}) $0"}
This is written in the php.sublime-completions file in Sublime's ThinkPHP plugin.
The difference between completion and snippet is that snippet can only complete one file at a time. There are hints in the command panel.
String
Direct string in json
Tab occupies space
The last cursor completed by $0
Tab check the cursor ${1:XX} 1 to increment the subscript,: selected
Trigger trigger
Indicates what is triggered by pressing tab at the end of the text.
Pay attention
$line breaks and so on should be escaped
How to get php
Let's start with the core code: