Use external aliases in quickinfo and signature help return types (#24391)

* Dont include import types in quick info type names

* Add UseAliasDefinedOutsideCurrentScope flag to LS operations which were missing it
This commit is contained in:
Wesley Wigham authored and GitHub committed 2018-05-24 15:19:57 -07:00
1 parent 9761c0908d
commit 8f9c0861bc
3 files changed
+22 -3

No files matched your search

+2 -2
View File
@@ -2993,7 +2993,7 @@ namespace ts {
}
}
function typeToString(type: Type, enclosingDeclaration?: Node, flags: TypeFormatFlags = TypeFormatFlags.AllowUniqueESSymbolType, writer: EmitTextWriter = createTextWriter("")): string {
function typeToString(type: Type, enclosingDeclaration?: Node, flags: TypeFormatFlags = TypeFormatFlags.AllowUniqueESSymbolType | TypeFormatFlags.UseAliasDefinedOutsideCurrentScope, writer: EmitTextWriter = createTextWriter("")): string {
const typeNode = nodeBuilder.typeToTypeNode(type, enclosingDeclaration, toNodeBuilderFlags(flags) | NodeBuilderFlags.IgnoreErrors, writer);
if (typeNode === undefined) return Debug.fail("should always get typenode");
const options = { removeComments: true };
@@ -3941,7 +3941,7 @@ namespace ts {
}
}
function typePredicateToString(typePredicate: TypePredicate, enclosingDeclaration?: Node, flags?: TypeFormatFlags, writer?: EmitTextWriter): string {
function typePredicateToString(typePredicate: TypePredicate, enclosingDeclaration?: Node, flags: TypeFormatFlags = TypeFormatFlags.UseAliasDefinedOutsideCurrentScope, writer?: EmitTextWriter): string {
return writer ? typePredicateToStringWorker(writer).getText() : usingSingleLineStringWriter(typePredicateToStringWorker);
function typePredicateToStringWorker(writer: EmitTextWriter) {
+1 -1
View File
@@ -1473,7 +1473,7 @@ namespace ts {
export function typeToDisplayParts(typechecker: TypeChecker, type: Type, enclosingDeclaration?: Node, flags: TypeFormatFlags = TypeFormatFlags.None): SymbolDisplayPart[] {
return mapToDisplayParts(writer => {
typechecker.writeType(type, enclosingDeclaration, flags | TypeFormatFlags.MultilineObjectLiterals, writer);
typechecker.writeType(type, enclosingDeclaration, flags | TypeFormatFlags.MultilineObjectLiterals | TypeFormatFlags.UseAliasDefinedOutsideCurrentScope, writer);
});
}
@@ -0,0 +1,19 @@
/// <reference path="fourslash.ts" />
// @Filename: b.ts
////export interface B {}
////export function foob(): {
//// x: B,
//// y: B
////} {
//// return null as any;
////}
// @Filename: a.ts
////import { foob } from "./b";
////const thing/*1*/ = foob(/*2*/);
verify.quickInfoAt("1", "const thing: {\n x: B;\n y: B;\n}");
verify.signatureHelp({
marker: "2",
text: "foob(): { x: B; y: B; }"
});