consolidate isInComment and getRangeOfEnclosingComment

This commit is contained in:
Arthur Ozga 2017-08-15 12:01:43 -07:00
parent a209db7bb6
commit a08d18af57

View file

@ -867,9 +867,9 @@ namespace ts {
export function isInComment(
sourceFile: SourceFile,
position: number,
tokenAtPosition = getTokenAtPosition(sourceFile, position, /*includeJsDocComment*/ false),
tokenAtPosition?: Node,
predicate?: (c: CommentRange) => boolean): boolean {
return !!formatting.getRangeOfEnclosingComment(sourceFile, position, /*onlyMultiLine*/ false, tokenAtPosition, predicate);
return !!formatting.getRangeOfEnclosingComment(sourceFile, position, /*onlyMultiLine*/ false, /*precedingToken*/ undefined, tokenAtPosition, predicate);
}
export function hasDocComment(sourceFile: SourceFile, position: number) {