Is there an API to check if a file opened in the editor was updated in terms of its content

Answered

I need an API to check if a file opened in the editor was changed (since it gets opened) in terms of its content
no matter whether it was saved or not. For example I open file with text a:
If I then type ab it must return true (= updated)
Or if I then type ab + ctrl+z it must return false (even if IDEA has already saved the file).

There is a getModificationStamp() in the VirtualFile, but it is updated only on save as well as Editor.isModified() call.
Is there a simple quick API to achieve that?
2 comments
Comment actions Permalink

See com.intellij.openapi.fileEditor.FileDocumentManager#isFileModified

0
Comment actions Permalink
Thank you for the hint.
Unfortunately it works the same way as the mentioned APIs.
Once opened file is saved after updates it returns false.
Seems like file hashing is the only way to address the issue.
0

Please sign in to leave a comment.