Package org.eclipse.xtext.formatting2
Class FormatterRequest
- java.lang.Object
-
- org.eclipse.xtext.formatting2.FormatterRequest
-
public class FormatterRequest extends java.lang.ObjectA request tells the formatter what and how to format.
When invoking the formatter, the request is passed into
IFormatter2.format(FormatterRequest).A request carries information about:
- The
textRegionAccesswhich allows to obtain the to-be-formatted semantic model with text regions. Preferenceswith keys from e.g.FormatterPreferenceKeys.regionsthat describe how to restrict the text regions for whichreplacementsare produced.- An option to
allowIdentityEdits()which will disable automated suppression of text replacements that do not cause changes. - A setting for green-field formatting (
formatUndefinedHiddenRegionsOnly): only format regions that have no whitespace information yet.
- Since:
- 2.8
- The
-
-
Constructor Summary
Constructors Constructor Description FormatterRequest()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description FormatterRequestaddRegion(org.eclipse.xtext.util.ITextRegion region)booleanallowIdentityEdits()org.eclipse.xtext.util.IAcceptor<java.lang.Exception>getExceptionHandler()org.eclipse.xtext.util.IAcceptor<java.lang.Exception>getExplicitExceptionHandler()ITypedPreferenceValuesgetPreferences()java.util.Collection<org.eclipse.xtext.util.ITextRegion>getRegions()ITextRegionAccessgetTextRegionAccess()booleanisEnableDebugTracing()booleanisFormatUndefinedHiddenRegionsOnly()FormatterRequestsetAllowIdentityEdits(boolean allowIdentityEdits)voidsetEnableDebugTracing(boolean enableDebugTracing)FormatterRequestsetExceptionHandler(org.eclipse.xtext.util.IAcceptor<java.lang.Exception> problemHandler)FormatterRequestsetFormatUndefinedHiddenRegionsOnly(boolean formatUndefinedHiddenRegionsOnly)FormatterRequestsetPreferences(ITypedPreferenceValues preferenceValues)FormatterRequestsetRegions(java.util.Collection<org.eclipse.xtext.util.ITextRegion> regions)FormatterRequestsetTextRegionAccess(ITextRegionAccess tokens)Sets thetextRegionAccess.
-
-
-
Method Detail
-
addRegion
public FormatterRequest addRegion(org.eclipse.xtext.util.ITextRegion region)
- See Also:
regions
-
setRegions
public FormatterRequest setRegions(java.util.Collection<org.eclipse.xtext.util.ITextRegion> regions)
- See Also:
regions
-
getRegions
public java.util.Collection<org.eclipse.xtext.util.ITextRegion> getRegions()
- See Also:
regions
-
getTextRegionAccess
public ITextRegionAccess getTextRegionAccess()
- See Also:
textRegionAccess
-
setTextRegionAccess
public FormatterRequest setTextRegionAccess(ITextRegionAccess tokens)
Sets thetextRegionAccess. If the region has syntax errors and no explicitExceptionAcceptoris configured yet, theignoring acceptorwill be configured.
-
setAllowIdentityEdits
public FormatterRequest setAllowIdentityEdits(boolean allowIdentityEdits)
- See Also:
allowIdentityEdits
-
allowIdentityEdits
public boolean allowIdentityEdits()
- See Also:
allowIdentityEdits
-
setPreferences
public FormatterRequest setPreferences(ITypedPreferenceValues preferenceValues)
- See Also:
preferences
-
getPreferences
public ITypedPreferenceValues getPreferences()
- See Also:
preferences
-
isFormatUndefinedHiddenRegionsOnly
public boolean isFormatUndefinedHiddenRegionsOnly()
- See Also:
formatUndefinedHiddenRegionsOnly
-
setFormatUndefinedHiddenRegionsOnly
public FormatterRequest setFormatUndefinedHiddenRegionsOnly(boolean formatUndefinedHiddenRegionsOnly)
- See Also:
formatUndefinedHiddenRegionsOnly
-
getExceptionHandler
public org.eclipse.xtext.util.IAcceptor<java.lang.Exception> getExceptionHandler()
- See Also:
exceptionHandler
-
getExplicitExceptionHandler
public org.eclipse.xtext.util.IAcceptor<java.lang.Exception> getExplicitExceptionHandler()
-
setExceptionHandler
public FormatterRequest setExceptionHandler(org.eclipse.xtext.util.IAcceptor<java.lang.Exception> problemHandler)
- See Also:
exceptionHandler
-
isEnableDebugTracing
public boolean isEnableDebugTracing()
-
setEnableDebugTracing
public void setEnableDebugTracing(boolean enableDebugTracing)
-
-