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

Quick Fix support #6943

Closed
angelozerr opened this issue Feb 6, 2016 · 17 comments
Closed

Quick Fix support #6943

angelozerr opened this issue Feb 6, 2016 · 17 comments
Assignees
Labels
API Relates to the public API for TypeScript Domain: Quick Fixes Editor-provided fixes, often called code actions. Fixed A PR has been merged for this issue Suggestion An idea for TypeScript

Comments

@angelozerr
Copy link

It should b every cool if tsserver could support quickfix like https://github.com/TypeStrong/atom-typescript/blob/master/docs/quickfix.md

Quick fix could be returned when geterr is called like ESLint fix does.

@mhegazy
Copy link
Contributor

mhegazy commented Feb 6, 2016

thanks @angelozerr for filing this issue. We actually have Quick Fix support on our roadmap for 2.0; we just did not have an issue to track it, but now we do :)

@mhegazy mhegazy added Suggestion An idea for TypeScript API Relates to the public API for TypeScript In Discussion Not yet reached consensus labels Feb 6, 2016
@angelozerr
Copy link
Author

but now we do :)

Thanks @mhegazy for your answer. I'm very enthousiasm with this cool feature.

@geekdenz
Copy link

This would be a great feature to add! As you can see nbts is waiting for it as well.

kisstkondoros added a commit to kisstkondoros/TypeScript that referenced this issue Jun 24, 2016
Some basic quick fixes has been implemted along with a special
request handler.
- Implement interface; for methods and properties
- Implement abstract class; for methods and properties
- Add import statement (ES6 / AMD)
- Add class method / member
- Type cast to "any"

Related microsoft#6943
@kisstkondoros
Copy link

Hi,

I've worked a bit on @basarat 's implementation and tried to move it into the core.
In kisstkondoros@0c414a5 one can find the initial implementation.

Any thoughts?

@paulvanbrenk
Copy link
Contributor

@kisstkondoros Thanks for that, it shows there is certainly demand for this feature. I see a couple of issues with integrating with VS (and possibly VSCode), e.g. you can't depend on the error message, since we ship in 14 languages. Can you take a look at my PR, #9304, and if you have suggestions to make the API more useful that's very much appreciated. Note, I didn't do any work yet to integrate this with tsserver yet, I need to discuss that with the VS Code team first.

@kisstkondoros
Copy link

@paulvanbrenk Yes I also thought it is not the best practice to get the context information from an error message 😄 perhaps extending the Diagnostic class with some context information could help for the more complicated use cases, e.g. adding missing methods / members to a class.
For me it seems that adding those could be done quite easily in core.ts.

@vvakame
Copy link
Contributor

vvakame commented Nov 10, 2016

Is this issue done by #10185 ?

@paulvanbrenk
Copy link
Contributor

Yes, this is completed with #10185

@mhegazy mhegazy modified the milestones: Community, TypeScript 2.1.3 Nov 10, 2016
@mhegazy mhegazy added Fixed A PR has been merged for this issue and removed In Discussion Not yet reached consensus labels Nov 10, 2016
@olmobrutall
Copy link

Great work! Adding imports will be really awesome.

BTW: Any plans to allow library-specific quick issues?

@paulvanbrenk
Copy link
Contributor

paulvanbrenk commented Nov 17, 2016

@olmobrutall Not sure what you mean by that.
The current API allows you to register a quickfix to an error... and we'll show all available fixes in the UI for that error. There is no planned work to limit fixes based on imports/libraries that are used in the project.

@olmobrutall
Copy link

I mean an equivalent to C# Code Analyzers. Something like distribuiting codefixes together with .d.ts files.

The compiler will need to somehow load the codefix code at compile time.

Of course it requires TS compiler to do some eval() at some point, on code that may need to explore TS internal (inmutable?) data structures.

@paulvanbrenk
Copy link
Contributor

Ah, thanks.

@DanielRosenwasser DanielRosenwasser added the Domain: Quick Fixes Editor-provided fixes, often called code actions. label Feb 3, 2017
@marcinnajder
Copy link

Sorry for stupid question, how to enable/execute quick fix action inside vs code ? I see no light bulb. Do I have to use tslint ? thanks in advance

@marcinnajder
Copy link

quick fixes don't work on Mac, works on Windows

@mhegazy
Copy link
Contributor

mhegazy commented Feb 22, 2017

Seems like a VSCode specific issue, @mjbvz any ideas?

@mjbvz
Copy link
Contributor

mjbvz commented Feb 22, 2017

@marcinnajder If you are on VSCode 1.10 (current insiders builds) and don't see the expected quick fixes, please open a bug: https://github.com/Microsoft/vscode/issues/new

@marcinnajder
Copy link

works fine on VSCode 1.10, thanks for help!

@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
API Relates to the public API for TypeScript Domain: Quick Fixes Editor-provided fixes, often called code actions. Fixed A PR has been merged for this issue Suggestion An idea for TypeScript
Projects
None yet
Development

No branches or pull requests

10 participants