class C {
constructor() {
new./**/
}
}
Expected: Completion for the target keyword at the /**/ marker.
Actual: No completions.
Ideally, any work here will make it easy to add completion support for import.meta.
Yayy first issue 馃榾馃榾 with some support I would like to tackle this issue
https://github.com/Microsoft/TypeScript/blob/a004571d3ebb7da6a7d0915465829dee9874e495/src/services/completions.ts#L2113
would this be the right place to edit
@DanielRosenwasser
Hey @Gregjarvez, awesome! I would actually look closer into:
In that function, I'd check if node is a meta-property.
Then, if the the meta-property keyword is new, I'd serve up a single completion for the text target.
Tests can be written in tests/cases/fourslash, and you can take inspiration from other completions-related tests.
Pardon me for the questions and many more to come , I am new here
with regards to this statement I'd serve up a single completion for the text target.
what is the text target
Also does this /**/ marker have a special meaning should know about
Thank you :)
I'm saying that when you have the text new. in your file and a user requests completions, you should provide the "target" as one of the suggestion items, because the user intends to write new.target.
Also does this
/**/ markerhave a special meaning should know about
In fourslash tests, we have functionality for emulating the way a user would type code. You type in code preceded by four slashes, and the testing infrastructure interprets that as a file. The testing infrastructure also knows that within those four slashes, /**/ is what's called a "marker comment".
You can then call functions to work with the file, and jump to those markers. For example, here's how I'd write a test for new.target in tests/cases/fourslash/completionsNewTarget.ts
/// <reference path="fourslash.ts" />
////class C {
//// constructor() {
//// if (C === new./**/)
//// }
////}
goTo.marker("");
verify.completionListContains("target");
verify.completionListCount(1);
Most helpful comment
I'm saying that when you have the text
new.in your file and a user requests completions, you should provide the "target" as one of the suggestion items, because the user intends to writenew.target.In fourslash tests, we have functionality for emulating the way a user would type code. You type in code preceded by four slashes, and the testing infrastructure interprets that as a file. The testing infrastructure also knows that within those four slashes,
/**/is what's called a "marker comment".You can then call functions to work with the file, and jump to those markers. For example, here's how I'd write a test for
new.targetintests/cases/fourslash/completionsNewTarget.ts