mirror of
https://github.com/sigmasternchen/xtext-core
synced 2025-03-16 08:48:55 +00:00
[466265|formatter] Precondition fails in textReplContext.withReplacer
Signed-off-by: Moritz Eysholdt <moritz.eysholdt@itemis.de>
This commit is contained in:
parent
e101883779
commit
c863953d80
1 changed files with 5 additions and 4 deletions
|
@ -54,19 +54,20 @@ public abstract class AbstractHiddenRegion extends AbstractTextSegment implement
|
|||
result.add(part);
|
||||
} else {
|
||||
int mergedLength = last.getLength() + part.getLength();
|
||||
result.add(new TextSegment(part.getTextRegionAccess(), last.getOffset(), mergedLength));
|
||||
result.set(result.size() - 1, new TextSegment(access, last.getOffset(), mergedLength));
|
||||
}
|
||||
} else if (part instanceof IComment) {
|
||||
if (last == null || last instanceof IComment) {
|
||||
result.add(new TextSegment(part.getTextRegionAccess(), part.getOffset(), 0));
|
||||
result.add(new TextSegment(access, part.getOffset(), 0));
|
||||
}
|
||||
if (includeComments)
|
||||
result.add(part);
|
||||
}
|
||||
last = part;
|
||||
if (!result.isEmpty())
|
||||
last = result.get(result.size() - 1);
|
||||
}
|
||||
if (last instanceof IComment) {
|
||||
result.add(new TextSegment(last.getTextRegionAccess(), last.getOffset() + last.getLength(), 0));
|
||||
result.add(new TextSegment(access, last.getOffset() + last.getLength(), 0));
|
||||
}
|
||||
return ImmutableList.copyOf(result);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue