Skip to content

Commit 945eb7c

Browse files
committed
Add undefined check for tokenPrecedingSpanStart
1 parent bfde7ec commit 945eb7c

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/services/signatureHelp.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -448,6 +448,10 @@ module ts.SignatureHelp {
448448

449449
export function getSignatureHelpCurrentArgumentState(sourceFile: SourceFile, position: number, applicableSpanStart: number): SignatureHelpState {
450450
var tokenPrecedingSpanStart = ServicesSyntaxUtilities.findPrecedingToken(applicableSpanStart, sourceFile);
451+
if (!tokenPrecedingSpanStart) {
452+
return undefined;
453+
}
454+
451455
if (tokenPrecedingSpanStart.kind !== SyntaxKind.OpenParenToken && tokenPrecedingSpanStart.kind !== SyntaxKind.LessThanToken) {
452456
// The span start must have moved backward in the file (for example if the open paren was backspaced)
453457
return undefined;

0 commit comments

Comments
 (0)