File tree Expand file tree Collapse file tree 1 file changed +27
-4
lines changed
Expand file tree Collapse file tree 1 file changed +27
-4
lines changed Original file line number Diff line number Diff line change @@ -63,25 +63,48 @@ export class LuaLanguageConfiguration implements LanguageConfiguration {
6363 }
6464 ] ;
6565
66- // Add annotation completion rules if enabled
6766 if ( enableAnnotationCompletion ) {
6867 const annotationRules : OnEnterRule [ ] = [
69- // Continue annotation with space ( ---)
68+ // 当前行以`--- `开头时, 自动补全` --- `
7069 {
7170 beforeText : / ^ - - - \s + / ,
7271 action : {
7372 indentAction : IndentAction . None ,
7473 appendText : '--- '
7574 }
7675 } ,
77- // Continue annotation without space ( ---)
76+ // 当前行以`---`开头时且后面没有任何内容时, 自动补全` ---`
7877 {
7978 beforeText : / ^ - - - $ / ,
8079 action : {
8180 indentAction : IndentAction . None ,
8281 appendText : '---'
8382 }
84- }
83+ } ,
84+ // 当前行以`-- `开头时, 自动补全`-- `
85+ {
86+ beforeText : / ^ - - \s + / ,
87+ action : {
88+ indentAction : IndentAction . None ,
89+ appendText : '-- '
90+ }
91+ } ,
92+ // 当前行以一些注解标识符开头时, 自动补全`---@`
93+ {
94+ beforeText : / ^ - - - @ ( c l a s s | f i e l d | p a r a m | g e n e r i c | o v e r l o a d ) \b .* / ,
95+ action : {
96+ indentAction : IndentAction . None ,
97+ appendText : '---@'
98+ }
99+ } ,
100+ // 对`---@alias`多行格式的处理, 我们认为以`---|`开头的行都是`---@alias`的续行
101+ {
102+ beforeText : / ^ - - - \| .* / ,
103+ action : {
104+ indentAction : IndentAction . None ,
105+ appendText : '---| '
106+ }
107+ } ,
85108 ] ;
86109
87110 return [ ...annotationRules , ...baseRules ] ;
You can’t perform that action at this time.
0 commit comments