mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-04 21:53:42 -06:00
Show call and construct signatures when using aliases
This commit is contained in:
parent
471d80d91e
commit
3715af1a5a
@ -2749,7 +2749,7 @@ module ts {
|
||||
var symbolKind = getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar(symbol, symbolFlags);
|
||||
var hasAddedSymbolInfo: boolean;
|
||||
// Class at constructor site need to be shown as constructor apart from property,method, vars
|
||||
if (symbolKind !== ScriptElementKind.unknown || symbolFlags & SymbolFlags.Signature || symbolFlags & SymbolFlags.Class) {
|
||||
if (symbolKind !== ScriptElementKind.unknown || symbolFlags & SymbolFlags.Class || symbolFlags & SymbolFlags.Import) {
|
||||
// If it is accessor they are allowed only if location is at name of the accessor
|
||||
if (symbolKind === ScriptElementKind.memberGetAccessorElement || symbolKind === ScriptElementKind.memberSetAccessorElement) {
|
||||
symbolKind = ScriptElementKind.memberVariableElement;
|
||||
@ -2790,6 +2790,18 @@ module ts {
|
||||
symbolKind = ScriptElementKind.constructorImplementationElement;
|
||||
addPrefixForAnyFunctionOrVar(type.symbol, symbolKind);
|
||||
}
|
||||
else if (symbolFlags & SymbolFlags.Import) {
|
||||
symbolKind = ScriptElementKind.alias;
|
||||
displayParts.push(punctuationPart(SyntaxKind.OpenParenToken));
|
||||
displayParts.push(textPart(symbolKind));
|
||||
displayParts.push(punctuationPart(SyntaxKind.CloseParenToken));
|
||||
displayParts.push(spacePart());
|
||||
if (useConstructSignatures) {
|
||||
displayParts.push(keywordPart(SyntaxKind.NewKeyword));
|
||||
displayParts.push(spacePart());
|
||||
}
|
||||
addFullSymbolName(symbol);
|
||||
}
|
||||
else {
|
||||
addPrefixForAnyFunctionOrVar(symbol, symbolKind);
|
||||
}
|
||||
|
||||
@ -8,12 +8,16 @@
|
||||
//// export class /*1*/c {
|
||||
//// };
|
||||
//// }
|
||||
//// export function foo() {
|
||||
//// }
|
||||
////}
|
||||
/////**This is on import declaration*/
|
||||
////import /*2*/internalAlias = m1.m2./*3*/c;
|
||||
////var /*4*/newVar = new /*5*/internalAlias();
|
||||
////var /*6*/anotherAliasVar = /*7*/internalAlias;
|
||||
|
||||
////import /*8*/internalFoo = m1./*9*/foo;
|
||||
////var /*10*/callVar = /*11*/internalFoo();
|
||||
////var /*12*/anotherAliasFoo = /*13*/internalFoo;
|
||||
|
||||
goTo.marker('1');
|
||||
verify.quickInfoIs("class m1.m2.c", "class comment;");
|
||||
@ -28,10 +32,28 @@ goTo.marker('4');
|
||||
verify.quickInfoIs("(var) newVar: internalAlias", "");
|
||||
|
||||
goTo.marker('5');
|
||||
verify.quickInfoIs("import internalAlias = m1.m2.c", "This is on import declaration");
|
||||
verify.quickInfoIs("(alias) new internalAlias(): internalAlias\nimport internalAlias = m1.m2.c", "");
|
||||
|
||||
goTo.marker('6');
|
||||
verify.quickInfoIs("(var) anotherAliasVar: typeof internalAlias", "");
|
||||
|
||||
goTo.marker('7');
|
||||
verify.quickInfoIs("import internalAlias = m1.m2.c", "This is on import declaration");
|
||||
verify.quickInfoIs("import internalAlias = m1.m2.c", "This is on import declaration");
|
||||
|
||||
goTo.marker('8');
|
||||
verify.quickInfoIs('import internalFoo = m1.foo', "");
|
||||
|
||||
goTo.marker('9');
|
||||
verify.quickInfoIs("(function) m1.foo(): void", "");
|
||||
|
||||
goTo.marker('10');
|
||||
verify.quickInfoIs("(var) callVar: void", "");
|
||||
|
||||
goTo.marker('11');
|
||||
verify.quickInfoIs("(alias) internalFoo(): void\nimport internalFoo = m1.foo", "");
|
||||
|
||||
goTo.marker('12');
|
||||
verify.quickInfoIs("(var) anotherAliasFoo: () => void", "");
|
||||
|
||||
goTo.marker('13');
|
||||
verify.quickInfoIs("import internalFoo = m1.foo", "");
|
||||
Loading…
x
Reference in New Issue
Block a user