Class: DocumentTarget
processTargets/targets/DocumentTarget.DocumentTarget
Hierarchy
↳
DocumentTarget
Constructors
constructor
• new DocumentTarget(parameters
)
Parameters
Name | Type |
---|---|
parameters | CommonTargetParameters |
Overrides
Defined in
processTargets/targets/DocumentTarget.ts:10
Properties
hasExplicitRange
• hasExplicitRange: boolean
= true
If true
, then this target has an explicit range. This attribute is used
by "every"
to determine whether to return all scopes in the iteration
scope or just the ones that overlap with the given target's
contentRange.
Most targets have explicit ranges. As of writing this comment, the only targets that don't are as follows:
- a decorated mark (
"air"
), or - an empty cursor mark (
"this"
with an empty selection), or - an empty
"that"
mark (eg after saying"chuck air"
).
For example, when the user says "change every state air"
, we clear every
statement in the function, but "change every state this"
with a non-empty
selection will only target statements overlapping the cursor.
Inherited from
Defined in
processTargets/targets/BaseTarget.ts:31
hasExplicitScopeType
• hasExplicitScopeType: boolean
= true
If true
, then this target has an explicit scope type, and so should never
be automatically expanded to a containing scope.
Examples of targets that have explicit scopes are ScopeTypeTarget
(eg "funk"
), TokenTarget (eg "token"
), etc.
As of writing this comment, the only target type that doesn't have an explicit scope type is UntypedTarget, which can be constructed by
- using a decorated mark (
"air"
), or - using any cursor mark (
"this"
), or - using a range between decorated marks or cursor marks (eg
"past air"
or"air past bat"
), or - using any
"that"
mark (eg after saying"copy air"
), though this final behaviour will change with #466.
The primary consumer of this attribute is ModifyIfUntypedStage,
which is used in the following situations to automatically expand to a
particular scope type when hasExplicitScopeType
is false
:
- To expand to
"line"
for"pour"
,"clone"
, and"breakpoint"
- To expand to
"token"
for"leading"
and"trailing"
- To expand to nearest containing pair for
"inside"
,"bounds"
, and"rewrap"
- To expand to SnippetVariable.wrapperScopeType for snippet wrapping
- To expand to Snippet.insertionScopeTypes for snippet insertion
For example, when the user says "pour air"
, the
{@link DecoratedSymbolStage} will return an UntypedTarget, which
has hasExplicitScopeType=false
, so "pour"
will expand to the line
containining the air token and insert a newline after it.
Inherited from
BaseTarget.hasExplicitScopeType
Defined in
processTargets/targets/BaseTarget.ts:30
insertionDelimiter
• insertionDelimiter: string
= "\n"
If this selection has a delimiter use it for inserting before or after the target. For example, new line for a line or paragraph and comma for a list or argument
Overrides
Defined in
processTargets/targets/DocumentTarget.ts:7
isImplicit
• isImplicit: boolean
= false
If true
, this target was not explicitly spoken by the user. For example:
- The implicit destination in the command
"bring air"
- The implicit anchor in the range
"take past air"
Inherited from
Defined in
processTargets/targets/BaseTarget.ts:33
isLine
• isLine: boolean
= true
If true this target should be treated as a line
Overrides
Defined in
processTargets/targets/DocumentTarget.ts:8
isNotebookCell
• isNotebookCell: boolean
= false
If true this target is a notebook cell
Inherited from
Defined in
processTargets/targets/BaseTarget.ts:34
isRaw
• isRaw: boolean
= false
If true this target is a raw selection and its insertion delimiter should not be used on bring action
Inherited from
Defined in
processTargets/targets/BaseTarget.ts:32
state
• Protected
Readonly
state: CommonTargetParameters
Inherited from
Defined in
processTargets/targets/BaseTarget.ts:28
Accessors
contentRange
• get
contentRange(): Range
Returns
Inherited from
BaseTarget.contentRange
Defined in
processTargets/targets/BaseTarget.ts:66
contentSelection
• get
contentSelection(): Selection
Returns
Inherited from
BaseTarget.contentSelection
Defined in
processTargets/targets/BaseTarget.ts:62
contentText
• get
contentText(): string
Returns
string
Inherited from
BaseTarget.contentText
Defined in
processTargets/targets/BaseTarget.ts:58
editor
• get
editor(): TextEditor
Returns
Inherited from
BaseTarget.editor
Defined in
processTargets/targets/BaseTarget.ts:45
isReversed
• get
isReversed(): boolean
Returns
boolean
Inherited from
BaseTarget.isReversed
Defined in
processTargets/targets/BaseTarget.ts:48
thatTarget
• get
thatTarget(): Target
Returns
Inherited from
BaseTarget.thatTarget
Defined in
processTargets/targets/BaseTarget.ts:52
Methods
cloneWith
▸ Readonly
cloneWith(parameters
): any
Parameters
Name | Type |
---|---|
parameters | CloneWithParameters |
Returns
any
Inherited from
Defined in
processTargets/targets/BaseTarget.ts:109
constructChangeEdit
▸ constructChangeEdit(text
): EditWithRangeUpdater
Constructs change/insertion edit. Adds delimiter before/after if needed
Parameters
Name | Type |
---|---|
text | string |
Returns
Inherited from
BaseTarget.constructChangeEdit
Defined in
processTargets/targets/BaseTarget.ts:70
constructRemovalEdit
▸ constructRemovalEdit(): EditWithRangeUpdater
Constructs removal edit
Returns
Inherited from
BaseTarget.constructRemovalEdit
Defined in
processTargets/targets/BaseTarget.ts:78
createContinuousRangeTarget
▸ createContinuousRangeTarget(isReversed
, endTarget
, includeStart
, includeEnd
): Target
Parameters
Name | Type |
---|---|
isReversed | boolean |
endTarget | Target |
includeStart | boolean |
includeEnd | boolean |
Returns
Inherited from
BaseTarget.createContinuousRangeTarget
Defined in
processTargets/targets/BaseTarget.ts:120
getBoundaryStrict
▸ getBoundaryStrict(): Target
[]
Returns
Target
[]
Inherited from
Defined in
processTargets/targets/BaseTarget.ts:105
getCloneParameters
▸ Protected
getCloneParameters(): CommonTargetParameters
Returns
Overrides
Defined in
processTargets/targets/DocumentTarget.ts:35
getEditNewActionType
▸ getEditNewActionType(): EditNewActionType
Returns
Inherited from
BaseTarget.getEditNewActionType
Defined in
processTargets/targets/BaseTarget.ts:86
getEqualityParameters
▸ Protected
getEqualityParameters(): object
Constructs an object that can be used for determining equality between two
BaseTarget objects. We proceed by just getting the objects clone
parameters and removing the thatTarget
.
We would prefer to instead merge the thatTarget
s into a list. See #780
for more details.
Returns
object
The object to be used for determining equality
Inherited from
BaseTarget.getEqualityParameters
Defined in
processTargets/targets/BaseTarget.ts:167
getInteriorStrict
▸ getInteriorStrict(): PlainTarget
[]
Returns
Overrides
Defined in
processTargets/targets/DocumentTarget.ts:24
getLeadingDelimiterTarget
▸ getLeadingDelimiterTarget(): undefined
The range of the delimiter before the content selection
Returns
undefined
Overrides
BaseTarget.getLeadingDelimiterTarget
Defined in
processTargets/targets/DocumentTarget.ts:14
getRemovalHighlightRange
▸ getRemovalHighlightRange(): undefined
| Range
Returns
undefined
| Range
Inherited from
BaseTarget.getRemovalHighlightRange
Defined in
processTargets/targets/BaseTarget.ts:90
getRemovalRange
▸ getRemovalRange(): Range
Returns
Overrides
Defined in
processTargets/targets/DocumentTarget.ts:20
getTrailingDelimiterTarget
▸ getTrailingDelimiterTarget(): undefined
The range of the delimiter after the content selection
Returns
undefined
Overrides
BaseTarget.getTrailingDelimiterTarget
Defined in
processTargets/targets/DocumentTarget.ts:17
isEqual
▸ isEqual(otherTarget
): boolean
Parameters
Name | Type |
---|---|
otherTarget | Target |
Returns
boolean
Inherited from
Defined in
processTargets/targets/BaseTarget.ts:150
toPositionTarget
▸ toPositionTarget(position
): Target
Construct a position target with the given position.
Parameters
Name | Type |
---|---|
position | Position |
Returns
Inherited from
Defined in
processTargets/targets/BaseTarget.ts:176
withContentRange
▸ withContentRange(contentRange
): Target
Parameters
Name | Type |
---|---|
contentRange | Range |
Returns
Inherited from
Defined in
processTargets/targets/BaseTarget.ts:98
withThatTarget
▸ withThatTarget(thatTarget
): Target
Parameters
Name | Type |
---|---|
thatTarget | Target |
Returns
Inherited from
Defined in
processTargets/targets/BaseTarget.ts:94