corvofeng / Vsnips

Ultisnips for vscode
38 stars 3 forks source link

增加对于js函数返回值的索引的支持 #29

Open corvofeng opened 4 years ago

corvofeng commented 4 years ago

下面是all.snippets中的一个片段

snippet todo "TODO comment" bw
`!p snip.rv=get_comment_format()[0]` ${2:TODO}: $0${3: <${4:`!v strftime('%d-%m-%y')`}${5:, `!v g:snips_author`}>} `!p snip.rv=get_comment_format()[2]`
endsnippet

片段中比较重要的部分就是:!p snip.rv=get_comment_format()[0]

该模板需要被分为两部分解析: get_comment_format,与[0]

其中, get_comment_format用于获取当前源代码的注释方式, 需要在补全时方能知道