Skip to content

Commit

Permalink
fix unrelated bug
Browse files Browse the repository at this point in the history
  • Loading branch information
mmews committed Jan 3, 2024
1 parent 38746ee commit bc4affa
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.n4js.utils.URIUtils;
import org.eclipse.n4js.xtext.ide.server.QueuedExecutorService;
import org.eclipse.n4js.xtext.ide.server.build.XIndexer.XResolvedResourceDescription;
import org.eclipse.n4js.xtext.workspace.ProjectConfigSnapshot;
import org.eclipse.xtext.build.Source2GeneratedMapping;
import org.eclipse.xtext.diagnostics.Severity;
Expand Down Expand Up @@ -209,6 +210,8 @@ private void writeResourceDescriptions(ImmutableProjectState state, URI baseURI,
for (IResourceDescription description : descriptions) {
if (description instanceof SerializableResourceDescription) {
writeResourceDescription((SerializableResourceDescription) description, baseURI, output);
} else if (description instanceof XResolvedResourceDescription) {
// ignore
} else {
throw new IOException("Unexpected type: " + description.getClass().getName());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -309,12 +309,13 @@ protected IResourceDescription.Delta addToIndex(LoadResult loadResult, boolean i
IResourceDescription.Manager manager = serviceProvider.getResourceDescriptionManager();

Resource resource = loadResult.resource;
IResourceDescription oldDescription = oldIndex != null ? oldIndex.getResourceDescription(uri) : null;
if (resource == null) {
// loading of resource failed
if (loadResult.isFileNotFound()) {
// a source file was renamed/deleted and we did not get a 'didChangeWatchedFiles' notification
// OR the rename/delete happened while the build was in progress
IResourceDescription oldDesc = oldIndex != null ? oldIndex.getResourceDescription(uri) : null;
IResourceDescription oldDesc = oldDescription;
return oldDesc != null ? manager.createDelta(oldDesc, null) : null;
}
Throwables.throwIfUnchecked(loadResult.throwable);
Expand All @@ -328,8 +329,7 @@ protected IResourceDescription.Delta addToIndex(LoadResult loadResult, boolean i

IResourceDescription newDescription = manager.getResourceDescription(resource);
IResourceDescription toBeAdded = new XIndexer.XResolvedResourceDescription(newDescription);
IResourceDescription.Delta delta = manager
.createDelta(oldIndex != null ? oldIndex.getResourceDescription(uri) : null, toBeAdded);
IResourceDescription.Delta delta = manager.createDelta(oldDescription, toBeAdded);
return delta;
}

Expand Down

0 comments on commit bc4affa

Please sign in to comment.