Code Monkey home page Code Monkey logo

quick-fix's Introduction

Build Status

This is a plugin for IntelliJ IDEs which:

  1. Adds Quick Fix action to apply the first available quick fix (equivalent to pressing alt+enter, enter).
    Quick Fix is assigned to F1 so you might need to unassign F1 from the Context Help action.
  2. Registers all available intentions as actions, so you can assign shortcuts to them (see this youtrack issue).
    For example, if you have Java or Kotlin plugin enabled, you can use Help -> Find Action to search for "put arguments" (please remember to include disabled actions into the search). The search results will include "Put arguments on one line (Intention)" line on which you can alt+enter and specify your own shortcut. You can also find the same action in Preferences -> Keymap. Note that there are actually two "Put arguments on one line" intentions one for Java and one for Kotlin. The action will invoke quickfix from the first intention which is available in the current context.

De-Prioritising Intentions

If the order of intentions as they appear in alt+enter popup is not ideal, you can tell Quick Fix to (de)prioritise intentions.
For that, open Search Everywhere and search for Registry.
There will be a key called quickfix-plugin.intentionPriorities which can be configured by setting a value.
Example: *;Introduce import alias;Introduce local variable will push "Introduce import alias" and "Introduce local variable" inspections to the end of QuickFix priority list, so they are less likely to be invoked.

What's wrong with alt+enter?

Pressing alt+enter, enter is too many key presses when you already know that the top inspection is going to do what you want. To solve this problem Quick Fix applies the first available inspection.

Some intentions are used so frequently that pressing alt+enter and choosing the right row in the popup list becomes tedious. It also doesn't help that depending on the context, the intention you're looking for might not be on the same row as it was before. To solve this problem the plugin creates actions for all intentions, so you can assign keyboard shortcuts and invoke intentions without any popup windows. Note that all actions generated by the plugin have "(Intention)" postfix, so you can distinguish them from other actions.

Finally, alt+enter is physically not the easiest shortcut to press, especially if you use it a lot... As an experiment Quick Fix action is assigned to F1 because it's a single key and located near F2 - Next Highlighted Error. You might need though to unassign F1 from the Context Help action which is mostly useless anyway.

What's wrong with Silent Code Cleanup action?

It fixes all problems in the current file. This is often too much. It also only fixes errors/warnings and doesn't apply inspections, e.g. it won't apply Fix typo intention.

quick-fix's People

Contributors

dkandalov avatar p10r avatar

Stargazers

Roman avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.