mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-04 21:53:42 -06:00
Show better alias information in completion entry and quickInfo
This commit is contained in:
parent
8ff6251200
commit
471d80d91e
@ -2917,11 +2917,28 @@ module ts {
|
||||
}
|
||||
if (symbolFlags & SymbolFlags.Import) {
|
||||
addNewLineIfDisplayPartsExist();
|
||||
displayParts.push(punctuationPart(SyntaxKind.OpenParenToken));
|
||||
displayParts.push(textPart("alias"));
|
||||
displayParts.push(punctuationPart(SyntaxKind.CloseParenToken));
|
||||
displayParts.push(keywordPart(SyntaxKind.ImportKeyword));
|
||||
displayParts.push(spacePart());
|
||||
addFullSymbolName(symbol);
|
||||
displayParts.push(spacePart());
|
||||
displayParts.push(punctuationPart(SyntaxKind.EqualsToken));
|
||||
displayParts.push(spacePart());
|
||||
ts.forEach(symbol.declarations, declaration => {
|
||||
if (declaration.kind === SyntaxKind.ImportDeclaration) {
|
||||
var importDeclaration = <ImportDeclaration>declaration;
|
||||
if (importDeclaration.externalModuleName) {
|
||||
displayParts.push(keywordPart(SyntaxKind.RequireKeyword));
|
||||
displayParts.push(punctuationPart(SyntaxKind.OpenParenToken));
|
||||
displayParts.push(displayPart(getTextOfNode(importDeclaration.externalModuleName), SymbolDisplayPartKind.stringLiteral));
|
||||
displayParts.push(punctuationPart(SyntaxKind.CloseParenToken));
|
||||
}
|
||||
else {
|
||||
var internalAliasSymbol = typeResolver.getSymbolInfo(importDeclaration.entityName);
|
||||
addFullSymbolName(internalAliasSymbol, enclosingDeclaration);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
if (!hasAddedSymbolInfo) {
|
||||
if (symbolKind !== ScriptElementKind.unknown) {
|
||||
@ -3028,7 +3045,7 @@ module ts {
|
||||
case SyntaxKind.QualifiedName:
|
||||
case SyntaxKind.ThisKeyword:
|
||||
case SyntaxKind.SuperKeyword:
|
||||
// For the identifiers/this/usper etc get the type at position
|
||||
// For the identifiers/this/super etc get the type at position
|
||||
var type = typeInfoResolver.getTypeOfNode(node);
|
||||
if (type) {
|
||||
return {
|
||||
|
||||
@ -69,10 +69,10 @@ verify.memberListContains("i", "(var) m1.m2.i: m1.m2.c", "i");
|
||||
|
||||
goTo.file("commentsExternalModules_file1.ts");
|
||||
goTo.marker('9');
|
||||
verify.quickInfoIs('(alias) extMod', "This is on import declaration");
|
||||
verify.quickInfoIs('import extMod = require("commentsExternalModules_file0")', "This is on import declaration");
|
||||
|
||||
goTo.marker('10');
|
||||
verify.completionListContains("extMod", "(alias) extMod", "This is on import declaration");
|
||||
verify.completionListContains("extMod", 'import extMod = require("commentsExternalModules_file0")', "This is on import declaration");
|
||||
|
||||
goTo.marker('11');
|
||||
verify.memberListContains("m1", "module extMod.m1");
|
||||
|
||||
@ -28,7 +28,7 @@ goTo.marker('2');
|
||||
verify.quickInfoIs("module m1", "ModuleComment");
|
||||
|
||||
goTo.marker('3');
|
||||
verify.quickInfoIs("(alias) extMod", "Import declaration");
|
||||
verify.quickInfoIs('import extMod = require("commentsImportDeclaration_file0")', "Import declaration");
|
||||
|
||||
goTo.marker('6');
|
||||
verify.memberListContains("m1", "module extMod.m1");
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
////}
|
||||
|
||||
goTo.marker("1");
|
||||
verify.memberListContains("x", "(alias) x", undefined);
|
||||
verify.memberListContains("x", "import x = M", undefined);
|
||||
|
||||
goTo.marker("2");
|
||||
verify.memberListContains("value");
|
||||
|
||||
@ -15,7 +15,7 @@
|
||||
////var /*3*/r2 = t./*4*/foo; // t should have 'foo' in dropdown list and be of type 'string'
|
||||
|
||||
goTo.marker('1');
|
||||
verify.quickInfoIs('(alias) test');
|
||||
verify.quickInfoIs("import test = require('exportEqualTypes_file0')");
|
||||
goTo.marker('2');
|
||||
verify.quickInfoIs('(var) r1: Date');
|
||||
goTo.marker('3');
|
||||
|
||||
@ -30,7 +30,7 @@
|
||||
|
||||
goTo.file("externalModuleWithExportAssignment_file1.ts");
|
||||
goTo.marker('1');
|
||||
verify.quickInfoIs("(alias) a1");
|
||||
verify.quickInfoIs('import a1 = require("externalModuleWithExportAssignment_file0")');
|
||||
|
||||
goTo.marker('2');
|
||||
verify.quickInfoIs("(var) a: {\n (): a1.connectExport;\n test1: a1.connectModule;\n test2(): a1.connectModule;\n}", undefined);
|
||||
|
||||
@ -19,7 +19,7 @@
|
||||
edit.insert('');
|
||||
|
||||
goTo.marker('1');
|
||||
verify.quickInfoIs('(alias) Foo');
|
||||
verify.quickInfoIs("import Foo = require('mergedDeclarationsWithExportAssignment1_file0')");
|
||||
|
||||
goTo.marker('2');
|
||||
verify.completionListContains('Foo');
|
||||
|
||||
@ -11,12 +11,27 @@
|
||||
////}
|
||||
/////**This is on import declaration*/
|
||||
////import /*2*/internalAlias = m1.m2./*3*/c;
|
||||
////var /*4*/newVar = new /*5*/internalAlias();
|
||||
////var /*6*/anotherAliasVar = /*7*/internalAlias;
|
||||
|
||||
|
||||
goTo.marker('1');
|
||||
verify.quickInfoIs("class m1.m2.c", "class comment;");
|
||||
|
||||
goTo.marker('2');
|
||||
verify.quickInfoIs('(alias) internalAlias', "This is on import declaration");
|
||||
verify.quickInfoIs('import internalAlias = m1.m2.c', "This is on import declaration");
|
||||
|
||||
goTo.marker('3');
|
||||
verify.quickInfoIs("class m1.m2.c", "class comment;");
|
||||
verify.quickInfoIs("class m1.m2.c", "class comment;");
|
||||
|
||||
goTo.marker('4');
|
||||
verify.quickInfoIs("(var) newVar: internalAlias", "");
|
||||
|
||||
goTo.marker('5');
|
||||
verify.quickInfoIs("import internalAlias = m1.m2.c", "This is on import declaration");
|
||||
|
||||
goTo.marker('6');
|
||||
verify.quickInfoIs("(var) anotherAliasVar: typeof internalAlias", "");
|
||||
|
||||
goTo.marker('7');
|
||||
verify.quickInfoIs("import internalAlias = m1.m2.c", "This is on import declaration");
|
||||
@ -5,5 +5,5 @@
|
||||
////A./**/I
|
||||
|
||||
goTo.marker();
|
||||
verify.completionListContains("A", "(alias) A");
|
||||
verify.completionListContains("A", "import A = require('app')");
|
||||
verify.completionListContains("I", "(var) I: number");
|
||||
Loading…
x
Reference in New Issue
Block a user