Giter Site home page Giter Site logo

matthewadams / intellij-plugin-save-actions Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dubreuia/intellij-plugin-save-actions

0.0 2.0 0.0 106 KB

Supports configurable, Eclipse like, save actions, including "organize imports", "reformat code" and "rearrange code".

License: MIT License

Java 100.00%

intellij-plugin-save-actions's Introduction

Intellij Save Actions Plugin

Supports configurable, Eclipse like, save actions, including "organize imports", "reformat code", "rearrange code", "compile file" and some quick fixes like "add / remove 'this' qualifier", etc. The plugin executes the configured actions when the file is synchronised (or saved) on disk.

Features

Code formatting

  • Organize imports
  • Reformat code (only changed text or all)
  • Rearrange code (reorder methods, fields, etc.)

Build

  • Compile file

Quick fixes

  • Add final to local variable
  • Add final to field
  • Remove explicit generic type for diamond
  • Qualify field access with this
  • Remove unused suppress warning annotation
  • Remove final from private method
  • Remove unnecessary semicolon
  • Add missing @Override annotations

Other

  • File inclusion / exclusion with regex support
  • Works on any file type Intellij IDEA can reformat (Java, XML, etc.)
  • Simple option page to activate / deactivate actions

Compatibility

Intellij IDEA Community Edition build 135+

Installation

Install it from the plugin repository in Intellij IDEA (recommended):

  • "File > Settings > Plugins > Browse repositories... > Search 'Save Actions' > Category 'Code tools'"

Or the plugin is available from the Intellij IDEA Community Edition plugin repository and you can also download the jar from there then add it in Intellij IDEA:

  • "File > Settings > Plugins > Install plugin from disk..."

Configuration

The configurations are located in "File > Settings > Other Settings > Save Actions".

Name Description
Activate save actions Enable / disable the plugin
Organize imports Enable / disable import organization (configured in "File > Settings > Code Style > Java > Imports")
Reformat file Enable / disable formatting (configured in "File > Settings > Code Style"). See "Reformat only changed code" for more options
Rearrange fields and methods Enable / disable re-ordering of fields and methods (configured in "File > Settings > Code Style > Java > Arrangement")
Reformat only changed code Enable / disable formatting for changed code only. If VCS is configured, it is used to check which lines where modified. If VCS is not configured, the code will always get reformatted
Compile file Enable / disable compiling of the modified file. The compiler might compile other files as well
File path inclusions Add / remove file path inclusions (by default, everything included). The Java regular expressions match the whole file name from the project root. Include only Java files: .*\.java.
File path exclusions Add / remove file path exclusions to ignore files (overrides inclusions). The Java regular expressions match the whole file name from the project root. Exclude 'Main.java' only in root folder: Main\.java. Exclude file 'Foo.java' only in folder 'src': src/Foo\.java. Exclude all xml files in any folder: .*/.*\.xml

Java quick fixes

Name Description
Add final to local variable Will add the final modifier to any local variable (not parameters or fields)
Add final to field Will add the final modifier to any class fields (not parameters or local variables)
Remove explicit generic type for diamond Will remove unused right side generic types for Java 7 diamond operator. This List<String> list = new ArrayList<String>() becomes List<String> list = new ArrayList<>()
Qualify field access with this Will qualify all field access with this
Remove unused suppress warning annotation Will remove any unused @SuppressWarning annotations
Remove final from private method Will remove final for private method
Remove unnecessary semicolon Will remove unnecessary semicolon
Add missing @Override annotations Will add missing @Override annotations to all inherited methods

Files location

  • idea.log: The log file the save actions plugin writes in. It contains debug information, prefixed with com.dubreuia.SaveActionManager. If you are using default locations, it would be in ~/.IntelliJIdeaVERSION/system/log/idea.log.
  • saveactions_settings.xml: The settings file is saved by project in the .idea folder. That file can be commited in git thus shared in your development team. If you are using the default locations, it would be in ~/IdeaProjects/PROJECT_NAME/.idea/saveactions_settings.xml

Bugs / features

Dat plugin do not work? You want more features? You can ask me on twitter or create an issue on github.

Contributors

Licence

MIT License

intellij-plugin-save-actions's People

Contributors

dubreuia avatar krasa avatar marcosbento avatar markiewb avatar zhujk avatar

Watchers

 avatar  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.