mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Fix to make the completionlist work correctly when typing a new generic type + fourslash tests
This commit is contained in:
@@ -2366,6 +2366,13 @@ module ts {
|
||||
return result;
|
||||
}
|
||||
|
||||
function isCompletionListBuilder(previousToken: Node): boolean {
|
||||
var start = new Date().getTime();
|
||||
|
||||
host.log("getCompletionsAtPosition: isCompletionListBuilder: " + (new Date().getTime() - start));
|
||||
return true;
|
||||
}
|
||||
|
||||
function isInStringOrRegularExpressionOrTemplateLiteral(previousToken: Node): boolean {
|
||||
if (previousToken.kind === SyntaxKind.StringLiteral
|
||||
|| previousToken.kind === SyntaxKind.RegularExpressionLiteral
|
||||
@@ -2432,7 +2439,10 @@ module ts {
|
||||
containingNodeKind === SyntaxKind.VariableDeclarationList ||
|
||||
containingNodeKind === SyntaxKind.VariableStatement ||
|
||||
containingNodeKind === SyntaxKind.EnumDeclaration || // enum a { foo, |
|
||||
isFunction(containingNodeKind);
|
||||
isFunction(containingNodeKind) ||
|
||||
containingNodeKind === SyntaxKind.ClassDeclaration || // class A<T, |
|
||||
containingNodeKind === SyntaxKind.FunctionDeclaration || // function A<T, |
|
||||
containingNodeKind === SyntaxKind.InterfaceDeclaration; // interface A<T, |
|
||||
|
||||
case SyntaxKind.OpenParenToken:
|
||||
return containingNodeKind === SyntaxKind.CatchClause ||
|
||||
@@ -2446,6 +2456,12 @@ module ts {
|
||||
return containingNodeKind === SyntaxKind.PropertySignature &&
|
||||
previousToken.parent.parent.kind === SyntaxKind.InterfaceDeclaration; // interface a { f; |
|
||||
|
||||
case SyntaxKind.FirstBinaryOperator:
|
||||
return containingNodeKind === SyntaxKind.ClassDeclaration || // class A< |
|
||||
containingNodeKind === SyntaxKind.FunctionDeclaration || // function A< |
|
||||
containingNodeKind === SyntaxKind.InterfaceDeclaration || // interface A< |
|
||||
containingNodeKind === SyntaxKind.MethodDeclaration; // class A{ b< |
|
||||
|
||||
case SyntaxKind.PublicKeyword:
|
||||
case SyntaxKind.PrivateKeyword:
|
||||
case SyntaxKind.StaticKeyword:
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
////interface A</*genericName1*/
|
||||
|
||||
////class A</*genericName2*/
|
||||
|
||||
////class B<T, /*genericName3*/
|
||||
|
||||
////class A{
|
||||
//// f</*genericName4*/
|
||||
|
||||
////function A</*genericName5*/
|
||||
|
||||
|
||||
test.markers().forEach((m) => {
|
||||
goTo.position(m.position, m.fileName);
|
||||
verify.completionListIsEmpty();
|
||||
});
|
||||
@@ -1,32 +0,0 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
////var aa = 1;
|
||||
|
||||
////class A1 {
|
||||
//// public /*property1*/
|
||||
////}
|
||||
|
||||
////class A2 {
|
||||
//// public a/*property2*/
|
||||
////}
|
||||
|
||||
////class A3 {
|
||||
//// private /*property3*/
|
||||
////}
|
||||
|
||||
////class A4 {
|
||||
//// private a/*property4*/
|
||||
////}
|
||||
|
||||
////class A5 {
|
||||
//// public static /*property5*/
|
||||
////}
|
||||
|
||||
////class A6 {
|
||||
//// public static a/*property6*/
|
||||
////}
|
||||
|
||||
test.markers().forEach((m) => {
|
||||
goTo.position(m.position, m.fileName);
|
||||
verify.completionListIsEmpty();
|
||||
});
|
||||
Reference in New Issue
Block a user