Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove method marked for deletion #966

Merged
merged 1 commit into from
Apr 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@ public void reconcile(IRegion subRegion) {
private void applyFolding(List<FoldingRange> ranges) {
// these are what are passed off to the annotation model to
// actually create and maintain the annotations
final var modifications = new ArrayList<Annotation>(); // not used anymore, can be removed later with the deprecated updateAnnotations method
final var deletions = new ArrayList<FoldingAnnotation>();
final var existing = new ArrayList<FoldingAnnotation>();
final var additions = new HashMap<Annotation, Position>();
Expand All @@ -153,7 +152,7 @@ private void applyFolding(List<FoldingRange> ranges) {
if (ranges != null) {
Collections.sort(ranges, Comparator.comparing(FoldingRange::getEndLine));
for (FoldingRange foldingRange : ranges) {
updateAnnotation(modifications, deletions, existing, additions, foldingRange.getStartLine(),
updateAnnotation(deletions, existing, additions, foldingRange.getStartLine(),
foldingRange.getEndLine(), FoldingRangeKind.Imports.equals(foldingRange.getKind()));
}
}
Expand All @@ -170,7 +169,7 @@ private void applyFolding(List<FoldingRange> ranges) {
// send the calculated updates to the annotations to the
// annotation model
theProjectionAnnotationModel.modifyAnnotations(deletions.toArray(new Annotation[1]), additions,
modifications.toArray(new Annotation[0]));
new Annotation[0]);
}
}

Expand Down Expand Up @@ -218,8 +217,6 @@ public void projectionEnabled() {
/**
* Update annotations.
*
* @param modifications
* the folding annotations to update.
* @param deletions
* the folding annotations to delete.
* @param existing
Expand All @@ -232,15 +229,15 @@ public void projectionEnabled() {
* the end line number
* @throws BadLocationException
*/
private void updateAnnotation(List<Annotation> modifications, List<FoldingAnnotation> deletions,
private void updateAnnotation(List<FoldingAnnotation> deletions,
List<FoldingAnnotation> existing, Map<Annotation, Position> additions, int line, Integer endLineNumber, boolean collapsedByDefault)
throws BadLocationException {
int startOffset = document.getLineOffset(line);
int endOffset = document.getLineOffset(endLineNumber) + document.getLineLength(endLineNumber);
final var newPos = new Position(startOffset, endOffset - startOffset);
if (!existing.isEmpty()) {
FoldingAnnotation existingAnnotation = existing.remove(existing.size() - 1);
updateAnnotations(existingAnnotation, newPos, modifications, deletions);
updateAnnotations(existingAnnotation, newPos, deletions);
} else {
additions.put(new FoldingAnnotation(collapsedByDefault), newPos);
}
Expand Down Expand Up @@ -276,27 +273,6 @@ protected void updateAnnotations(Annotation existingAnnotation, Position newPos,
}
}

/**
* Update annotations.
*
* @param existingAnnotation
* the existing annotations that need to be updated based on the
* given dirtied IndexRegion
* @param newPos
* the new position that caused the annotations need for updating and
* null otherwise.
* @param modifications
* the list of annotations to be modified - not used anymore, that's why this method is deprecated.
* @param deletions
* the list of annotations to be deleted
* @deprecated use {@link LSPFoldingReconcilingStrategy#updateAnnotations(Annotation, Position, List)}
*/
@Deprecated(since = "0.18.6", forRemoval = true)
protected void updateAnnotations(Annotation existingAnnotation, Position newPos, List<Annotation> modifications,
List<FoldingAnnotation> deletions) {
updateAnnotations(existingAnnotation, newPos, deletions);
}

/**
* <p>
* Searches the given {@link DirtyRegion} for annotations that now have a length
Expand Down