Open
Description
Suggestion
Support class member snippet completions in JS files
π Search Terms
class member completion
β Viability Checklist
My suggestion meets these guidelines:
- This wouldn't be a breaking change in existing TypeScript/JavaScript code
- This wouldn't change the runtime behavior of existing JavaScript code
- This could be implemented without emitting different JS based on the types of the expressions
- This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, new syntax sugar for JS, etc.)
- This feature would agree with the rest of TypeScript's Design Goals.
β Suggestion
We should have class member snippet completions work in JS files. Currently they only work in TS files.
π Motivating Example
class Base {
/**
* @param {number} a
* @param {number} b
*/
foo(a, b) {
return a + b;
}
}
class Sub extends Base {
| // Suggest `foo(a, b) { }` here, like we do in TS files
}
Considerations
To properly support JS, we would have to consider the many ways in which properties can be added to a class in JS. We also should make sure the completion suggestion has JSDoc when possible.