Skip to content

Commit f587010

Browse files
committed
Update ModelManagerImpl.java
1 parent 6f6b5e0 commit f587010

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

de.peeeq.wurstscript/src/main/java/de/peeeq/wurstio/languageserver/ModelManagerImpl.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,19 @@ public CompilationUnit replaceCompilationUnitContent(WFile filename, String cont
521521
@Override
522522
public Changes syncCompilationUnit(WFile f) {
523523
WLogger.debug("syncCompilationUnit File " + f);
524-
String contents = bufferManager.getBuffer(f);
524+
String contents;
525+
try {
526+
File file = f.getFile();
527+
if (!file.exists()) {
528+
removeCompilationUnit(f);
529+
return Changes.empty();
530+
}
531+
contents = Files.toString(file, Charsets.UTF_8);
532+
bufferManager.updateFile(WFile.create(file), contents);
533+
} catch (IOException e) {
534+
WLogger.severe(e);
535+
throw new ModelManagerException(e);
536+
}
525537
int newHash = contentHash(contents);
526538
Integer oldHash = fileHashcodes.get(f);
527539
CompilationUnit existing = getCompilationUnit(f);

0 commit comments

Comments
 (0)