Skip to content

Commit

Permalink
regex: more restrictive in terms of jsdoc format
Browse files Browse the repository at this point in the history
fourslash test
  • Loading branch information
jeffy-g committed Apr 10, 2020
1 parent 8138a86 commit b355a34
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/services/completions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -884,7 +884,7 @@ namespace ts.Completions {
/*/
const lineStart = getLineStartPositionForPosition(position, sourceFile);
// jsdoc tag will be listed if there is more than one whitespace after "*"
const match = /^(?:\s*\/\*\*|[*\s]+(?=\s))?\s+(@)?$/.exec(
const match = /^(?:\s*\/\*\*|\s+\*)?\s+(@)?$/.exec(
sourceFile.text.substring(lineStart, position)
);
if (match) {
Expand Down
10 changes: 2 additions & 8 deletions tests/cases/fourslash/completionsJsdocTag.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@
//// * /**/
//// */

// cannot run fourslash test these cases because it doesn't recognize the marker
//** /*invalidMarker1*/*/
//
//** /*invalidMarker2*/*/
//

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

// 3x - jsdoc tag names will be listed
case 30: case 31: case 32: case 33: case 34: case 35:
case 30: case 31: case 32: case 33: case 34: case 35: case 36:

// 4x - jsdoc tag name completions should not occur
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Expand All @@ -180,7 +174,7 @@ test.markerNames().forEach(marker => {
completionOpt = {
marker,
triggerCharacter: "@",
includes: ["abstract", "access"]
includes: ["package", "param"]
};
break;

Expand Down

0 comments on commit b355a34

Please sign in to comment.