Skip to content

Commit 70eee8a

Browse files
committed
chore: update LuaLanguageConfiguration
1 parent f6d3803 commit 70eee8a

File tree

1 file changed

+27
-4
lines changed

1 file changed

+27
-4
lines changed

src/languageConfiguration.ts

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff 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: /^---@(class|field|param|generic|overload)\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];

0 commit comments

Comments
 (0)