2017-06-02 01:20:30 +02:00
|
|
|
/// <reference path="fourslash.ts"/>
|
|
|
|
|
|
|
|
// @allowNonTsExtensions: true
|
|
|
|
// @Filename: jsFileJsdocTypedefTagTypeExpressionCompletion2_typedef.js
|
|
|
|
|
|
|
|
//// class Foo {
|
|
|
|
//// constructor(value: number) { 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 { /*type*/Foo }
|
|
|
|
//// */
|
|
|
|
////var x;
|
|
|
|
/////*globalValue*/
|
|
|
|
////x./*valueMember*/
|
|
|
|
|
2018-10-29 18:03:25 +01:00
|
|
|
function getCompletions(nonWarnings: ReadonlyArray<string>): ReadonlyArray<FourSlashInterface.ExpectedCompletionEntry> {
|
|
|
|
const withKinds: ReadonlyArray<FourSlashInterface.ExpectedCompletionEntryObject> = [
|
|
|
|
{ name: "Foo", kind: "class" },
|
|
|
|
{ name: "x", kind: "var" },
|
|
|
|
{ name: "property1", kind: "property" },
|
|
|
|
{ name: "method3", kind: "method" },
|
|
|
|
{ name: "method4", kind: "method" },
|
2019-05-16 23:46:10 +02:00
|
|
|
{ name: "foo", kind: "warning", sortText: completion.SortText.JavascriptIdentifiers },
|
2018-10-29 18:03:25 +01:00
|
|
|
];
|
|
|
|
for (const name of nonWarnings) ts.Debug.assert(withKinds.some(entry => entry.name === name));
|
2019-05-16 23:46:10 +02:00
|
|
|
return withKinds.map(entry => nonWarnings.includes(entry.name) ? entry : ({ name: entry.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: "type", includes: getCompletions(["Foo"]) },
|
|
|
|
{ marker: "globalValue", includes: getCompletions(["Foo", "x"]) },
|
|
|
|
{ marker: "valueMember", includes: getCompletions(["property1", "method3", "method4", "foo"]) },
|
|
|
|
);
|