![]() |
冷冷的牛肉面 · Office 部署工具概觀- ...· 1 月前 · |
![]() |
独立的熊猫 · 妄想代理人- 萌娘百科万物皆可萌的百科全书· 1 年前 · |
![]() |
淡定的菠萝 · 我实验室李传锋、唐建顺等首次实现循环式宇称时 ...· 1 年前 · |
![]() |
讲道义的番茄 · 凯文·卢卡森_百度百科· 1 年前 · |
![]() |
干练的羽毛球 · 屠呦呦瑞典演讲:青蒿素是中医药给世界的一份礼 ...· 1 年前 · |
An event emitted on a "contextmenu".
Readonly
onAn event emitted when editing failed because the editor is read-only.
Readonly
onAn event emitted when the text inside this editor lost focus (i.e. cursor stops blinking).
Readonly
onAn event emitted when the text inside this editor or an editor widget lost focus.
Readonly
onAn event emitted when the configuration of the editor has changed. (e.g.
editor.updateOptions()
)Readonly
onAn event emitted when the cursor position has changed.
Readonly
onAn event emitted when the cursor selection has changed.
Readonly
onAn event emitted when hidden areas change in the editor (e.g. due to folding).
Readonly
onAn event emitted when the model of this editor has changed (e.g.
editor.setModel()
).Readonly
onAn event emitted when the content of the current model has changed.
Readonly
onAn event emitted when the decorations of the current model have changed.
Readonly
onAn event emitted when the language of the current model has changed.
Readonly
onAn event emitted when the language configuration of the current model has changed.
Readonly
onAn event emitted when the options of the current model has changed.
Readonly
onAn event emitted when the content width or content height in the editor has changed.
Readonly
onAn event emitted when the text inside this editor gained focus (i.e. cursor starts blinking).
Readonly
onAn event emitted when the text inside this editor or an editor widget gained focus.
Readonly
onAn event emitted when the layout of the editor has changed.
Readonly
onAn event emitted when users paste text in the editor.
Readonly
onAn event emitted when the scroll in the editor has changed.
Readonly
onAn event emitted on a "keydown".
Readonly
onAn event emitted on a "keyup".
Readonly
onAn event emitted on a "mousedown".
Readonly
onAn event emitted on a "mouseleave".
Readonly
onAn event emitted on a "mousemove".
Readonly
onAn event emitted on a "mouseup".
on
Did
Dispose
An event emitted when the editor has been disposed.
Parameters
listener: ( ( ) => void )
Returns void
Returns IDisposable
Properties
Readonly
onAn event emitted after composition has ended.
Readonly
onAn event emitted after composition has started.
Methods
add
Content
Widget
Add a content widget. Widgets must have unique ids, otherwise they will be overwritten.
Parameters
widget: IContentWidget
Returns void
add
Glyph
Margin
Widget
Add a glyph margin widget. Widgets must have unique ids, otherwise they will be overwritten.
Parameters
widget: IGlyphMarginWidget
Returns void
add
Overlay
Widget
Add an overlay widget. Widgets must have unique ids, otherwise they will be overwritten.
Parameters
widget: IOverlayWidget
Returns void
apply
Font
Info
Apply the same font settings as the editor to
target
.Parameters
target: HTMLElement
Returns void
change
View
Zones
Change the view zones. View zones are lost when a new model is attached to the editor.
Parameters
callback: ( ( accessor : IViewZoneChangeAccessor ) => void )
Parameters
accessor: IViewZoneChangeAccessor
Returns void
Returns void
create
Decorations
Collection
Create a collection of decorations. All decorations added through this collection will get the ownerId of the editor (meaning they will not show up in other editors). These decorations will be automatically cleared when the editor's model changes.
Parameters
Optional
decorations: IModelDeltaDecoration []Returns IEditorDecorationsCollection
delta
Decorations
All decorations added through this call will get the ownerId of this editor.
Deprecated
Use
createDecorationsCollection
See
createDecorationsCollection
Parameters
oldDecorations: string []
newDecorations: IModelDeltaDecoration []
Returns string []
dispose
Dispose the editor.
Returns void
execute
Command
Execute a command on the editor. The edits will land on the undo-redo stack, but no "undo stop" will be pushed.
Parameters
source: string
The source of the call.
command: ICommand
The command to execute
Returns void
execute
Commands
Execute multiple (concomitant) commands on the editor.
Parameters
source: string
The source of the call.
commands: ICommand []
Returns void
execute
Edits
Execute edits on the editor. The edits will land on the undo-redo stack, but no "undo stop" will be pushed.
Parameters
source: string
The source of the call.
edits: IIdentifiedSingleEditOperation []
The edits to execute.
Optional
endCursorState: ICursorStateComputer | Selection []Cursor state after the edits were applied.
Returns boolean
focus
Brings browser focus to the editor text
Returns void
get
Action
Get an action that is a contribution to this editor.
Id
Unique identifier of the contribution.
Returns
The action or null if action not found.
Parameters
id: string
Returns IEditorAction
get
Bottom
For
Line
Number
Get the vertical position (top offset) for the line's bottom w.r.t. to the first line.
Parameters
lineNumber: number
Returns number
get
Container
Dom
Node
Returns the editor's container dom node
Returns HTMLElement
get
Content
Height
Get the height of the editor's content. This is information that is "erased" when computing
scrollHeight = Math.max(contentHeight, height)
Returns number
get
Content
Width
Get the width of the editor's content. This is information that is "erased" when computing
scrollWidth = Math.max(contentWidth, width)
Returns number
get
Contribution
Get a contribution of this editor.
Id
Unique identifier of the contribution.
Returns
The contribution or null if contribution not found.
Type Parameters
T extends IEditorContribution
Parameters
id: string
Returns T
get
Decorations
In
Range
Get all the decorations for a range (filtering out decorations from other editors).
Parameters
range: Range
Returns IModelDecoration []
get
Dom
Node
Returns the editor's dom node
Returns HTMLElement
get
Editor
Type
Get the editor type. Please see
EditorType
. This is to avoid an instanceof checkReturns string
get
Id
Get a unique id for this editor instance.
Returns string
get
Layout
Info
Get the layout info for the editor.
Returns EditorLayoutInfo
get
Line
Decorations
Get all the decorations on a line (filtering out decorations from other editors).
Parameters
lineNumber: number
Returns IModelDecoration []
get
Model
Type the getModel() of IEditor.
Returns ITextModel
get
Offset
For
Column
Get the horizontal position (left offset) for the column w.r.t to the beginning of the line. This method works only if the line
lineNumber
is currently rendered (in the editor's viewport). Use this method with caution.Parameters
lineNumber: number
column: number
Returns number
get
Option
Gets a specific editor option.
Type Parameters
T extends EditorOption
Parameters
id: T
Returns FindComputedEditorOptionValueById < T >
get
Options
Gets all the editor computed options.
Returns IComputedEditorOptions
get
Position
Returns the primary position of the cursor.
Returns Position
get
Raw
Options
Returns the editor's configuration (without any validation or defaults).
Returns IEditorOptions
get
Scroll
Height
Get the scrollHeight of the editor's viewport.
Returns number
get
Scroll
Left
Get the scrollLeft of the editor's viewport.
Returns number
get
Scroll
Top
Get the scrollTop of the editor's viewport.
Returns number
get
Scroll
Width
Get the scrollWidth of the editor's viewport.
Returns number
get
Scrolled
Visible
Position
height : number ;
left : number ;
top : number ;
}
Get the visible position for
position
. The result position takes scrolling into account and is relative to the top left corner of the editor. Explanation 1: the results of this method will change for the sameposition
if the user scrolls the editor. Explanation 2: the results of this method will not change if the container of the editor gets repositioned. Warning: the results of this method are inaccurate for positions that are outside the current editor viewport.Parameters
position: IPosition
Returns {
height : number ;
left : number ;
top : number ;
}
height : number
left : number
top : number
get
Selection
Returns the primary selection of the editor.
Returns Selection
get
Selections
Returns all the selections of the editor.
Returns Selection []
get
Supported
Actions
Returns all actions associated with this editor.
Returns IEditorAction []
get
Target
At
Client
Point
Get the hit test target at coordinates
clientX
andclientY
. The coordinates are relative to the top-left of the viewport.Returns
Hit test target or null if the coordinates fall outside the editor or the editor has no model.
Parameters
clientX: number
clientY: number
Returns IMouseTarget
get
Top
For
Line
Number
Get the vertical position (top offset) for the line's top w.r.t. to the first line.
Parameters
lineNumber: number
Optional
includeViewZones: booleanReturns number
get
Top
For
Position
Get the vertical position (top offset) for the position w.r.t. to the first line.
Parameters
lineNumber: number
column: number
Returns number
get
Value
lineEnding : string ;
preserveBOM : boolean ;
} ) : string
Get value of the current model attached to this editor.
See
getValue
Parameters
Optional
options: {lineEnding : string ;
preserveBOM : boolean ;
}
line
Ending
:
string
preserveBOM : boolean
Returns string
get
Visible
Column
From
Position
Given a position, returns a column number that takes tab-widths into account.
Parameters
position: IPosition
Returns number
get
Visible
Ranges
Returns the ranges that are currently visible. Does not account for horizontal scrolling.
Returns Range []
Optional
handleIs called when the model has been set, view state was restored and options are updated. This is the best place to compute data for the viewport (such as tokens).
Returns void
has
Pending
Scroll
Animation
Check if the editor is currently scrolling towards a different scroll position.
Returns boolean
has
Text
Focus
Returns true if the text inside this editor is focused (i.e. cursor is blinking).
Returns boolean
has
Widget
Focus
Returns true if the text inside this editor or an editor widget has focus.
Returns boolean
layout
Instructs the editor to remeasure its container. This method should be called when the container of the editor gets resized.
If a dimension is passed in, the passed in value will be used.
Parameters
Optional
dimension: IDimensionReturns void
layout
Content
Widget
Layout/Reposition a content widget. This is a ping to the editor to call widget.getPosition() and update appropriately.
Parameters
widget: IContentWidget
Returns void
layout
Glyph
Margin
Widget
Layout/Reposition a glyph margin widget. This is a ping to the editor to call widget.getPosition() and update appropriately.
Parameters
widget: IGlyphMarginWidget
Returns void
layout
Overlay
Widget
Layout/Reposition an overlay widget. This is a ping to the editor to call widget.getPosition() and update appropriately.
Parameters
widget: IOverlayWidget
Returns void
pop
Undo
Stop
Remove the "undo stop" in the undo-redo stack.
Returns boolean
push
Undo
Stop
Create an "undo stop" in the undo-redo stack.
Returns boolean
remove
Content
Widget
Remove a content widget.
Parameters
widget: IContentWidget
Returns void
remove
Decorations
Remove previously added decorations.
Parameters
decorationIds: string []
Returns void
remove
Glyph
Margin
Widget
Remove a glyph margin widget.
Parameters
widget: IGlyphMarginWidget
Returns void
remove
Overlay
Widget
Remove an overlay widget.
Parameters
widget: IOverlayWidget
Returns void
render
Force an editor render now.
Parameters
Optional
forceRedraw: booleanReturns void
restore
View
State
Restores the view state of the editor from a serializable object generated by
saveViewState
.Parameters
state: ICodeEditorViewState
Returns void
reveal
Line
Scroll vertically as necessary and reveal a line.
Parameters
lineNumber: number
Optional
scrollType: ScrollTypeReturns void
reveal
Line
In
Center
Scroll vertically as necessary and reveal a line centered vertically.
Parameters
lineNumber: number
Optional
scrollType: ScrollTypeReturns void
reveal
Line
In
Center
If
Outside
Viewport
Scroll vertically as necessary and reveal a line centered vertically only if it lies outside the viewport.
Parameters
lineNumber: number
Optional
scrollType: ScrollTypeReturns void
reveal
Line
Near
Top
Scroll vertically as necessary and reveal a line close to the top of the viewport, optimized for viewing a code definition.
Parameters
lineNumber: number
Optional
scrollType: ScrollTypeReturns void
reveal
Lines
Scroll vertically as necessary and reveal lines.
Parameters
startLineNumber: number
endLineNumber: number
Optional
scrollType: ScrollTypeReturns void
reveal
Lines
In
Center
Scroll vertically as necessary and reveal lines centered vertically.
Parameters
lineNumber: number
endLineNumber: number
Optional
scrollType: ScrollTypeReturns void
reveal
Lines
In
Center
If
Outside
Viewport
Scroll vertically as necessary and reveal lines centered vertically only if it lies outside the viewport.
Parameters
lineNumber: number
endLineNumber: number
Optional
scrollType: ScrollTypeReturns void
reveal
Lines
Near
Top
Scroll vertically as necessary and reveal lines close to the top of the viewport, optimized for viewing a code definition.
Parameters
lineNumber: number
endLineNumber: number
Optional
scrollType: ScrollTypeReturns void
reveal
Position
Scroll vertically or horizontally as necessary and reveal a position.
Parameters
position: IPosition
Optional
scrollType: ScrollTypeReturns void
reveal
Position
In
Center
Scroll vertically or horizontally as necessary and reveal a position centered vertically.
Parameters
position: IPosition
Optional
scrollType: ScrollTypeReturns void
reveal
Position
In
Center
If
Outside
Viewport
Scroll vertically or horizontally as necessary and reveal a position centered vertically only if it lies outside the viewport.
Parameters
position: IPosition
Optional
scrollType: ScrollTypeReturns void
reveal
Position
Near
Top
Scroll vertically or horizontally as necessary and reveal a position close to the top of the viewport, optimized for viewing a code definition.
Parameters
position: IPosition
Optional
scrollType: ScrollTypeReturns void
reveal
Range
Scroll vertically or horizontally as necessary and reveal a range.
Parameters
range: IRange
Optional
scrollType: ScrollTypeReturns void
reveal
Range
At
Top
Scroll vertically or horizontally as necessary and reveal a range at the top of the viewport.
Parameters
range: IRange
Optional
scrollType: ScrollTypeReturns void
reveal
Range
In
Center
Scroll vertically or horizontally as necessary and reveal a range centered vertically.
Parameters
range: IRange
Optional
scrollType: ScrollTypeReturns void
reveal
Range
In
Center
If
Outside
Viewport
Scroll vertically or horizontally as necessary and reveal a range centered vertically only if it lies outside the viewport.
Parameters
range: IRange
Optional
scrollType: ScrollTypeReturns void
reveal
Range
Near
Top
Scroll vertically or horizontally as necessary and reveal a range close to the top of the viewport, optimized for viewing a code definition.
Parameters
range: IRange
Optional
scrollType: ScrollTypeReturns void
reveal
Range
Near
Top
If
Outside
Viewport
Scroll vertically or horizontally as necessary and reveal a range close to the top of the viewport, optimized for viewing a code definition. Only if it lies outside the viewport.
Parameters
range: IRange
Optional
scrollType: ScrollTypeReturns void
save
View
State
Saves current view state of the editor in a serializable object.
Returns ICodeEditorViewState
set
Banner
Parameters
bannerDomNode: HTMLElement
height: number
Returns void
set
Model
Sets the current model attached to this editor. If the previous model was created by the editor via the value key in the options literal object, it will be destroyed. Otherwise, if the previous model was set via setModel, or the model key in the options literal object, the previous model will not be destroyed. It is safe to call setModel(null) to simply detach the current model from the editor.
Parameters
model: ITextModel
Returns void
set
Position
Set the primary position of the cursor. This will remove any secondary cursors.
Parameters
position: IPosition
New primary cursor's position
Optional
source: stringSource of the call that caused the position
Returns void
set
Scroll
Left
Change the scrollLeft of the editor's viewport.
Parameters
newScrollLeft: number
Optional
scrollType: ScrollTypeReturns void
set
Scroll
Position
Change the scroll position of the editor's viewport.
Parameters
position: INewScrollPosition
Optional
scrollType: ScrollTypeReturns void
set
Scroll
Top
Change the scrollTop of the editor's viewport.
Parameters
newScrollTop: number
Optional
scrollType: ScrollTypeReturns void
set
Selection
Set the primary selection of the editor. This will remove any secondary cursors.
Parameters
selection: IRange
The new selection
Optional
source: stringSource of the call that caused the selection
Returns void
Set the primary selection of the editor. This will remove any secondary cursors.
Parameters
selection: Range
The new selection
Optional
source: stringSource of the call that caused the selection
Returns void
Set the primary selection of the editor. This will remove any secondary cursors.
Parameters
selection: ISelection
The new selection
Optional
source: stringSource of the call that caused the selection
Returns void
Set the primary selection of the editor. This will remove any secondary cursors.
Parameters
selection: Selection
The new selection
Optional
source: stringSource of the call that caused the selection
Returns void
set
Selections
Set the selections for all the cursors of the editor. Cursors will be removed or added, as necessary.
Parameters
selections: readonly ISelection []
The new selection
Optional
source: stringSource of the call that caused the selection
Returns void
set
Value
Set the value of the current model attached to this editor.
See
setValue
Parameters
newValue: string
Returns void
trigger
Directly trigger a handler or an editor action.
Parameters
source: string
The source of the call.
handlerId: string
The id of the handler or the id of a contribution.
payload: any
Extra data to be sent to the handler.
Returns void
update
Options
Update the editor's options after the editor has been created.
Parameters
newOptions: IEditorOptions
Returns void
write
Screen
Reader
Content
Write the screen reader content to be the current selection
Parameters
reason: string
Returns void
Settings
Member Visibility
Theme
Modules