Skip to content

How do I detect in a Theia extension whether a document has been modified and saved? #9041

Answered by vince-fugnitto
tsiyona asked this question in Q&A
Discussion options

You must be logged in to vote

@tsiyona you can listen to the onDidSaveTextDocument event (documents are represented by underlying models):

readonly onDidSaveTextDocument = this.onDidSaveTextDocumentEmitter.event;

From the event you'll have access to the MonacoEditorModel from which you can have special handling for java files as example if that's your use-case.

Replies: 1 comment 9 replies

Comment options

You must be logged in to vote
9 replies
@tsiyona
Comment options

@vince-fugnitto
Comment options

@tsiyona
Comment options

@vince-fugnitto
Comment options

@tsiyona
Comment options

Answer selected by vince-fugnitto
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants