Skip to content

Commit

Permalink
Prevent failure of DocumentContentSynchronizer.<init> if the document
Browse files Browse the repository at this point in the history
does not have an URI registered in EFS and it is not a file uri.

Also improve the existing log to include the URI that we are failing to
deal with.
  • Loading branch information
rubenporras committed Oct 6, 2023
1 parent cf3d644 commit 3afc551
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,12 @@ public DocumentContentSynchronizer(@NonNull LanguageServerWrapper languageServer
IFileStore store = EFS.getStore(fileUri);
this.openSaveStamp = store.fetchInfo().getLastModified();
} catch (CoreException e) {
LanguageServerPlugin.logError(e);
this.openSaveStamp = new File(fileUri).lastModified();
try {
this.openSaveStamp = new File(fileUri).lastModified();
} catch (IllegalArgumentException iae) {
LanguageServerPlugin.logWarning("Error getting the last modification for " + fileUri, e); //$NON-NLS-1$
this.openSaveStamp = 0L;
}
}
this.syncKind = syncKind != null ? syncKind : TextDocumentSyncKind.Full;

Expand Down

0 comments on commit 3afc551

Please sign in to comment.