Skip to content

Commit 7f4e1b6

Browse files
authored
Find tagless JSDoc as preceding token (#39912)
1 parent 2ebdf9f commit 7f4e1b6

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

src/services/utilities.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1217,6 +1217,10 @@ namespace ts {
12171217
}
12181218

12191219
const children = n.getChildren(sourceFile);
1220+
if (children.length === 0) {
1221+
return n;
1222+
}
1223+
12201224
const candidate = findRightmostChildNodeWithTokens(children, /*exclusiveStartPosition*/ children.length, sourceFile);
12211225
return candidate && findRightmostToken(candidate, sourceFile);
12221226
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/// <reference path="fourslash.ts" />
2+
3+
////export interface Foo {
4+
//// /** JSDoc */
5+
//// /**/foo(): void;
6+
////}
7+
8+
// Should not crash, #35632
9+
verify.completions({
10+
marker: "",
11+
isNewIdentifierLocation: true,
12+
exact: [{
13+
name: "readonly",
14+
kind: "keyword",
15+
sortText: completion.SortText.GlobalsOrKeywords
16+
}]
17+
});

0 commit comments

Comments
 (0)