From 76e8560b0ef94a6baae4c7dcf467abd94a022580 Mon Sep 17 00:00:00 2001 From: Vladimir Matveev Date: Tue, 2 Dec 2014 15:04:44 -0800 Subject: [PATCH] fix crash in signature help --- src/compiler/types.ts | 2 +- src/services/utilities.ts | 4 ---- tests/cases/fourslash/signatureHelpWithUnknown.ts | 6 ++++++ 3 files changed, 7 insertions(+), 5 deletions(-) create mode 100644 tests/cases/fourslash/signatureHelpWithUnknown.ts diff --git a/src/compiler/types.ts b/src/compiler/types.ts index ac94bfae517..db691b09455 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -257,7 +257,7 @@ module ts { LastTypeNode = ParenthesizedType, FirstPunctuation = OpenBraceToken, LastPunctuation = CaretEqualsToken, - FirstToken = EndOfFileToken, + FirstToken = Unknown, LastToken = TypeKeyword, FirstTriviaToken = SingleLineCommentTrivia, LastTriviaToken = WhitespaceTrivia, diff --git a/src/services/utilities.ts b/src/services/utilities.ts index 4a3301312fb..9df0476c105 100644 --- a/src/services/utilities.ts +++ b/src/services/utilities.ts @@ -280,10 +280,6 @@ module ts { } function nodeHasTokens(n: Node): boolean { - if (n.kind === SyntaxKind.Unknown) { - return false; - } - // If we have a token or node that has a non-zero width, it must have tokens. // Note, that getWidth() does not take trivia into account. return n.getWidth() !== 0; diff --git a/tests/cases/fourslash/signatureHelpWithUnknown.ts b/tests/cases/fourslash/signatureHelpWithUnknown.ts new file mode 100644 index 00000000000..00a031b2673 --- /dev/null +++ b/tests/cases/fourslash/signatureHelpWithUnknown.ts @@ -0,0 +1,6 @@ +/// + +////eval(\/*1*/ + +goTo.marker("1"); +verify.signatureHelpCountIs(1);