public class PsiAwareDefaultLineWrapPositionStrategy extends PsiAwareLineWrapPositionStrategy
LineWrapPositionStrategy
implementation that uses
default line wrap strategy
but restricts its scope
by target tokens/elements
.NO_ELEMENT_WRAP, NO_LINE_WRAP
Constructor and Description |
---|
PsiAwareDefaultLineWrapPositionStrategy(boolean nonVirtualOnly,
IElementType... enabledTypes) |
Modifier and Type | Method and Description |
---|---|
protected int |
doCalculateWrapPosition(Document document,
Project project,
PsiElement element,
int startOffset,
int endOffset,
int maxPreferredOffset,
boolean isSoftWrap)
Serves for the same purposes as
PsiAwareLineWrapPositionStrategy.calculateWrapPosition(Document, Project, int, int, int, boolean, boolean) but ensures
that given offsets target enabled token/element types . |
calculateWrapPosition
public PsiAwareDefaultLineWrapPositionStrategy(boolean nonVirtualOnly, IElementType... enabledTypes)
protected int doCalculateWrapPosition(Document document, Project project, PsiElement element, int startOffset, int endOffset, int maxPreferredOffset, boolean isSoftWrap)
PsiAwareLineWrapPositionStrategy
PsiAwareLineWrapPositionStrategy.calculateWrapPosition(Document, Project, int, int, int, boolean, boolean)
but ensures
that given offsets target enabled token/element types
.doCalculateWrapPosition
in class PsiAwareLineWrapPositionStrategy
document
- target document which text is being processedproject
- target projectstartOffset
- start offset to use with the given text holder (inclusive)endOffset
- end offset to use with the given text holder (exclusive)maxPreferredOffset
- this method is expected to do its best to return offset that belongs to
(startOffset; maxPreferredOffset]
interval. However, it's allowed
to return value from (maxPreferredOffset; endOffset]
interval
unless 'allowToBeyondMaxPreferredOffset'
if 'false'
isSoftWrap
- identifies if current request is for virtual wrap (soft wrap) position(startOffset; endOffset]
interval where
target line should be wrapped, PsiAwareLineWrapPositionStrategy.NO_ELEMENT_WRAP
if no wrapping
should be performed within the element OR PsiAwareLineWrapPositionStrategy.NO_LINE_WRAP
if the
entire line wrapping is not allowed.