This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Summary: | Bind "action" to be "pre-save" | ||
---|---|---|---|
Product: | editor | Reporter: | Lukas Hasik <lhasik> |
Component: | Key bindings | Assignee: | David Strupl <dstrupl> |
Status: | RESOLVED DUPLICATE | ||
Severity: | blocker | ||
Priority: | P3 | ||
Version: | 6.x | ||
Hardware: | All | ||
OS: | All | ||
Issue Type: | ENHANCEMENT | Exception Reporter: |
Description
Lukas Hasik
2009-01-08 09:16:33 UTC
Yeah, that sounds cool, but can potentially have zillions of side effects. Are you (QA) going to test that all and each action when marked as 'pre-save' works and causes no other harm? And their combinations? Obviously for many actions marking them as 'pre-save' makes absolutely no sense. Why would somebody want to 'Open Project' when saving files? So this feature should not be allowed just for any action. Maybe we could pick a few that are suitable for running on save, which would greatly limit the test matrix. Just random thoughts. >Are you (QA) going to test that all and each action when marked as 'pre-save' works and causes no other harm? And their combination? -definitely not >Obviously for many actions marking them as 'pre-save' makes absolutely no sense. Why would somebody want to 'Open >Project' when saving files? So this feature should not be allowed just for any action. Maybe we could pick a few that >are suitable for running on save, which would greatly limit the test matrix. Just random thoughts. -I completely agree. I would be more in favor of explicitly stating which actions can be pre/post-save. I don't think it is a good idea we allow user to do anything in the Keymap dialog - imagine the defects saying (roughly): "IDE freezes if I make Save action a post-save"... Formatting, fixing imports/ commit, ... these all make sense to me... But probably not in the Keymap dialog that we have now (I don't know how to fit it there - maybe tabs in the Keymap section?). See also issue 140817 - maybe this is sufficient in the beginning (format+fix imports on Save for Java files)... I brought this up in the NetBeans forum. Thanks to Lukas for logging this I don't think we need to be able to bind /any/ action to the pre-save "event". From my point of view, only actions that "modify" the source code are of interest. I definitely would like to see "remove trailing spaces" there :) > I definitely would like to see "remove trailing spaces" there :)
6.5 does that automatically for lines that were modified by a user (in order not to interfere with VCS too much).
> 6.5 does that automatically for lines that were modified by a user
No it doesn't :(
When you e.g. hit enter to create empy lines, NB will indent according to the previous line (which is fine), but those
lines will have "trailing" spaces.
The same is true when using Copy & Paste. That can also leave trailing spaces in lines that I edited.
So I still need "remove trailing spaces" as a pre-save action ;)
If we go with the action that I would like to see there: - Format - Organize imports - add final to private fields which can be final - remove trailing space - add @Override to methods which override a method - add {} at if, for etc. - remove unnecessary casts. I guess we could find some more :) *** This bug has been marked as a duplicate of bug 140719 *** |