Skip to content

Commit ace5d5e

Browse files
authored
Merge pull request #73 from xdev-software/develop
Release
2 parents 8ed3062 + 740f1f1 commit ace5d5e

9 files changed

+149
-223
lines changed

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
1+
## 1.1.1
2+
* Shortened plugin name - new name: "Save Actions X"
3+
* Updated assets
4+
15
## 1.1.0
26
* Removed "Remove unused suppress warning annotation"
37
* This option never worked #64
4-
* Allows usage of the plugin with IntelliJ Idea 2024+ #63
8+
* Allows usage of the plugin with IntelliJ IDEA 2024+ #63
59
* If you used this option you should remove the line ``<option value="suppressAnnotation" />`` inside ``saveactions_settings.xml``
610
* Allow compilation with Java 21
711

README.md

Lines changed: 8 additions & 153 deletions
Large diffs are not rendered by default.

USAGE.md

Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
## Usage
2+
3+
The plugin can trigger automatically or manually on IDE actions (standard actions) or plugin actions. Most actions needs to be enabled individually (see [activation](#activation)).
4+
5+
### IDE actions
6+
7+
The plugin will trigger automatically on any of these IDE actions (needs to be activated with "Activate save actions on file save" in [activation](#activation)):
8+
9+
- **Frame deactivation**, which is when the editor loses focus, configured in "File > Settings > Appearance & Behavior > System Settings > Save files on frame deactivation" .
10+
- **Application idle**, which is when the IDE isn't used for a period of time, configured in "File > Settings > Appearance & Behavior > System Settings > Save files automatically if application is idle for x sec".
11+
- **Save All**, which is bound by default to "CTRL + S". Some IDE might use "CTRL + S" for the single **Save Document** action, on which the plugin will NOT trigger. This is by design, see issue [#222](https://github.com/dubreuia/intellij-plugin-save-actions/issues/222).
12+
13+
### Plugin actions
14+
15+
The plugin actions are grouped under the menu "Code > Save Actions". You can associate a keymap to any action in "Settings > Keymap > Search 'save actions'".
16+
17+
- **Enable Save Actions (default: not binded)** will activate or deactivate the plugin by changing the configuration.
18+
- **Execute Save Actions on shortcut (default: "CTRL + SHIFT + S")** will trigger the plugin manually (needs to be activated with "Activate save actions on shortcut" in [activation](#activation)).
19+
- **Execute Save Actions on multiple files (default: not binded)** will show a popup to select the files (or a scope) on which to trigger the plugin (needs to be activated with "Activate save actions on batch" in [activation](#activation)).
20+
21+
## Configuration
22+
23+
The configurations are located in "File > Settings > Other Settings > Save Actions".
24+
25+
### Activation
26+
27+
You can quickly toggle the plugin activation by using the "Enable Save Action" action. Use "CTRL + SHIFT + A" then search for it. It will also show if it is currently activated or not.
28+
29+
| Name | Description
30+
| --- | ---
31+
| Activate save actions on file save | Enable / disable the plugin on file save. Before saving each file, it will perform the configured actions below
32+
| Activate save actions on shortcut | Enable / disable the plugin on shortcut, by default "CTRL + SHIFT + S" (configured in "File > Keymaps > Main menu > Code > Save Actions")
33+
| Activate save actions on batch | Enable / disable the plugin on batch, by using "Code > Save Actions > Execute on multiple files"
34+
| No action if compile errors | Enable / disable no action if there are compile errors. Applied to each file individually
35+
36+
### Global
37+
38+
| Name | Description
39+
| --- | ---
40+
| Optimize imports | Enable / disable import organization (configured in "File > Settings > Code Style > Java > Imports")
41+
| Reformat file | Enable / disable formatting (configured in "File > Settings > Code Style"). See "Reformat only changed code" for more options
42+
| Reformat only changed lines | Enable / disable formatting for only changed lines, which will work only if a VCS is configured
43+
| Rearrange fields and methods | Enable / disable re-ordering of fields and methods (configured in "File > Settings > Code Style > Java > Arrangement")
44+
45+
### Build
46+
47+
| Name | Description
48+
| --- | ---
49+
| *\[experimental\]* Compile file | Enable / disable compiling of the modified file. The compiler might compile other files as well. **Warning: this feature is experimental, please post feedback in the github issues**
50+
| *\[experimental\]* Reload file | Enable / disable reloading of the files in the running debugger, meaning the files will get compiled first. The compiler might compile other files as well. **Warning: this feature is experimental, please post feedback in the github issues**
51+
| *\[experimental\]* Execute action | Enable / disable executing of an action using quick lists (using quick lists at "File > Settings > Appearance & Behavior > Quick Lists"). See [Editor Actions](#editor-actions) for more information **Warning: this feature is experimental, please post feedback in the github issues**
52+
53+
#### Editor Actions
54+
55+
Some languages requires specific actions, such as Dartfmt or Prettier:
56+
57+
- For Dart developers, enable "Use the dartfmt tool when formatting the whole file" option in "File > Settings > Editor > Code Style > Dart > Dartfmt".
58+
- For [Prettier](https://prettier.io/) users, read below.
59+
60+
Using the "Execute action" configuration, the plugin can launch arbitrary editor actions. While not all actions will work, it can be used to launch external tools, specific runs, etc. This feature is experimental, you can post your feedback on issue [#118](https://github.com/dubreuia/intellij-plugin-save-actions/issues/118).
61+
62+
The actions are implemented in the form of "quick lists", an IDE function that is used to define a list of actions that can be then executed. Quick lists can be configured at "File > Settings > Appearance & Behavior > Quick Lists", and once configured, one can be selected and used in the plugin, using the "Execution action" configuration drop down list.
63+
64+
### File
65+
66+
| Name | Description
67+
| --- | ---
68+
| 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`.
69+
| 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`
70+
| Use external Eclipse configuration | Add external configuration file ".epf" to read settings from. This will update the current settings and use only the ".epf" file content. Use "reset" button to remove
71+
72+
### Java fixes
73+
74+
If a quick fix adds something that is removed by another quick fix, the removal wins.
75+
76+
| Name | Description
77+
| --- | ---
78+
| Add final modifier to field | The field `private int field = 0` becomes `private final int field = 0`
79+
| Add final modifier to local variable or parameter | The local variable `int variable = 0` becomes `final int variable = 0`
80+
| Add final modifier to local variable or parameter except if implicit | The local variable `int variable = 0` becomes `final int variable = 0`, but not if it is implicit like in try with resources `try (Resource r = new Resource())`
81+
| Add static modifier to methods | The method `private void method()` becomes `private static void method()` if the content does not references instance fields
82+
| Add this to field access | The access to instance field `field = 0` becomes `this.field = 0`
83+
| Add this to method access | The access to instance method `method()` becomes `this.method()`
84+
| Add class qualifier to static member access | The access to class field `FIELD = 0` becomes `Class.FIELD` for a class named Class. Exclusive with "Add class qualifier to static member access outside declaring class only".
85+
| Add class qualifier to static member access outside declaring class only | The access to class field `FIELD = 0` becomes `Class.FIELD` for a class named class, but only if the static member is outside declaring class. Exclusive with "Add class qualifier to static member access".
86+
| Add missing @Override annotations | The method `void method()` becomes `@Override void method()` if it overrides a method from the parent class
87+
| Add blocks to if/while/for statements | The statement `if (true) return false` becomes `if (true) { return false; }` (a block), also working for `for` and `while` statements
88+
| Add missing serialVersionUID field for Serializable classes | The class `class Class implements Serializable` will get a new field `private static final long serialVersionUID` with generated serial version uid
89+
| Remove unnecessary this to field and method | The access to instance field `this.field = 0` becomes `field = 0`, also working for methods
90+
| Remove final from private method | The method `private final void method()` becomes `private void method()`
91+
| Remove unnecessary final to local variable or parameter | The local variable `int final variable = 0` becomes `int variable = 0`
92+
| Remove explicit generic type for diamond | The list creation `List<String> list = new ArrayList<String>()` becomes `List<String> list = new ArrayList<>()`
93+
| Remove unnecessary semicolon | The statement `int variable = 0;;` becomes `int variable = 0;`
94+
| Remove blocks from if/while/for statements | The statement `if (true) { return false; }` becomes `if (true) return false;`, also working for `for` and `while` statements
95+
| Change visibility of field or method to lower access | The field `public int field = 0` becomes `private int field = 0` if it is not used outside class, also working for methods
96+
97+
## Compatibility
98+
99+
The plugin will be kept compatible with the latest IDEA version.
100+
101+
Support for other JetBrains products should also be automatically available but is not guaranteed.
102+
103+
### Eclipse configuration support
104+
105+
The save-actions plugin supports Eclipse configuration `.epf` files by the [Workspace Mechanic](https://marketplace.eclipse.org/content/workspace-mechanic) Eclipse plugin (Java IDE only). You can specify a path to an Eclipse configuration file in the "Eclipse support" settings section to import it. The plugin will load the content of the file in the plugin configuration, and disable the plugin configuration options (the checkbox will be grayed out). Use the "reset" button to remove the import.
106+
107+
The plugin will stay in sync with your Eclipse configuration file. Not every features are present on either side, but the ones that are in common are supported.
108+
109+
You can find an example of [an Eclipse configuration `.epf` file](src/test/resources/com/dubreuia/model) in the test resources.
110+
111+
```properties
112+
# @title Save Actions
113+
# @description Save Actions
114+
# @task_type LASTMOD
115+
file_export_version=3.0
116+
/instance/org.eclipse.jdt.ui/editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
117+
/instance/org.eclipse.jdt.ui/sp_cleanup.format_source_code=true
118+
/instance/org.eclipse.jdt.ui/sp_cleanup.format_source_code_changes_only=false
119+
/instance/org.eclipse.jdt.ui/sp_cleanup.organize_imports=true
120+
/instance/org.eclipse.jdt.ui/sp_cleanup.remove_trailing_whitespaces=true
121+
...
122+
```
123+
124+
### Other plugin compatibility
125+
126+
Some things to note when using other plugins with the Save Actions plugin:
127+
128+
- [IdeaVim](https://plugins.jetbrains.com/plugin/164-ideavim): Since the Save Actions plugin do not trigger on the "Save Document" action (see [usage](#usage)), using `:w` to save in IdeaVim won't trigger the plugin, but using `:wa` will, since it calls the "Save All" action. See issue [#222](https://github.com/dubreuia/intellij-plugin-save-actions/issues/222)).
129+
- [detekt](https://plugins.jetbrains.com/plugin/10761-detekt): Using the detekt plugin breaks the Save Actions plugin, see issue [#270](https://github.com/dubreuia/intellij-plugin-save-actions/issues/270).
130+
131+
## Files location
132+
133+
- **idea.log**: The log file the save actions plugin writes in. It contains debug information, prefixed with `software.xdev.saveactions.SaveActionManager`. If you are using default locations, it would be in `~/.IntelliJIdeaVERSION/system/log/idea.log`.
134+
- **saveactions_settings.xml**: The settings file is saved by project in the `.idea` folder. That file can be committed 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`

assets/icon-intellij-idea.svg

Lines changed: 0 additions & 67 deletions
This file was deleted.
Binary file not shown.
-233 KB
Loading
-113 KB
Loading

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# IntelliJ Platform Artifacts Repositories -> https://plugins.jetbrains.com/docs/intellij/intellij-artifacts.html
22
pluginGroup=software.xdev.saveactions
3-
pluginName=Save Actions - XDEV Edition
3+
pluginName=Save Actions X
44
# SemVer format -> https://semver.org
55
pluginVersion=1.1.1-SNAPSHOT
66
# IntelliJ Platform Properties -> https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html#configuration-intellij-extension

src/main/resources/META-INF/plugin.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<idea-plugin>
44
<id>software.xdev.saveactions</id>
5-
<name>Save Actions - XDEV Edition</name>
5+
<name>Save Actions X</name>
66
<vendor url="https://www.github.com/xdev-software">xdev-software</vendor>
77

88
<description><![CDATA[

0 commit comments

Comments
 (0)