Skip to content

Commit b355a34

Browse files
committed
regex: more restrictive in terms of jsdoc format
fourslash test
1 parent 8138a86 commit b355a34

File tree

2 files changed

+3
-9
lines changed

2 files changed

+3
-9
lines changed

src/services/completions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -884,7 +884,7 @@ namespace ts.Completions {
884884
/*/
885885
const lineStart = getLineStartPositionForPosition(position, sourceFile);
886886
// jsdoc tag will be listed if there is more than one whitespace after "*"
887-
const match = /^(?:\s*\/\*\*|[*\s]+(?=\s))?\s+(@)?$/.exec(
887+
const match = /^(?:\s*\/\*\*|\s+\*)?\s+(@)?$/.exec(
888888
sourceFile.text.substring(lineStart, position)
889889
);
890890
if (match) {

tests/cases/fourslash/completionsJsdocTag.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,6 @@
55
//// * /**/
66
//// */
77

8-
// cannot run fourslash test these cases because it doesn't recognize the marker
9-
//** /*invalidMarker1*/*/
10-
//
11-
//** /*invalidMarker2*/*/
12-
//
138

149
// 1x - jsdoc tags are listed when there is more than one whitespace after "*"
1510
/////**
@@ -162,12 +157,11 @@ test.markerNames().forEach(marker => {
162157
// case 70:
163158
completionOpt = { marker, includes: [
164159
"@abstract", "@access",
165-
// "@link"
166160
]};
167161
break;
168162

169163
// 3x - jsdoc tag names will be listed
170-
case 30: case 31: case 32: case 33: case 34: case 35:
164+
case 30: case 31: case 32: case 33: case 34: case 35: case 36:
171165

172166
// 4x - jsdoc tag name completions should not occur
173167
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -180,7 +174,7 @@ test.markerNames().forEach(marker => {
180174
completionOpt = {
181175
marker,
182176
triggerCharacter: "@",
183-
includes: ["abstract", "access"]
177+
includes: ["package", "param"]
184178
};
185179
break;
186180

0 commit comments

Comments
 (0)