mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-17 10:31:20 -06:00
Revert "Return empty doc comment instead of undefined"
This reverts commit 22eb519b0f6c4c06c71a7c2dd351bbec530f5dd9.
This commit is contained in:
parent
509b9ad087
commit
12baae6c84
@ -190,26 +190,24 @@ namespace ts.JsDoc {
|
||||
* be performed.
|
||||
*/
|
||||
export function getDocCommentTemplateAtPosition(newLine: string, sourceFile: SourceFile, position: number): TextInsertion {
|
||||
const emptyDocComment = { newText: "", caretOffset: 0 };
|
||||
|
||||
// Check if in a context where we don't want to perform any insertion
|
||||
if (isInString(sourceFile, position) || isInComment(sourceFile, position) || hasDocComment(sourceFile, position)) {
|
||||
return emptyDocComment;
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const tokenAtPos = getTokenAtPosition(sourceFile, position, /*includeJsDocComment*/ false);
|
||||
const tokenStart = tokenAtPos.getStart();
|
||||
if (!tokenAtPos || tokenStart < position) {
|
||||
return emptyDocComment;
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const commentOwnerInfo = getCommentOwnerInfo(tokenAtPos);
|
||||
if (!commentOwnerInfo) {
|
||||
return emptyDocComment;
|
||||
return undefined;
|
||||
}
|
||||
const { commentOwner, parameters } = commentOwnerInfo;
|
||||
if (commentOwner.getStart() < position) {
|
||||
return emptyDocComment;
|
||||
return undefined;
|
||||
}
|
||||
|
||||
if (!parameters || parameters.length === 0) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user