File: commentsExternalModulesFourslash.ts

package info (click to toggle)
node-typescript 4.8.4%2Bds1-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 523,068 kB
  • sloc: javascript: 1,735,777; makefile: 7; sh: 1
file content (108 lines) | stat: -rw-r--r-- 3,809 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
/// <reference path='fourslash.ts' />

// @Filename: commentsExternalModules_file0.ts
/////** Namespace comment*/
////export namespace m/*1*/1 {
////    /** b's comment*/
////    export var b: number;
////    /** foo's comment*/
////    function foo() {
////        return /*2*/b;
////    }
////    /** m2 comments*/
////    export namespace 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();

goTo.file("commentsExternalModules_file0.ts");
verify.quickInfoAt("1", "namespace m1", "Namespace comment");

verify.completions({
    marker: "2",
    includes: [
        { name: "b", text: "var b: number", documentation: "b's comment" },
        { name: "foo", text: "function foo(): number", documentation: "foo's comment" },
    ]
});

verify.signatureHelp({ marker: "3", docComment: "foo's comment" });
verify.quickInfoAt("3q", "function foo(): number", "foo's comment");

verify.completions({
    marker: "4",
    includes: { name: "m1", text: "namespace m1", documentation: "Namespace comment" },
});

verify.completions({
    marker: "5",
    includes: [
        { name: "b", text: "var m1.b: number", documentation: "b's comment" },
        { name: "fooExport", text: "function m1.fooExport(): number", documentation: "exported function" },
        { name: "m2", text: "namespace m1.m2", documentation: "m2 comments" },
    ],
});

verify.signatureHelp({ marker: "6", docComment: "exported function" });
verify.quickInfoAt("6q", "function m1.fooExport(): number", "exported function");

verify.quickInfoAt("7", "var myvar: m1.m2.c");

verify.completions({
    marker: "8",
    includes: [
        { name: "c", text: "constructor m1.m2.c(): m1.m2.c", documentation: "class comment;" },
        { name: "i", text: "var m1.m2.i: m1.m2.c", documentation: "i" },
    ],
});

goTo.file("commentsExternalModules_file1.ts");
verify.quickInfoAt("9", 'import extMod = require("./commentsExternalModules_file0")', "This is on import declaration");

verify.completions(
    {
        marker: "10",
        includes: { name: "extMod", text: 'import extMod = require("./commentsExternalModules_file0")', documentation: "This is on import declaration" },
    },
    {
        marker: "11",
        includes: { name: "m1", text: "namespace extMod.m1", documentation: "Namespace comment" },
    },
    {
        marker: "12",
        includes: [
            { name: "b", text: "var extMod.m1.b: number", documentation: "b's comment" },
            { name: "fooExport", text: "function extMod.m1.fooExport(): number", documentation: "exported function" },
            { name: "m2", text: "namespace extMod.m1.m2", documentation: "m2 comments" },
        ],
    },
);

verify.signatureHelp({ marker: "13", docComment: "exported function" });
verify.quickInfoAt("13q", "function extMod.m1.fooExport(): number", "exported function");

verify.quickInfoAt("14", "var newVar: extMod.m1.m2.c");

verify.completions({
    marker: "15",
    exact: [
        { name: "c", text: "constructor extMod.m1.m2.c(): extMod.m1.m2.c", documentation: "class comment;" },
        { name: "i", text: "var extMod.m1.m2.i: extMod.m1.m2.c", documentation: "i" },
    ],
});