Find tagless JSDoc as preceding token (#39912)

This commit is contained in:
Andrew Branch 2020-08-05 10:09:45 -07:00 committed by GitHub
parent 2ebdf9fdce
commit 7f4e1b699a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 0 deletions

View File

@ -1217,6 +1217,10 @@ namespace ts {
}
const children = n.getChildren(sourceFile);
if (children.length === 0) {
return n;
}
const candidate = findRightmostChildNodeWithTokens(children, /*exclusiveStartPosition*/ children.length, sourceFile);
return candidate && findRightmostToken(candidate, sourceFile);
}

View File

@ -0,0 +1,17 @@
/// <reference path="fourslash.ts" />
////export interface Foo {
//// /** JSDoc */
//// /**/foo(): void;
////}
// Should not crash, #35632
verify.completions({
marker: "",
isNewIdentifierLocation: true,
exact: [{
name: "readonly",
kind: "keyword",
sortText: completion.SortText.GlobalsOrKeywords
}]
});