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

Code fixes for syntax errors #25201

Closed
ghost opened this issue Jun 25, 2018 · 5 comments · Fixed by #33879
Closed

Code fixes for syntax errors #25201

ghost opened this issue Jun 25, 2018 · 5 comments · Fixed by #33879
Labels
Domain: Quick Fixes Editor-provided fixes, often called code actions. Good First Issue Well scoped, documented and has the green light Help Wanted You can do this Suggestion An idea for TypeScript
Milestone

Comments

@ghost
Copy link

ghost commented Jun 25, 2018

TypeScript Version: 3.0.0-dev.20180623

Code

const o = { a: 1; b: 2 };

Expected behavior:

Get a quick fix to replace ; with ,.

Actual behavior:

No fix. Similar for { a: 1 b: 2 }.

@ghost ghost added Suggestion An idea for TypeScript Domain: Quick Fixes Editor-provided fixes, often called code actions. labels Jun 25, 2018
@mhegazy
Copy link
Contributor

mhegazy commented Jun 25, 2018

The problem with these is that we will have to add parsing support for these patterns to be able to fix them. so there is a limited set of patterns that we can support.

That said, we should be able to support he missing , errors listed above.

@mhegazy mhegazy added this to the Community milestone Jun 25, 2018
@mhegazy mhegazy added Help Wanted You can do this Good First Issue Well scoped, documented and has the green light labels Jun 25, 2018
@akoserwal
Copy link

@mhegazy: I would like to work on this issue. Please, can you help me with some starting pointers?

@MEXdave1997
Copy link

MEXdave1997 commented Sep 27, 2018

@akoserwal are you still working on this? I wouldn't mind helping out in finding this out.

EDIT: Also, I would suspect that you can find something in the parser file in src/compiler/parser.ts

@ghost
Copy link
Author

ghost commented Oct 1, 2018

Code fixes go in the codefixes folder -- don't think changes to the parser will be needed for this as long as the diagnostic it produces is usable for a code fix.
See fixForgottenThisPropertyAccess.ts for a simple example.

@adeniszczyc
Copy link
Contributor

Going to take a look at continuing the work of @akoserwal on this issue now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Domain: Quick Fixes Editor-provided fixes, often called code actions. Good First Issue Well scoped, documented and has the green light Help Wanted You can do this Suggestion An idea for TypeScript
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants