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

Allow "fix all auto-fixable" action to be bound to a key #38

Open
diegovilar opened this issue May 25, 2017 · 12 comments
Open

Allow "fix all auto-fixable" action to be bound to a key #38

diegovilar opened this issue May 25, 2017 · 12 comments

Comments

@diegovilar
Copy link

Please allow us to bind a key to fix all auto-fixable problems in the current file, just like vscode-tslint's tslint.fixAllProblems and vscode-eslint's eslint.executeAutoFix.

@angelozerr
Copy link
Owner

Have you tried 0.9.6?

@diegovilar
Copy link
Author

Not sure. But I installed the latest one available on the npm registry minutes before opening this issue, so.. yes, probably.

I can see the action available on the bulb related to a lint problem in the editor, but I can't find a bindable command for that on VSCode's key bindings interface. I'm not sure how that would be possible either, since the service is not a VSCode extension, btw... But my knowledge is limited regarding ts plugins and VSCode extensions...

@angelozerr
Copy link
Owner

angelozerr commented May 25, 2017

Sorry I have read too quick. It's about VSCode command. @egamma do you think it's possible to do that?

@diegovilar
Copy link
Author

@angelozerr Well, I realize now that I failed to mention that I was talking specifically about the interaction with VSCode. Sorry for that.

Anyways, I don't see how it would be possible for a TypeScript service plugin to register a command on an IDE. The plugin doesn't have a direct relationship with any IDE.

I can think of only two places where it would make sense to place that responsibility:

  • The TypeScript service itself could expose to any consumer (IDE or otherwise) commands registered by its plugins, or, in this case specifically, a generic "fix all auto-fixable problems", and the IDEs could allow such commands to be bound to keys;
  • A VSCode extension for the tslint-language-service that would register such bindable command on the IDE

@egamma
Copy link
Contributor

egamma commented May 26, 2017

@diegovilar the request makes sense and there already is a vscode-tslint (vnext) extension the market place. It bundles the tslint language service with the extension. it would be the right place for vscode specific support as you suggest above. can you please file the issue against this extension.

@egamma
Copy link
Contributor

egamma commented May 26, 2017

@diegovilar
Copy link
Author

@egamma Cool, didn't know there was already a version of the eg2.tslint extension working with tslint-language-service. Nice. I'm filing a new issue there right now.

Thanks, ppl

@maxime1992
Copy link

Hi! I'm also really interested in adding a keyboard shortcut to autofix tslint problems.

Any news?

@acoutts
Copy link

acoutts commented Apr 23, 2019

Hi! I'm also really interested in adding a keyboard shortcut to autofix tslint problems.

Any news?

For the new plugin this is how you can add a key binding as per the github page:

{
  "key": "cmd+k f",
  "command": "editor.action.codeAction",
  "args": {
    "kind": "source.fixAll.tslint",
    "apply": "first"
  }
}

@FanchenBao
Copy link

FanchenBao commented Jan 3, 2020

Or just type Fix all auto-fixable Problems in the command palette. After you've done it once, press "cmd + shift + p" then "f" puts Fix all auto-fixable Problems at the top of the command palette. So for me, "cmd + shift + p" then "f" is the shortcut to auto fix all.

@UPThawatchai
Copy link

You can setting shortcut by press CMD+K typing auto-fixable and select shortcut your like.
shortcut for me CMD+SHIFT+F

@hyfydistro
Copy link

hyfydistro commented Mar 27, 2021

After installing eslint and eslint vscode extensions.... check your VSCode Keyboard Shortcuts. If found this. It plugs semicolons where needed. I haven't used it long, so I'm not sure the extent of its use.

Screenshot_1

NB: mb, I thought I read eslint, but have a go a check if it applies in your editor settings too. 😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants