Merge pull request #153 from eclipse/me/formatter_improve_indent_api

[formatter] improve indent api
This commit is contained in:
Moritz Eysholdt 2015-04-14 21:45:14 +02:00
commit cddd77f476
13 changed files with 333 additions and 168 deletions

View file

@ -15,11 +15,13 @@ import org.eclipse.xtext.AbstractRule;
import org.eclipse.xtext.Keyword;
import org.eclipse.xtext.RuleCall;
import org.eclipse.xtext.formatting2.internal.CommentReplacer;
import org.eclipse.xtext.formatting2.internal.DoubleHiddenRegionFormatter;
import org.eclipse.xtext.formatting2.internal.HiddenRegionFormatting;
import org.eclipse.xtext.formatting2.internal.HiddenRegionFormattingMerger;
import org.eclipse.xtext.formatting2.internal.HiddenRegionReplacer;
import org.eclipse.xtext.formatting2.internal.MultilineCommentReplacer;
import org.eclipse.xtext.formatting2.internal.RootDocument;
import org.eclipse.xtext.formatting2.internal.SingleHiddenRegionFormatter;
import org.eclipse.xtext.formatting2.internal.SinglelineCodeCommentReplacer;
import org.eclipse.xtext.formatting2.internal.SinglelineDocCommentReplacer;
import org.eclipse.xtext.formatting2.internal.SubDocument;
@ -174,8 +176,8 @@ public abstract class AbstractFormatter2 implements IFormatter2 {
}
/**
* For {@link XtextResource resources}, assume we want to format the first EObject from the contents list only. Because
* that's where the parser puts the semantic model.
* For {@link XtextResource resources}, assume we want to format the first EObject from the contents list only.
* Because that's where the parser puts the semantic model.
*/
protected void _format(XtextResource resource, IFormattableDocument document) {
List<EObject> contents = resource.getContents();
@ -210,6 +212,14 @@ public abstract class AbstractFormatter2 implements IFormatter2 {
return new HiddenRegionFormatting(this);
}
public IHiddenRegionFormatter createHiddenRegionFormatter(IHiddenRegionFormatting formatting) {
return new SingleHiddenRegionFormatter(formatting);
}
public IHiddenRegionFormatter createHiddenRegionFormatter(IHiddenRegionFormatting f1, IHiddenRegionFormatting f2) {
return new DoubleHiddenRegionFormatter(f1, f2);
}
public IMerger<IHiddenRegionFormatting> createHiddenRegionFormattingMerger() {
return new HiddenRegionFormattingMerger(this);
}
@ -233,7 +243,7 @@ public abstract class AbstractFormatter2 implements IFormatter2 {
public ITextReplacer createWhitespaceReplacer(ITextSegment hiddens, IHiddenRegionFormatting formatting) {
return new WhitespaceReplacer(hiddens, formatting);
}
public IFormattableDocument createFormattableRootDocument() {
return new RootDocument(this);
}

View file

@ -7,6 +7,8 @@
*******************************************************************************/
package org.eclipse.xtext.formatting2;
import org.eclipse.xtext.formatting2.regionaccess.ITextSegment;
/**
* A strategy for formatting that is to be applied on auto wrapping.
*
@ -14,9 +16,9 @@ package org.eclipse.xtext.formatting2;
*
* @see IHiddenRegionFormatter#setOnAutowrap(IAutowrapFormatter)
*/
public interface IAutowrapFormatter { // TODO: add region
public interface IAutowrapFormatter {
/**
* Called if the region is supposed to be wrapped.
*/
void format(IHiddenRegionFormatter wrapped, IFormattableDocument document);
void format(ITextSegment region, IHiddenRegionFormatting wrapped, IFormattableDocument document);
}

View file

@ -15,6 +15,7 @@ import org.eclipse.xtext.formatting2.regionaccess.ISemanticRegion;
import org.eclipse.xtext.formatting2.regionaccess.ITextRegionAccess;
import org.eclipse.xtext.formatting2.regionaccess.ITextReplacement;
import org.eclipse.xtext.formatting2.regionaccess.ITextSegment;
import org.eclipse.xtext.xbase.lib.Pair;
import org.eclipse.xtext.xbase.lib.Procedures.Procedure1;
import com.google.common.base.Predicate;
@ -152,4 +153,12 @@ public interface IFormattableDocument {
*/
IHiddenRegion set(IHiddenRegion hiddenRegion, Procedure1<? super IHiddenRegionFormatter> init);
Pair<IHiddenRegion, IHiddenRegion> set(IHiddenRegion first, IHiddenRegion second,
Procedure1<? super IHiddenRegionFormatter> init);
<T1 extends ISemanticRegion, T2 extends ISemanticRegion> //
Pair<T1, T2> interior(T1 first, T2 second, Procedure1<? super IHiddenRegionFormatter> init);
<T1 extends ISemanticRegion, T2 extends ISemanticRegion> //
Pair<T1, T2> interior(Pair<T1, T2> pair, Procedure1<? super IHiddenRegionFormatter> init);
}

View file

@ -8,8 +8,7 @@
package org.eclipse.xtext.formatting2;
/**
* An {@link IHiddenRegionFormatter} is used to build a formatting
* setting for a hidden region.
* An {@link IHiddenRegionFormatter} is used to build a formatting setting for a hidden region.
*
* @see IHiddenRegionFormatting
* @noimplement This interface is not intended to be implemented by clients.
@ -22,29 +21,23 @@ public interface IHiddenRegionFormatter {
final int LOW_PRIORITY = -1;
final int NORMAL_PRIORITY = 0;
/**
* Allows to obtain the configured formatting setting.
*/
IHiddenRegionFormatting asBean();
/**
* Configure autowrap. Same as {@link #autowrap(int) autowrap(0)}.
*/
void autowrap();
/**
* Configure autowrap. The triggerLength allows to shift the wrapping point
* beyond its actual position in the file. If a line has multiple wrapping points
* it will scan backwards for the first autowrapped region. The triggerLength
* Configure autowrap. The triggerLength allows to shift the wrapping point beyond its actual position in the file.
* If a line has multiple wrapping points it will scan backwards for the first autowrapped region. The triggerLength
* moves this region logically such it will be found earlier.
*/
void autowrap(int triggerLength);
/**
* Suppresses auto wrap in this hidden region.
*/
void noAutowrap();
/**
* Callback if autowrapping was applied.
*/
@ -57,6 +50,7 @@ public interface IHiddenRegionFormatter {
/**
* When merging, treat this configuration with a high priority.
*
* @see #lowPriority()
* @see #HIGH_PRIORITY
*/
@ -64,78 +58,52 @@ public interface IHiddenRegionFormatter {
/**
* When merging, treat this configuration with a low priority.
*
* @see #highPriority()
* @see #LOW_PRIORITY
*/
void lowPriority();
/**
* Sets the priority of this formatting configuration. Used when two
* configurations should be merged.
* The priority of this formatter; the default value is {@link #NORMAL_PRIORITY}.
*/
void setPriority(int priority);
/**
* Decrease the indentation by one level.
* Subsequent calls decrease the indentation further.
* @see #setDecreaseIndentation(int)
*/
void decreaseIndentation();
/**
* Increase the indentation by one level.
*/
void increaseIndentation();
/**
* Decreases the indentation by the given number of levels.
* @see #setIncreaseIndentation(int)
*/
void setDecreaseIndentation(int indentation);
/**
* Increases the indentation by the given number of levels.
* Sets the priority of this formatting configuration. Used when two configurations should be merged. The priority
* of this formatter; the default value is {@link #NORMAL_PRIORITY}.
*/
void setIncreaseIndentation(int indentation);
void setPriority(int priority);
/**
* Resets the indentation level to zero.
*/
void noIndentation();
void indent();
/**
* Forces a line break in this hidden region.
* Same as {@link #setNewLines(int) setNewLines(1)}.
* Forces a line break in this hidden region. Same as {@link #setNewLines(int) setNewLines(1)}.
*/
void newLine();
/**
* Forces the number of newlines in this hidden region.
* Same as {@link #setNewLines(int, int, int) setNewLines(nl, nl, nl)}
* Forces the number of newlines in this hidden region. Same as {@link #setNewLines(int, int, int) setNewLines(nl,
* nl, nl)}
*/
void setNewLines(int newLines);
/**
* Configures the given new lines for this hidden region.
* Keeps the current configuration if it is in the valid boundaries
* of {@code minNewLines} and {@code maxNewLines}. Applies {@code defaultNewLines}
* otherwise.
* Configures the given new lines for this hidden region. Keeps the current configuration if it is in the valid
* boundaries of {@code minNewLines} and {@code maxNewLines}. Applies {@code defaultNewLines} otherwise.
*/
void setNewLines(int minNewLines, int defaultNewLines, int maxNewLines);
/**
* Format this hidden region with using no space (zero characters).
* Same as {@link #setSpace(String) setSpace("")}.
* Format this hidden region with using no space (zero characters). Same as {@link #setSpace(String) setSpace("")}.
*/
void noSpace();
/**
* One space is added at this hidden region.
* Same as {@link #setSpace(String) setSpace(" ")}.
* One space is added at this hidden region. Same as {@link #setSpace(String) setSpace(" ")}.
*/
void oneSpace();
/**
* The given space is used for this hidden region.
*/

View file

@ -30,8 +30,6 @@ public interface IHiddenRegionFormatting {
void mergeValuesFrom(IHiddenRegionFormatting other) throws ConflictingFormattingException;
IHiddenRegionFormatter asFormatter();
Integer getAutowrap();
Integer getIndentationDecrease();

View file

@ -0,0 +1,48 @@
/*******************************************************************************
* Copyright (c) 2015 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*******************************************************************************/
package org.eclipse.xtext.formatting2.internal;
import org.eclipse.xtext.formatting2.IHiddenRegionFormatter;
/**
* @author Moritz Eysholdt - Initial contribution and API
* @since 2.9
*/
public abstract class AbstractHiddenRegionFormatter implements IHiddenRegionFormatter {
@Override
public void highPriority() {
setPriority(HIGH_PRIORITY);
}
@Override
public void lowPriority() {
setPriority(LOW_PRIORITY);
}
@Override
public void newLine() {
setNewLines(1);
}
@Override
public void noSpace() {
setSpace("");
}
@Override
public void oneSpace() {
setSpace(" ");
}
@Override
public void setNewLines(int newLines) {
setNewLines(newLines, newLines, newLines);
}
}

View file

@ -0,0 +1,99 @@
/*******************************************************************************
* Copyright (c) 2015 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*******************************************************************************/
package org.eclipse.xtext.formatting2.internal;
import org.eclipse.xtext.formatting2.FormatterRequest;
import org.eclipse.xtext.formatting2.IAutowrapFormatter;
import org.eclipse.xtext.formatting2.IHiddenRegionFormatting;
/**
* @author Moritz Eysholdt - Initial contribution and API
* @since 2.9
*/
public class DoubleHiddenRegionFormatter extends AbstractHiddenRegionFormatter {
private final IHiddenRegionFormatting first;
private final IHiddenRegionFormatting second;
public DoubleHiddenRegionFormatter(IHiddenRegionFormatting first, IHiddenRegionFormatting second) {
super();
this.first = first;
this.second = second;
}
@Override
public void autowrap() {
Integer old1 = first.getAutowrap();
if (old1 == null || old1 < 0)
first.setAutowrap(0);
Integer old2 = second.getAutowrap();
if (old2 == null || old2 < 0)
second.setAutowrap(0);
}
@Override
public void autowrap(int triggerLength) {
first.setAutowrap(triggerLength);
second.setAutowrap(triggerLength);
}
@Override
public FormatterRequest getRequest() {
return first.getRequest();
}
@Override
public void indent() {
Integer inc = first.getIndentationIncrease();
Integer dec = second.getIndentationDecrease();
first.setIndentationIncrease(inc == null ? 1 : inc + 1);
second.setIndentationDecrease(dec == null ? 1 : dec + 1);
}
@Override
public void noAutowrap() {
first.setAutowrap(-1);
second.setAutowrap(-1);
}
@Override
public void noIndentation() {
first.setNoIndentation(true);
second.setNoIndentation(true);
}
@Override
public void setNewLines(int minNewLines, int defaultNewLines, int maxNewLines) {
first.setNewLinesMin(minNewLines);
first.setNewLinesDefault(defaultNewLines);
first.setNewLinesMax(maxNewLines);
second.setNewLinesMin(minNewLines);
second.setNewLinesDefault(defaultNewLines);
second.setNewLinesMax(maxNewLines);
}
@Override
public void setOnAutowrap(IAutowrapFormatter formatter) {
autowrap();
first.setOnAutowrap(formatter);
second.setOnAutowrap(formatter);
}
@Override
public void setPriority(int priority) {
first.setPriority(priority);
second.setPriority(priority);
}
@Override
public void setSpace(String space) {
first.setSpace(space);
second.setSpace(space);
}
}

View file

@ -25,6 +25,7 @@ import org.eclipse.xtext.formatting2.ISubFormatter;
import org.eclipse.xtext.formatting2.ITextReplacer;
import org.eclipse.xtext.formatting2.ITextReplacerContext;
import org.eclipse.xtext.formatting2.debug.TextRegionsToString;
import org.eclipse.xtext.formatting2.regionaccess.IEObjectRegion;
import org.eclipse.xtext.formatting2.regionaccess.IHiddenRegion;
import org.eclipse.xtext.formatting2.regionaccess.ISemanticRegion;
import org.eclipse.xtext.formatting2.regionaccess.ITextRegionAccess;
@ -32,6 +33,7 @@ import org.eclipse.xtext.formatting2.regionaccess.ITextReplacement;
import org.eclipse.xtext.formatting2.regionaccess.ITextSegment;
import org.eclipse.xtext.preferences.ITypedPreferenceValues;
import org.eclipse.xtext.util.Tuples;
import org.eclipse.xtext.xbase.lib.Pair;
import org.eclipse.xtext.xbase.lib.Procedures.Procedure1;
import com.google.common.base.Function;
@ -233,27 +235,65 @@ public abstract class FormattableDocument implements IFormattableDocument {
if (hiddenRegion != null) {
AbstractFormatter2 formatter = getFormatter();
IHiddenRegionFormatting formatting = formatter.createHiddenRegionFormatting();
init.apply(formatting.asFormatter());
init.apply(formatter.createHiddenRegionFormatter(formatting));
ITextReplacer replacer = formatter.createHiddenRegionReplacer(hiddenRegion, formatting);
addReplacer(replacer);
}
return hiddenRegion;
}
@Override
public Pair<IHiddenRegion, IHiddenRegion> set(IHiddenRegion first, IHiddenRegion second,
Procedure1<? super IHiddenRegionFormatter> init) {
if (first != null && second != null) {
AbstractFormatter2 formatter = getFormatter();
IHiddenRegionFormatting f1 = formatter.createHiddenRegionFormatting();
IHiddenRegionFormatting f2 = formatter.createHiddenRegionFormatting();
init.apply(formatter.createHiddenRegionFormatter(f1, f2));
ITextReplacer replacer1 = formatter.createHiddenRegionReplacer(first, f1);
ITextReplacer replacer2 = formatter.createHiddenRegionReplacer(second, f2);
addReplacer(replacer1);
addReplacer(replacer2);
}
return Pair.of(first, second);
}
@Override
public ISemanticRegion surround(ISemanticRegion token, Procedure1<? super IHiddenRegionFormatter> beforeAndAfter) {
prepend(token, beforeAndAfter);
append(token, beforeAndAfter);
if (token != null) {
IHiddenRegion previous = token.getPreviousHiddenRegion();
IHiddenRegion next = token.getNextHiddenRegion();
set(previous, next, beforeAndAfter);
}
return token;
}
@Override
public <T extends EObject> T surround(T owner, Procedure1<? super IHiddenRegionFormatter> beforeAndAfter) {
prepend(owner, beforeAndAfter);
append(owner, beforeAndAfter);
if (owner != null && !owner.eIsProxy()) {
IEObjectRegion region = getTextRegionAccess().regionForEObject(owner);
IHiddenRegion previous = region.getPreviousHiddenRegion();
IHiddenRegion next = region.getNextHiddenRegion();
set(previous, next, beforeAndAfter);
}
return owner;
}
@Override
public <T1 extends ISemanticRegion, T2 extends ISemanticRegion> //
Pair<T1, T2> interior(Pair<T1, T2> pair, Procedure1<? super IHiddenRegionFormatter> init) {
return interior(pair.getKey(), pair.getValue(), init);
}
@Override
public <T1 extends ISemanticRegion, T2 extends ISemanticRegion> //
Pair<T1, T2> interior(T1 first, T2 second, Procedure1<? super IHiddenRegionFormatter> init) {
if (first != null && second != null) {
set(first.getNextHiddenRegion(), second.getPreviousHiddenRegion(), init);
}
return Pair.of(first, second);
}
@Override
public String toString() {
TextRegionsToString toString = new TextRegionsToString();

View file

@ -15,9 +15,7 @@ import org.eclipse.xtext.formatting2.IHiddenRegionFormatter;
import org.eclipse.xtext.formatting2.IHiddenRegionFormatting;
import org.eclipse.xtext.formatting2.debug.HiddenRegionFormattingToString;
import com.google.common.base.Preconditions;
public class HiddenRegionFormatting implements IHiddenRegionFormatter, IHiddenRegionFormatting {
public class HiddenRegionFormatting implements IHiddenRegionFormatting {
private Integer autowrap = null;
private final AbstractFormatter2 formatter;
private Integer indentationDecrease = null;
@ -35,32 +33,6 @@ public class HiddenRegionFormatting implements IHiddenRegionFormatter, IHiddenRe
this.formatter = formatter;
}
@Override
public IHiddenRegionFormatting asBean() {
return this;
}
@Override
public IHiddenRegionFormatter asFormatter() {
return this;
}
@Override
public void autowrap() {
if (this.autowrap == null || this.autowrap < 0)
this.autowrap = 0; // TODO: can newLineMax = 0 suppress autowrap?
}
@Override
public void autowrap(int triggerLength) {
autowrap = triggerLength;
}
@Override
public void decreaseIndentation() {
indentationDecrease = indentationDecrease == null ? 1 : indentationDecrease + 1;
}
@Override
public Integer getAutowrap() {
return this.autowrap;
@ -120,21 +92,6 @@ public class HiddenRegionFormatting implements IHiddenRegionFormatter, IHiddenRe
return space;
}
@Override
public void highPriority() {
setPriority(IHiddenRegionFormatter.HIGH_PRIORITY);
}
@Override
public void increaseIndentation() {
indentationIncrease = indentationIncrease == null ? 1 : indentationIncrease + 1;
}
@Override
public void lowPriority() {
setPriority(IHiddenRegionFormatter.LOW_PRIORITY);
}
protected <T> T merge(T val1, T val2, int strategy, String propertyname) throws ConflictingFormattingException {
if (val1 != null && val2 != null) {
if (val1.equals(val2) || strategy < 0)
@ -161,38 +118,13 @@ public class HiddenRegionFormatting implements IHiddenRegionFormatter, IHiddenRe
if (getIndentationIncrease() != null && other.getIndentationIncrease() != null)
setIndentationIncrease(getIndentationIncrease() + other.getIndentationIncrease());
else
setIndentationIncrease(getIndentationIncrease() != null ? getIndentationIncrease() : other
.getIndentationIncrease());
setIndentationIncrease(
getIndentationIncrease() != null ? getIndentationIncrease() : other.getIndentationIncrease());
if (getIndentationDecrease() != null && other.getIndentationDecrease() != null)
setIndentationDecrease(getIndentationDecrease() + other.getIndentationDecrease());
else
setIndentationDecrease(getIndentationDecrease() != null ? getIndentationDecrease() : other
.getIndentationDecrease());
}
@Override
public void newLine() {
setNewLines(1);
}
@Override
public void noAutowrap() {
this.autowrap = -1;
}
@Override
public void noIndentation() {
this.noIndentation = Boolean.TRUE;
}
@Override
public void noSpace() {
setSpace("");
}
@Override
public void oneSpace() {
setSpace(" ");
setIndentationDecrease(
getIndentationDecrease() != null ? getIndentationDecrease() : other.getIndentationDecrease());
}
@Override
@ -200,16 +132,6 @@ public class HiddenRegionFormatting implements IHiddenRegionFormatter, IHiddenRe
this.autowrap = value;
}
@Override
public void setDecreaseIndentation(int indentation) {
this.indentationDecrease = indentation;
}
@Override
public void setIncreaseIndentation(int indentation) {
this.indentationIncrease = indentation;
}
@Override
public void setIndentationDecrease(Integer indentation) {
this.indentationDecrease = indentation;
@ -220,21 +142,6 @@ public class HiddenRegionFormatting implements IHiddenRegionFormatter, IHiddenRe
this.indentationIncrease = indentation;
}
@Override
public void setNewLines(int newLines) {
setNewLines(newLines, newLines, newLines);
}
@Override
public void setNewLines(int minNewLines, int defaultNewLines, int maxNewLines) {
Preconditions.checkArgument(minNewLines >= 0);
Preconditions.checkArgument(defaultNewLines >= 0);
Preconditions.checkArgument(maxNewLines >= 0);
this.newLineMin = minNewLines;
this.newLineDefault = defaultNewLines;
this.newLineMax = maxNewLines;
}
@Override
public void setNewLinesDefault(Integer newLines) {
this.newLineDefault = newLines;
@ -257,7 +164,6 @@ public class HiddenRegionFormatting implements IHiddenRegionFormatter, IHiddenRe
@Override
public void setOnAutowrap(IAutowrapFormatter formatter) {
autowrap();
this.onAutowrap = formatter;
}

View file

@ -0,0 +1,85 @@
/*******************************************************************************
* Copyright (c) 2015 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*******************************************************************************/
package org.eclipse.xtext.formatting2.internal;
import org.eclipse.xtext.formatting2.FormatterRequest;
import org.eclipse.xtext.formatting2.IAutowrapFormatter;
import org.eclipse.xtext.formatting2.IHiddenRegionFormatting;
/**
* @author Moritz Eysholdt - Initial contribution and API
* @since 2.9
*/
public class SingleHiddenRegionFormatter extends AbstractHiddenRegionFormatter {
private final IHiddenRegionFormatting formatting;
public SingleHiddenRegionFormatter(IHiddenRegionFormatting formatting) {
super();
this.formatting = formatting;
}
@Override
public void autowrap() {
Integer old = formatting.getAutowrap();
if (old == null || old < 0)
formatting.setAutowrap(0);
}
@Override
public void autowrap(int triggerLength) {
formatting.setAutowrap(triggerLength);
}
@Override
public FormatterRequest getRequest() {
return formatting.getRequest();
}
@Override
public void indent() {
Integer inc = formatting.getIndentationIncrease();
Integer dec = formatting.getIndentationDecrease();
formatting.setIndentationIncrease(inc == null ? 1 : inc + 1);
formatting.setIndentationDecrease(dec == null ? 1 : dec + 1);
}
@Override
public void noAutowrap() {
formatting.setAutowrap(-1);
}
@Override
public void noIndentation() {
formatting.setNoIndentation(true);
}
@Override
public void setNewLines(int minNewLines, int defaultNewLines, int maxNewLines) {
formatting.setNewLinesMin(minNewLines);
formatting.setNewLinesDefault(defaultNewLines);
formatting.setNewLinesMax(maxNewLines);
}
@Override
public void setOnAutowrap(IAutowrapFormatter formatter) {
autowrap();
formatting.setOnAutowrap(formatter);
}
@Override
public void setPriority(int priority) {
formatting.setPriority(priority);
}
@Override
public void setSpace(String space) {
formatting.setSpace(space);
}
}

View file

@ -26,7 +26,7 @@ public class SinglelineCodeCommentReplacer extends SinglelineCommentReplacer {
@Override
public void configureWhitespace(WhitespaceReplacer leading, WhitespaceReplacer trailing) {
leading.getFormatting().asFormatter().noIndentation();
leading.getFormatting().setNoIndentation(true);
}
}

View file

@ -77,7 +77,7 @@ public class WhitespaceReplacer implements ITextReplacer {
if (newLineCount == 0 && context.isAutowrap()) {
IAutowrapFormatter onAutowrap = formatting.getOnAutowrap();
if (onAutowrap != null) {
onAutowrap.format(formatting.asFormatter(), context.getDocument());
onAutowrap.format(region, formatting, context.getDocument());
}
newLineCount = 1;
}

View file

@ -198,7 +198,7 @@ public interface ITextRegionAccess {
*
* @see #leadingHiddenRegion(EObject)
*/
IHiddenRegion trailingHiddenRegion(EObject owner);
IHiddenRegion trailingHiddenRegion(EObject owner); // rename to nextHiddenRegion; do same with leading()
ITextRegionRewriter getRewriter();
}