Interface: EditableTextEditor
libs/common/types/TextEditor.EditableTextEditor
Hierarchy
↳
EditableTextEditor
Implemented by
Properties
document
• Readonly
document: TextDocument
The document associated with this text editor. The document will be the same for the entire lifetime of this text editor.
Inherited from
Defined in
libs/common/types/TextEditor.ts:25
id
• Readonly
id: string
Unique identifier for this text editor
Inherited from
Defined in
libs/common/types/TextEditor.ts:20
isActive
• Readonly
isActive: boolean
True if this text editor is active.
Inherited from
Defined in
libs/common/types/TextEditor.ts:46
options
• options: TextEditorOptions
Text editor options.
Overrides
Defined in
libs/common/types/TextEditor.ts:60
selections
• selections: Selection
[]
The selections in this text editor.
Overrides
Defined in
libs/common/types/TextEditor.ts:58
visibleRanges
• Readonly
visibleRanges: Range
[]
The current visible ranges in the editor (vertically). This accounts only for vertical scrolling, and not for horizontal scrolling.
Inherited from
Defined in
libs/common/types/TextEditor.ts:31
Methods
clipboardCopy
▸ clipboardCopy(ranges?
): Promise
<void
>
Copy to clipboard
Parameters
Name | Type | Description |
---|---|---|
ranges? | Range [] | A list of ranges |
Returns
Promise
<void
>
Defined in
libs/common/types/TextEditor.ts:149
clipboardPaste
▸ clipboardPaste(ranges?
): Promise
<void
>
Paste clipboard content
Parameters
Name | Type | Description |
---|---|---|
ranges? | Range [] | A list of ranges |
Returns
Promise
<void
>
Defined in
libs/common/types/TextEditor.ts:155
edit
▸ edit(callback
, options?
): Promise
<boolean
>
Perform an edit on the document associated with this text editor.
The given callback-function is invoked with an edit-builder which must be used to make edits. Note that the edit-builder is only valid while the callback executes.
Parameters
Name | Type | Description |
---|---|---|
callback | (editBuilder : TextEditorEdit ) => void | A function which can create edits using an edit-builder. |
options? | Object | The undo/redo behavior around this edit. By default, undo stops will be created before and after this edit. |
options.undoStopAfter | boolean | - |
options.undoStopBefore | boolean | - |
Returns
Promise
<boolean
>
A promise that resolves with a value indicating if the edits could be applied.
Defined in
libs/common/types/TextEditor.ts:107
editNewNotebookCellAbove
▸ editNewNotebookCellAbove(): Promise
<(selection
: Selection
) => Selection
>
Edit a new new notebook cell above.
Returns
Promise
<(selection
: Selection
) => Selection
>
A promise that resolves to a function that must be applied to any selections that should be updated as result of this operation. This is a horrible hack to work around the fact that in vscode the promise resolves before the edits have actually been performed.
Defined in
libs/common/types/TextEditor.ts:119
editNewNotebookCellBelow
▸ editNewNotebookCellBelow(): Promise
<void
>
Edit a new new notebook cell below.
Returns
Promise
<void
>
Defined in
libs/common/types/TextEditor.ts:124
extractVariable
▸ extractVariable(range?
): Promise
<void
>
Extract variable
Parameters
Name | Type | Description |
---|---|---|
range? | Range | A range |
Returns
Promise
<void
>
Defined in
libs/common/types/TextEditor.ts:243
focus
▸ focus(): Promise
<void
>
Focus the editor.
Returns
Promise
<void
>
Defined in
libs/common/types/TextEditor.ts:80
fold
▸ fold(ranges?
): Promise
<void
>
Fold ranges
Parameters
Name | Type | Description |
---|---|---|
ranges? | Range [] | A list of ranges |
Returns
Promise
<void
>
Defined in
libs/common/types/TextEditor.ts:137
indentLine
▸ indentLine(ranges?
): Promise
<void
>
Indent lines
Parameters
Name | Type | Description |
---|---|---|
ranges? | Range [] | A list of ranges |
Returns
Promise
<void
>
Defined in
libs/common/types/TextEditor.ts:176
insertLineAfter
▸ insertLineAfter(ranges?
): Promise
<void
>
Insert line after
Parameters
Name | Type | Description |
---|---|---|
ranges? | Range [] | A list of ranges |
Returns
Promise
<void
>
Defined in
libs/common/types/TextEditor.ts:188
insertSnippet
▸ insertSnippet(snippet
, ranges?
): Promise
<void
>
Insert snippet
Parameters
Name | Type | Description |
---|---|---|
snippet | string | A snippet string |
ranges? | Range [] | A list of ranges |
Returns
Promise
<void
>
Defined in
libs/common/types/TextEditor.ts:195
isEqual
▸ isEqual(other
): boolean
Check if this text editor is equal to other
.
Parameters
Name | Type | Description |
---|---|---|
other | TextEditor | A text editor. |
Returns
boolean
true
if the this text editor is equal to other
.
Inherited from
Defined in
libs/common/types/TextEditor.ts:54
openLink
▸ openLink(location?
): Promise
<boolean
>
Open link at location.
Parameters
Name | Type | Description |
---|---|---|
location? | Range | Position | Position or range |
Returns
Promise
<boolean
>
True if a link was opened
Defined in
libs/common/types/TextEditor.ts:131
outdentLine
▸ outdentLine(ranges?
): Promise
<void
>
Outdent lines
Parameters
Name | Type | Description |
---|---|---|
ranges? | Range [] | A list of ranges |
Returns
Promise
<void
>
Defined in
libs/common/types/TextEditor.ts:182
quickFix
▸ quickFix(range?
): Promise
<void
>
Show quick fixed dialogue
Parameters
Name | Type | Description |
---|---|---|
range? | Range | A range |
Returns
Promise
<void
>
Defined in
libs/common/types/TextEditor.ts:213
rename
▸ rename(range?
): Promise
<void
>
Rename
Parameters
Name | Type | Description |
---|---|---|
range? | Range | A range |
Returns
Promise
<void
>
Defined in
libs/common/types/TextEditor.ts:201
revealDefinition
▸ revealDefinition(range?
): Promise
<void
>
Reveal definition
Parameters
Name | Type | Description |
---|---|---|
range? | Range | A range |
Returns
Promise
<void
>
Defined in
libs/common/types/TextEditor.ts:219
revealLine
▸ revealLine(lineNumber
, at
): Promise
<void
>
Scroll to reveal the given line.
Parameters
Name | Type | Description |
---|---|---|
lineNumber | number | A line number. |
at | RevealLineAt | Were to reveal the line at: top|center|bottom. |
Returns
Promise
<void
>
Defined in
libs/common/types/TextEditor.ts:75
revealRange
▸ revealRange(range
): Promise
<void
>
Scroll to reveal the given range.
Parameters
Name | Type | Description |
---|---|---|
range | Range | A range. |
Returns
Promise
<void
>
Defined in
libs/common/types/TextEditor.ts:67
revealTypeDefinition
▸ revealTypeDefinition(range?
): Promise
<void
>
Reveal type definition
Parameters
Name | Type | Description |
---|---|---|
range? | Range | A range |
Returns
Promise
<void
>
Defined in
libs/common/types/TextEditor.ts:225
setDecorations
▸ setDecorations(decorationType
, ranges
): Promise
<void
>
Adds a set of decorations to the text editor. If a set of decorations already exists with
the given decoration type, they will be replaced. If
ranges
is empty, the existing decorations with the given decoration type
will be removed.
Parameters
Name | Type | Description |
---|---|---|
decorationType | TextEditorDecorationType | A decoration type. |
ranges | readonly Range [] | ranges |
Returns
Promise
<void
>
Defined in
libs/common/types/TextEditor.ts:91
showDebugHover
▸ showDebugHover(range?
): Promise
<void
>
Show debug hover
Parameters
Name | Type | Description |
---|---|---|
range? | Range | A range |
Returns
Promise
<void
>
Defined in
libs/common/types/TextEditor.ts:237
showHover
▸ showHover(range?
): Promise
<void
>
Show hover
Parameters
Name | Type | Description |
---|---|---|
range? | Range | A range |
Returns
Promise
<void
>
Defined in
libs/common/types/TextEditor.ts:231
showReferences
▸ showReferences(range?
): Promise
<void
>
Show references
Parameters
Name | Type | Description |
---|---|---|
range? | Range | A range |
Returns
Promise
<void
>
Defined in
libs/common/types/TextEditor.ts:207
toggleBreakpoint
▸ toggleBreakpoint(descriptors?
): Promise
<void
>
Toggle breakpoints. For each of the descriptors in {@link descriptors}, remove all breakpoints overlapping with the given descriptor if it overlaps with any existing breakpoint, otherwise add a new breakpoint at the given location.
Parameters
Name | Type | Description |
---|---|---|
descriptors? | BreakpointDescriptor [] | A list of breakpoint descriptors |
Returns
Promise
<void
>
Defined in
libs/common/types/TextEditor.ts:164
toggleLineComment
▸ toggleLineComment(ranges?
): Promise
<void
>
Toggle line comments
Parameters
Name | Type | Description |
---|---|---|
ranges? | Range [] | A list of ranges |
Returns
Promise
<void
>
Defined in
libs/common/types/TextEditor.ts:170
unfold
▸ unfold(ranges?
): Promise
<void
>
Unfold ranges
Parameters
Name | Type | Description |
---|---|---|
ranges? | Range [] | A list of ranges |
Returns
Promise
<void
>
Defined in
libs/common/types/TextEditor.ts:143