mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-09 20:51:43 -06:00
Alias name formatting
This commit is contained in:
parent
99f67d65b0
commit
417cd9471f
@ -2833,6 +2833,14 @@ module ts {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (symbolFlags & SymbolFlags.Import) {
|
||||
addNewLineIfDisplayPartsExist();
|
||||
displayParts.push(punctuationPart(SyntaxKind.OpenParenToken));
|
||||
displayParts.push(textPart("alias"));
|
||||
displayParts.push(punctuationPart(SyntaxKind.CloseParenToken));
|
||||
displayParts.push(spacePart());
|
||||
displayParts.push.apply(displayParts, symbolToDisplayParts(typeResolver, symbol, sourceFile));
|
||||
}
|
||||
else if (!hasAddedSymbolInfo && symbolKind !== ScriptElementKind.unknown) {
|
||||
if (type) {
|
||||
addPrefixForAnyFunctionOrVar(symbol, symbolKind);
|
||||
|
||||
97
tests/cases/fourslash/commentsExternalModules.ts
Normal file
97
tests/cases/fourslash/commentsExternalModules.ts
Normal file
@ -0,0 +1,97 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
// @Filename: commentsExternalModules_file0.ts
|
||||
/////** Module comment*/
|
||||
////export module m/*1*/1 {
|
||||
//// /** b's comment*/
|
||||
//// export var b: number;
|
||||
//// /** foo's comment*/
|
||||
//// function foo() {
|
||||
//// return /*2*/b;
|
||||
//// }
|
||||
//// /** m2 comments*/
|
||||
//// export module m2 {
|
||||
//// /** class comment;*/
|
||||
//// export class c {
|
||||
//// };
|
||||
//// /** i*/
|
||||
//// export var i = new c();
|
||||
//// }
|
||||
//// /** exported function*/
|
||||
//// export function fooExport() {
|
||||
//// return f/*3q*/oo(/*3*/);
|
||||
//// }
|
||||
////}
|
||||
/////*4*/m1./*5*/fooEx/*6q*/port(/*6*/);
|
||||
////var my/*7*/var = new m1.m2./*8*/c();
|
||||
|
||||
// @Filename: commentsExternalModules_file1.ts
|
||||
/////**This is on import declaration*/
|
||||
////import ex/*9*/tMod = require("commentsExternalModules_file0");
|
||||
/////*10*/extMod./*11*/m1./*12*/fooExp/*13q*/ort(/*13*/);
|
||||
////var new/*14*/Var = new extMod.m1.m2./*15*/c();
|
||||
|
||||
// this line triggers a semantic/syntactic error check, remove line when 788570 is fixed
|
||||
edit.insert('');
|
||||
|
||||
goTo.file("commentsExternalModules_file0.ts");
|
||||
goTo.marker('1');
|
||||
verify.quickInfoIs("module m1", "Module comment");
|
||||
|
||||
goTo.marker('2');
|
||||
verify.completionListContains("b", "(var) m1.b: number", "b's comment");
|
||||
verify.completionListContains("foo", "(function) foo(): number", "foo's comment");
|
||||
|
||||
goTo.marker('3');
|
||||
verify.currentSignatureHelpDocCommentIs("foo's comment");
|
||||
goTo.marker('3q');
|
||||
verify.quickInfoIs("(function) foo(): number", "foo's comment");
|
||||
|
||||
goTo.marker('4');
|
||||
verify.completionListContains("m1", "module m1", "Module comment");
|
||||
|
||||
goTo.marker('5');
|
||||
verify.memberListContains("b", "(var) m1.b: number", "b's comment");
|
||||
verify.memberListContains("fooExport", "(function) m1.fooExport(): number", "exported function");
|
||||
verify.memberListContains("m2", "module m1.m2");
|
||||
|
||||
goTo.marker('6');
|
||||
verify.currentSignatureHelpDocCommentIs("exported function");
|
||||
goTo.marker('6q');
|
||||
verify.quickInfoIs("(function) m1.fooExport(): number", "exported function");
|
||||
|
||||
goTo.marker('7');
|
||||
verify.quickInfoIs("(var) myvar: m1.m2.c", "");
|
||||
|
||||
goTo.marker('8');
|
||||
verify.memberListContains("c", "class m1.m2.c", "class comment;");
|
||||
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");
|
||||
|
||||
goTo.marker('10');
|
||||
// TODO: extMod should exist in the completion list
|
||||
//verify.completionListContains("extMod", "(alias) extMod", "This is on import declaration");
|
||||
verify.not.completionListContains("extMod", "(alias) extMod", "This is on import declaration");
|
||||
|
||||
goTo.marker('11');
|
||||
verify.memberListContains("m1", "module extMod.m1");
|
||||
|
||||
goTo.marker('12');
|
||||
verify.memberListContains("b", "(var) extMod.m1.b: number", "b's comment");
|
||||
verify.memberListContains("fooExport", "(function) extMod.m1.fooExport(): number", "exported function");
|
||||
verify.memberListContains("m2", "module extMod.m1.m2");
|
||||
|
||||
goTo.marker('13');
|
||||
verify.currentSignatureHelpDocCommentIs("exported function");
|
||||
goTo.marker('13q');
|
||||
verify.quickInfoIs("(function) extMod.m1.fooExport(): number", "exported function");
|
||||
|
||||
goTo.marker('14');
|
||||
verify.quickInfoIs("(var) newVar: extMod.m1.m2.c", "");
|
||||
|
||||
goTo.marker('15');
|
||||
verify.memberListContains("c", "class extMod.m1.m2.c", "class comment;");
|
||||
verify.memberListContains("i", "(var) extMod.m1.m2.i: extMod.m1.m2.c", "i");
|
||||
@ -20,32 +20,32 @@
|
||||
// @Filename: commentsImportDeclaration_file1.ts
|
||||
///////<reference path='commentsImportDeclaration_file0.ts'/>
|
||||
/////** Import declaration*/
|
||||
////import extMod/*3*/ = require("commentsImportDeclaration_file0/*4*/");
|
||||
////import /*3*/extMod = require("commentsImportDeclaration_file0/*4*/");
|
||||
////extMod./*6*/m1./*7*/fooEx/*8q*/port(/*8*/);
|
||||
////var new/*9*/Var = new extMod.m1.m2./*10*/c();
|
||||
|
||||
goTo.marker('2');
|
||||
verify.quickInfoIs("m1", "ModuleComment", "m1", "module");
|
||||
verify.quickInfoIs("module m1", "ModuleComment");
|
||||
|
||||
goTo.marker('3');
|
||||
verify.quickInfoIs("extMod", "Import declaration", "extMod", "module");
|
||||
verify.quickInfoIs("(alias) extMod", "Import declaration");
|
||||
|
||||
goTo.marker('6');
|
||||
verify.memberListContains("m1", "extMod.m1");
|
||||
verify.memberListContains("m1", "module extMod.m1");
|
||||
|
||||
goTo.marker('7');
|
||||
verify.memberListContains("b", "number", "b's comment", "extMod.m1.b", "var");
|
||||
verify.memberListContains("fooExport", "(): number", "exported function", "extMod.m1.fooExport", "function");
|
||||
verify.memberListContains("m2", "extMod.m1.m2");
|
||||
verify.memberListContains("b", "(var) extMod.m1.b: number", "b's comment");
|
||||
verify.memberListContains("fooExport", "(function) extMod.m1.fooExport(): number", "exported function");
|
||||
verify.memberListContains("m2", "module extMod.m1.m2");
|
||||
|
||||
goTo.marker('8');
|
||||
verify.currentSignatureHelpDocCommentIs("exported function");
|
||||
goTo.marker('8q');
|
||||
verify.quickInfoIs("(): number", "exported function", "extMod.m1.fooExport", "function");
|
||||
verify.quickInfoIs("(function) extMod.m1.fooExport(): number", "exported function");
|
||||
|
||||
goTo.marker('9');
|
||||
verify.quickInfoIs("extMod.m1.m2.c", "", "newVar", "var");
|
||||
verify.quickInfoIs("(var) newVar: extMod.m1.m2.c", "");
|
||||
|
||||
goTo.marker('10');
|
||||
verify.memberListContains("c", undefined, "class comment;", "extMod.m1.m2.c", "class");
|
||||
verify.memberListContains("i", "extMod.m1.m2.c", "i", "extMod.m1.m2.i", "var");
|
||||
verify.memberListContains("c", "class extMod.m1.m2.c", "class comment;");
|
||||
verify.memberListContains("i", "(var) extMod.m1.m2.i: extMod.m1.m2.c", "i");
|
||||
@ -1,95 +0,0 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
// @Filename: commentsExternalModules_file0.ts
|
||||
/////** Module comment*/
|
||||
////export module m/*1*/1 {
|
||||
//// /** b's comment*/
|
||||
//// export var b: number;
|
||||
//// /** foo's comment*/
|
||||
//// function foo() {
|
||||
//// return /*2*/b;
|
||||
//// }
|
||||
//// /** m2 comments*/
|
||||
//// export module m2 {
|
||||
//// /** class comment;*/
|
||||
//// export class c {
|
||||
//// };
|
||||
//// /** i*/
|
||||
//// export var i = new c();
|
||||
//// }
|
||||
//// /** exported function*/
|
||||
//// export function fooExport() {
|
||||
//// return f/*3q*/oo(/*3*/);
|
||||
//// }
|
||||
////}
|
||||
/////*4*/m1./*5*/fooEx/*6q*/port(/*6*/);
|
||||
////var my/*7*/var = new m1.m2./*8*/c();
|
||||
|
||||
// @Filename: commentsExternalModules_file1.ts
|
||||
/////**This is on import declaration*/
|
||||
////import ex/*9*/tMod = require("commentsExternalModules_file0");
|
||||
/////*10*/extMod./*11*/m1./*12*/fooExp/*13q*/ort(/*13*/);
|
||||
////var new/*14*/Var = new extMod.m1.m2./*15*/c();
|
||||
|
||||
// this line triggers a semantic/syntactic error check, remove line when 788570 is fixed
|
||||
edit.insert('');
|
||||
|
||||
goTo.file("commentsExternalModules_file0.ts");
|
||||
goTo.marker('1');
|
||||
verify.quickInfoIs("m1", "Module comment", "m1", "module");
|
||||
|
||||
goTo.marker('2');
|
||||
verify.completionListContains("b", "number", "b's comment", "m1.b", "var");
|
||||
verify.completionListContains("foo", "(): number", "foo's comment", "foo", "function");
|
||||
|
||||
goTo.marker('3');
|
||||
verify.currentSignatureHelpDocCommentIs("foo's comment");
|
||||
goTo.marker('3q');
|
||||
verify.quickInfoIs("(): number", "foo's comment", "foo", "function");
|
||||
|
||||
goTo.marker('4');
|
||||
verify.completionListContains("m1", "m1", "Module comment", "m1", "module");
|
||||
|
||||
goTo.marker('5');
|
||||
verify.memberListContains("b", "number", "b's comment", "m1.b", "var");
|
||||
verify.memberListContains("fooExport", "(): number", "exported function", "m1.fooExport", "function");
|
||||
verify.memberListContains("m2", "m1.m2");
|
||||
|
||||
goTo.marker('6');
|
||||
verify.currentSignatureHelpDocCommentIs("exported function");
|
||||
goTo.marker('6q');
|
||||
verify.quickInfoIs("(): number", "exported function", "m1.fooExport", "function");
|
||||
|
||||
goTo.marker('7');
|
||||
verify.quickInfoIs("m1.m2.c", "", "myvar", "var");
|
||||
|
||||
goTo.marker('8');
|
||||
verify.memberListContains("c", undefined, "class comment;", "m1.m2.c", "class");
|
||||
verify.memberListContains("i", "m1.m2.c", "i", "m1.m2.i", "var");
|
||||
|
||||
goTo.file("commentsExternalModules_file1.ts");
|
||||
goTo.marker('9');
|
||||
verify.quickInfoIs(undefined, "This is on import declaration", "extMod", "module");
|
||||
|
||||
goTo.marker('10');
|
||||
verify.completionListContains("extMod", "extMod", "This is on import declaration", "extMod", "module");
|
||||
|
||||
goTo.marker('11');
|
||||
verify.memberListContains("m1", "extMod.m1");
|
||||
|
||||
goTo.marker('12');
|
||||
verify.memberListContains("b", "number", "b's comment", "extMod.m1.b", "var");
|
||||
verify.memberListContains("fooExport", "(): number", "exported function", "extMod.m1.fooExport", "function");
|
||||
verify.memberListContains("m2", "extMod.m1.m2");
|
||||
|
||||
goTo.marker('13');
|
||||
verify.currentSignatureHelpDocCommentIs("exported function");
|
||||
goTo.marker('13q');
|
||||
verify.quickInfoIs("(): number", "exported function", "extMod.m1.fooExport", "function");
|
||||
|
||||
goTo.marker('14');
|
||||
verify.quickInfoIs("extMod.m1.m2.c", "", "newVar", "var");
|
||||
|
||||
goTo.marker('15');
|
||||
verify.memberListContains("c", undefined, "class comment;", "extMod.m1.m2.c", "class");
|
||||
verify.memberListContains("i", "extMod.m1.m2.c", "i", "extMod.m1.m2.i", "var");
|
||||
Loading…
x
Reference in New Issue
Block a user