Editor diff functionality for custom file system
Need to provide diff functionality to my custom file system.
I have a database file system, providing source code for editing in a standard text editor. Changes in the editor are not automatically stored by the file system, user needs to deliberately save the changes.
Until save is performed, i want to be able to display the changes in the editor gutter against the original version from the database, and of course provide both diff and conflict functionality for these files.
Is there any way to achieve this without implementing a custom vcs? If not, how do i bind this vcs to my custom vfs?
I appreciate any hint.
Please sign in to leave a comment.
Hello Dan,
This is not currently possible. The line status marker display is indeed
based on the information received from a VCS, and only files in the local
file system can be associated with a VCS.
You can reimplement all this functionality by yourself, though. Line status
markers are regular RangeHighlighter objects added through the editor MarkupModel
API, and you can add such markers too through the editor API.
--
Dmitry Jemerov
Software Developer
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"
Thank you Dmitry,
think i've got the point.
Still have two more questions on this:
1. Is there an openapi utility to identify differences (e.g. start/end offsets) between two editable contents (byte[] or similar)? That would be of great help for using the MarkupModel.
2. Is the "Conflict" functionality also bound to the VCS environment or I can use it to implement sort of a team coding helper? (e.g. solving conflicts in case of asynchronous updates on database objects).
Thanks for your support,
Dan
Hello Dan,
There's a number of utility classes you can use in com.intellij.util.diff
package (the source is available in the plugin development kit).
If by "conflict" functionality you mean the visual merge UI, you can invoke
visual merge for any content provided by you through the MergeRequest API.
--
Dmitry Jemerov
Software Developer
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"
Great! This is exactly what i need.
Thanks a lot!
Dan