Validate non-saved docs on close

This commit is contained in:
aboyko
2024-11-27 21:27:41 -05:00
committed by Alex Boyko
parent 380dcbb15a
commit f7de35664f
5 changed files with 35 additions and 6 deletions

View File

@@ -190,7 +190,16 @@ public class BootLanguageServerInitializer implements InitializingBean {
TextDocument doc = params.getDocument();
server.validateWith(doc.getId(), reconcileEngine);
});
server.getTextDocumentService().onDidClose(doc -> {
if (doc.hasChangedSinceLastSave()) {
/*
* If doc is changed since last save closing it would ignore the latest changes.
* Therefore the file requires to be validated again.
*/
server.validateWith(doc.getId(), reconcileEngine);
}
});
// ServerUtils.listenToClassFileChanges(server.getWorkspaceService().getFileObserver(), projectFinder, project -> validateAll(components, server, project));
});
config.addListener(evt -> {