Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support class member snippet completions in JS files #46738

Open
5 tasks done
gabritto opened this issue Nov 8, 2021 · 0 comments
Open
5 tasks done

Support class member snippet completions in JS files #46738

gabritto opened this issue Nov 8, 2021 · 0 comments
Labels
Domain: Completion Lists The issue relates to showing completion lists in an editor Suggestion An idea for TypeScript

Comments

@gabritto
Copy link
Member

gabritto commented Nov 8, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Domain: Completion Lists The issue relates to showing completion lists in an editor Suggestion An idea for TypeScript
Projects
None yet
Development

No branches or pull requests

1 participant