Add undefined check for tokenPrecedingSpanStart

This commit is contained in:
Jason Freeman 2014-09-22 15:09:20 -07:00
parent bfde7ece13
commit 945eb7ce81

View file

@ -448,6 +448,10 @@ module ts.SignatureHelp {
export function getSignatureHelpCurrentArgumentState(sourceFile: SourceFile, position: number, applicableSpanStart: number): SignatureHelpState {
var tokenPrecedingSpanStart = ServicesSyntaxUtilities.findPrecedingToken(applicableSpanStart, sourceFile);
if (!tokenPrecedingSpanStart) {
return undefined;
}
if (tokenPrecedingSpanStart.kind !== SyntaxKind.OpenParenToken && tokenPrecedingSpanStart.kind !== SyntaxKind.LessThanToken) {
// The span start must have moved backward in the file (for example if the open paren was backspaced)
return undefined;