Skip to content

Commit 12baae6

Browse files
Revert "Return empty doc comment instead of undefined"
This reverts commit 22eb519.
1 parent 509b9ad commit 12baae6

1 file changed

Lines changed: 4 additions & 6 deletions

File tree

src/services/jsDoc.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -190,26 +190,24 @@ namespace ts.JsDoc {
190190
* be performed.
191191
*/
192192
export function getDocCommentTemplateAtPosition(newLine: string, sourceFile: SourceFile, position: number): TextInsertion {
193-
const emptyDocComment = { newText: "", caretOffset: 0 };
194-
195193
// Check if in a context where we don't want to perform any insertion
196194
if (isInString(sourceFile, position) || isInComment(sourceFile, position) || hasDocComment(sourceFile, position)) {
197-
return emptyDocComment;
195+
return undefined;
198196
}
199197

200198
const tokenAtPos = getTokenAtPosition(sourceFile, position, /*includeJsDocComment*/ false);
201199
const tokenStart = tokenAtPos.getStart();
202200
if (!tokenAtPos || tokenStart < position) {
203-
return emptyDocComment;
201+
return undefined;
204202
}
205203

206204
const commentOwnerInfo = getCommentOwnerInfo(tokenAtPos);
207205
if (!commentOwnerInfo) {
208-
return emptyDocComment;
206+
return undefined;
209207
}
210208
const { commentOwner, parameters } = commentOwnerInfo;
211209
if (commentOwner.getStart() < position) {
212-
return emptyDocComment;
210+
return undefined;
213211
}
214212

215213
if (!parameters || parameters.length === 0) {

0 commit comments

Comments
 (0)