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.

Bug 235838 - [Commit Message Window] code completion for previous commit messages
Summary: [Commit Message Window] code completion for previous commit messages
Status: NEW
Alias: None
Product: versioncontrol
Classification: Unclassified
Component: Git (show other bugs)
Version: 7.4
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: Ondrej Vrabec
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-09-11 18:32 UTC by markiewb
Modified: 2015-03-03 07:28 UTC (History)
1 user (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments
Patch draft for module git (12.60 KB, patch)
2013-11-24 18:47 UTC, markiewb
Details | Diff
Patch draft for module versioning.util (6.41 KB, patch)
2013-11-24 18:49 UTC, markiewb
Details | Diff
Patch draft in action (42.26 KB, image/png)
2013-11-24 18:53 UTC, markiewb
Details

Note You need to log in before you can comment on or make changes to this bug.
Description markiewb 2013-09-11 18:32:02 UTC
ACTUAL: previous commit messages can be accessed by clicking at a button and selecting a message in a separate dialog. This isn't very keyboard-friendly.

EXPECTED: support code completion for previous commit messages in the commit message window.

Show the last 7 or 10 messages (ordered by the most recent one) and also a "more messages..." entry which opens the old dialog (for the people who liked that)

For example:
* My most recent message 3
* My recent message 2
* My old message 1
* More previous messages...

Trim the message within the CC entry to f.e. 100 chars and while an entry is selected/hovered show the full message in a tooltip/popup window (including linebreaks). This is because several previous commit messages may only differ by their content at line > 1.

USECASE: the commit dialog has been opened by an action/shortcut, the commit message dialog has the focus, the user can instantly press CTRL-SPACE to regain the previous commit

See the screenshot for the current state in NB 7.4
Comment 1 markiewb 2013-11-24 18:47:56 UTC
Created attachment 142518 [details]
Patch draft for module git
Comment 2 markiewb 2013-11-24 18:49:15 UTC
Created attachment 142519 [details]
Patch draft for module versioning.util
Comment 3 markiewb 2013-11-24 18:53:02 UTC
Created attachment 142520 [details]
Patch draft in action

@Ondrej: Here some patch draft to implement this feature. I will continue working on it. Or is it too late for NB8.0?

Nevertheless:
* What would be the best way to provide input from the dialog context to the completionprovider? In the patch I am "misusing" JEditorPane.putClientProperty
Comment 4 markiewb 2013-11-24 18:59:53 UTC
Some more questions:

* I guess it would be beneficial to introduce a new mime-type like "text/vcs-commitmsg". But I never did such thing before...
* Why is there a special UndoRedoManager used? Doesn't the widget provide a standard implementation?
* The completionprovider has to be moved into versioning.util too, so that SVN/HG and CVS can participate too...
Comment 5 Ondrej Vrabec 2013-11-25 09:02:48 UTC
> I will continue working on it. Or is it too late for NB8.0?
Unfortunately, because we are already feature-frozen for NB 8.0, it will have to wait for the next release.
> What would be the best way to provide input from the dialog context to the completionprovider? In the patch I am "misusing" JEditorPane.putClientProperty
seems git commit window just extracts recent messages from preferences, see return getRecentCommitMessages(getPreferences()) in GitCommitParameters. So you could turn it into a call to a singleton class, e.g. VCSCommitMessages.getInstance().getRecentMessages(Preferences pref); However you would still need to keep a clientProperty saying what version control system this text component marks. But at least you would not have to keep all messages in memory. Instead just put JEditorPane.putClientProperty(GitModuleConfig.class) and then acquire the pref on demand using NbPreferences.forModule(GitModuleConfig.class). But as i dig deeper into the code it looks the messages are kept in mem even now, so i guess any optimization is pointless. If you want to get rid of the client property completely then i guess you have to register every editor component in a singleton git registry class upon opening the dialog and unregister it upon its close. Then you can query it directly with a call similar to: CommitMessageRegistry.getInstance().getRecentMessages(JTextComponent comp);
> I guess it would be beneficial to introduce a new mime-type like "text/vcs-commitmsg". But I never did such thing before...
Nor have i. But i agree it may require a separate mime-type. With your implementation i am not sure if this Completion provider does not clash with other providers for text/plain mime types and does not show for example in the standard editor for plain text files.
> Why is there a special UndoRedoManager used? Doesn't the widget provide a standard implementation?
I think because the default behavior undos/redos just one character at the time, this special UndoManager should work on words also.
> The completionprovider has to be moved into versioning.util too, so that SVN/HG and CVS can participate too...
Sure, it should be,

Looks promising, i have not inspected it in detail so don't know how your change deals with line/word wrapping now (normal editor does not wrap by default, right?) or undo/redo now, but i guess you can fix any problems we find in the process later. Just one note: replace JEditorPane in method signatures with JTextComponent (in versioning,util) so it does not break any implementors.
Comment 6 markiewb 2013-11-25 22:43:50 UTC
(In reply to Ondrej Vrabec from comment #5)
> > I will continue working on it. Or is it too late for NB8.0?
> Unfortunately, because we are already feature-frozen for NB 8.0, it will
> have to wait for the next release.

Thanks Ondrej for the feedback. I will provide new patches within the next week with your proposals included - i hope so.
Comment 7 Ondrej Vrabec 2014-07-15 07:19:30 UTC
let's look at this next release, i'll add my hand.