2017-06-02 01:20:30 +02:00
|
|
|
/// <reference path="fourslash.ts"/>
|
|
|
|
|
|
|
|
// @allowNonTsExtensions: true
|
|
|
|
// @Filename: jsFileJsdocTypedefTagTypeExpressionCompletion3_typedef.js
|
|
|
|
|
|
|
|
//// /**
|
|
|
|
//// * @typedef {{ age: number }} Foo.Namespace.SomeType
|
|
|
|
//// */
|
|
|
|
//// class Foo {
|
|
|
|
//// constructor(value) { this.property1 = "hello"; }
|
|
|
|
//// static method1() {}
|
|
|
|
//// method3() { return 3; }
|
|
|
|
//// /**
|
|
|
|
//// * @param {string} foo A value.
|
|
|
|
//// * @returns {number} Another value
|
2018-10-29 18:03:25 +01:00
|
|
|
//// * @mytag
|
2017-06-02 01:20:30 +02:00
|
|
|
//// */
|
|
|
|
//// method4(foo) { return 3; }
|
|
|
|
//// }
|
|
|
|
//// /**
|
|
|
|
//// * @type { /*type1*/Foo./*typeFooMember*/Namespace./*NamespaceMember*/SomeType }
|
|
|
|
//// */
|
|
|
|
////var x;
|
|
|
|
/////*globalValue*/
|
|
|
|
////x./*valueMemberOfSomeType*/
|
|
|
|
//// /**
|
|
|
|
//// * @type { /*type2*/Foo }
|
|
|
|
//// */
|
|
|
|
////var x1;
|
|
|
|
////x1./*valueMemberOfFooInstance*/;
|
|
|
|
////Foo./*valueMemberOfFoo*/;
|
|
|
|
|
2018-10-29 18:03:25 +01:00
|
|
|
const warnings = (names: ReadonlyArray<string>): ReadonlyArray<FourSlashInterface.ExpectedCompletionEntry> =>
|
2019-05-16 23:46:10 +02:00
|
|
|
names.map(name => ({ name, kind: "warning", sortText: completion.SortText.JavascriptIdentifiers }));
|
2017-06-02 01:20:30 +02:00
|
|
|
|
2018-10-29 18:03:25 +01:00
|
|
|
verify.completions(
|
|
|
|
{
|
|
|
|
marker: ["type1", "type2"],
|
|
|
|
includes: [
|
|
|
|
{ name: "Foo", kind: "class" },
|
|
|
|
...warnings(["Namespace", "SomeType", "x", "x1", "method1", "property1", "method3", "method4", "foo"]),
|
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
marker: "typeFooMember",
|
|
|
|
exact: [
|
2018-10-30 19:56:34 +01:00
|
|
|
{ name: "Namespace", kind: "module", kindModifiers: "export" },
|
2018-10-29 18:03:25 +01:00
|
|
|
...warnings(["Foo", "value", "property1", "method1", "method3", "method4", "foo", "age", "SomeType", "x", "x1"]),
|
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
marker: "NamespaceMember",
|
|
|
|
exact: [
|
|
|
|
{ name: "SomeType", kind: "type" },
|
|
|
|
...warnings(["Foo", "value", "property1", "method1", "method3", "method4", "foo", "age", "Namespace", "x", "x1"]),
|
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
marker: "globalValue",
|
|
|
|
includes: [
|
|
|
|
{ name: "Foo", kind: "class" },
|
|
|
|
{ name: "x", kind: "var" },
|
|
|
|
{ name: "x1", kind: "var" },
|
|
|
|
...warnings(["Namespace", "SomeType", "method1", "property1", "method3", "method4", "foo"]),
|
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
marker: "valueMemberOfSomeType",
|
|
|
|
exact: [
|
|
|
|
{ name: "age", kind: "property" },
|
|
|
|
...warnings(["Foo", "value", "property1", "method1", "method3", "method4", "foo", "Namespace", "SomeType", "x", "x1"]),
|
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
marker: "valueMemberOfFooInstance",
|
|
|
|
exact: [
|
|
|
|
{ name: "property1", kind: "property" },
|
|
|
|
{ name: "method3", kind: "method" },
|
|
|
|
{ name: "method4", kind: "method" },
|
|
|
|
...warnings(["Foo", "value", "method1", "foo", "age", "Namespace", "SomeType", "x", "x1"]),
|
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
marker: "valueMemberOfFoo",
|
|
|
|
exact: [
|
|
|
|
{ name: "prototype", kind: "property" },
|
2018-10-30 19:56:34 +01:00
|
|
|
{ name: "method1", kind: "method", kindModifiers: "static" },
|
2018-10-29 18:03:25 +01:00
|
|
|
...completion.functionMembers,
|
|
|
|
...warnings(["Foo", "value", "property1", "method3", "method4", "foo", "age", "Namespace", "SomeType", "x", "x1"]),
|
|
|
|
],
|
|
|
|
},
|
|
|
|
);
|