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

Experiment with trailing comma insertion text for object literal completions #22854

Open
DanielRosenwasser opened this issue Mar 24, 2018 · 1 comment
Labels
Domain: Completion Lists The issue relates to showing completion lists in an editor Needs Proposal This issue needs a plan that clarifies the finer details of how it could be implemented. Suggestion An idea for TypeScript

Comments

@DanielRosenwasser
Copy link
Member

DanielRosenwasser commented Mar 24, 2018

When I'm adding a new property in the middle of an object literal, there's nothing I love more than getting an immediate parse error and then having to add a comma after the body of a nested object literal/method declaration. It'd be nice to see if we can smooth out the experience here. Maybe we can have comma insertion text after these completions (provided the experience doesn't feel annoying).

2d31b568-b367-4b01-b9fa-3a3e190e98b4

@DanielRosenwasser DanielRosenwasser added Domain: Completion Lists The issue relates to showing completion lists in an editor Suggestion An idea for TypeScript labels Mar 24, 2018
@DanielRosenwasser DanielRosenwasser added this to the TypeScript 2.9 milestone Mar 24, 2018
@ghost
Copy link

ghost commented Mar 26, 2018

I think this is blocked by microsoft/vscode#39893, since the comma we add would be on the same line as the completion.
There's also the problem that if you're typing multiple entries in an object literal normaly, you'd get extra commas:

Typing const x = { a: 0, b: 1 }:

  • Start:
    • const x = { |
  • Complete a:
    • const x = { a: |,
  • Type 0:
    • const x = { a: 0|,
  • Type , :
    • const x = { a: 0, |,
  • Complete b:
    • const x = { a: 0, b: |,,
  • Type 1 }:
    • const x = { a: 0, b: 1 }|,,

@mhegazy mhegazy removed this from the TypeScript 2.9 milestone Mar 26, 2018
@weswigham weswigham added Needs Proposal This issue needs a plan that clarifies the finer details of how it could be implemented. In Discussion Not yet reached consensus labels Nov 6, 2018
@RyanCavanaugh RyanCavanaugh unassigned ghost Mar 7, 2019
@RyanCavanaugh RyanCavanaugh removed In Discussion Not yet reached consensus labels Mar 7, 2019
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 Needs Proposal This issue needs a plan that clarifies the finer details of how it could be implemented. Suggestion An idea for TypeScript
Projects
None yet
Development

No branches or pull requests

4 participants