跳到主要内容

editor对象

create 创建一个editor对象​

create(
domElement: HTMLElement,
options?: IStandaloneEditorConstructionOptions,
override?: IEditorOverrideServices
): IStandaloneCodeEditor

官网api

create

它接收三个参数:

  • domElement: 一个dom元素, 必填
  • options: 可选参数, 配置项,见IStandaloneEditorConstructionOptions
  • override: 可选参数, 没用到,可能是用于重新定义一些参数

返回一个editor对象,见IStandaloneCodeEditor

Editor对象​

见https://microsoft.github.io/monaco-editor/docs.html#interfaces/editor.IStandaloneCodeEditor.html

事件​

event参数见

  • event
  • target

onContextMenu​

右键弹出上下文菜单事件

onDidAttemptReadOnlyEdit​

attempt袭击 在readonly编辑器中试图编辑时,触发的事件

onDidBlurEditorText​

失焦

onDidBlurEditorWidget​

widget失焦

onDidChangeConfiguration​

editor配置项发生改变时,如调用 editor.updateOptions()时

onDidChangeCursorPosition​

光标位置改变时

onDidChangeCursorSelection​

选区发生改变时

onDidChangeHiddenAreas​

区域发生隐藏时,由折叠时部分区域隐藏

onDidChangeModel​

model发生改变时,如editor.setModel(),参数:

  • newModelUrl
  • oldModelUrl

!!!onDidChangeModelContent​

当前model内容发生改变时,参数:

  • changes,是个数组,包含range、rangeLength、rangeOffset、text
  • eol
  • isFlush
  • isRedoing
  • isUndoing
  • versionId

onDidChangeModelDecorations​

当前model的修饰符发生改变时,由minimap(小地图)、overviewRuler(标尺),参数:

  • affectsMinimap
  • affectsOverviewRuler

onDidChangeModelLanguage​

当前model的语言发生改变时,参数:

  • newLanguage
  • oldLanguage
  • source

onDidChangeModelLanguageConfiguration​

当前model的语言配置发生改变时

onDidChangeModelOptions​

model options发生改变时,如tab缩进数,参数:

  • indentSize
  • insertSpaces
  • tabSize
  • trimAutoWhitespace

onDidContentSizeChange​

内容长度发生改变时,参数:

  • contentHeight
  • contentHeightChanged
  • contentWidth
  • contentWidthChanged

!!!onDidDispose​

editor被销毁时, 返回void

!!!onDidFocusEditorText​

聚焦时

onDidFocusEditorWidget​

聚焦widget时

!!!onDidLayoutChange​

布局改变时,如: 设置了automaticLayout,resize时布局发生改变

!!!onDidPaste​

粘贴文本时

onDidScrollChange​

滚动信息发生改变时

onKeyDown​

按键按下时

onKeyUp​

按键抬起时

onMouseDown​

鼠标按下时

onMouseLeave​

鼠标离开时

onMouseMove​

鼠标划过时

onMouseUp​

鼠标抬起时

onDidCompositionEnd 组合结束​

onDidCompositionStart 组合开始​

方法​

addAction​

自定义操作

editor.addAction({
// An unique identifier of the contributed action.
id: 'my-unique-id',

// A label of the action that will be presented to the user.
label: 'My Label!!!',

// An optional array of keybindings for the action.
keybindings: [ // 快捷键
monaco.KeyMod.CtrlCmd | monaco.KeyCode.KeyU, // 组合键
// chord
monaco.KeyMod.chord( // 分步组合键
monaco.KeyMod.CtrlCmd | monaco.KeyCode.KeyI,
monaco.KeyMod.CtrlCmd | monaco.KeyCode.KeyO
)
],

// A precondition for this action.
precondition: null, // 前提

// A rule to evaluate on top of the precondition in order to dispatch the keybindings.
keybindingContext: null,

contextMenuGroupId: 'navigation',

contextMenuOrder: 1.5,

// Method that will be executed when the action is triggered.
// @param editor The editor instance is passed in as a convenience
run: function (ed) { // 触发时执行
alert("i'm running => " + ed.getPosition());
}
});

addCommand​

自定义指令 语法:

// 第三个参数为string, 是contentKey(一个带值的唯一key),见例子:
// https://microsoft.github.io/monaco-editor/playground.html#interacting-with-the-editor-adding-a-command-to-an-editor-instance
addCommand(keybinding: number, handler: ICommandHandler, context?: string): string

使用:

editor.addCommand(monaco.KeyCode.F9, function () {
alert('F9 pressed!');
});

addContentWidget​

自定义一些小部件,放在编辑器内部

var contentWidget = {
domNode: null,
getId: function () {
return 'my.content.widget';
},
getDomNode: function () {
if (!this.domNode) {
this.domNode = document.createElement('div');
this.domNode.innerHTML = 'My content widget';
this.domNode.style.background = 'grey';
}
return this.domNode;
},
getPosition: function () {
return {
position: {
lineNumber: 7,
column: 8
},
preference: [
monaco.editor.ContentWidgetPositionPreference.ABOVE,
monaco.editor.ContentWidgetPositionPreference.BELOW
]
};
}
};
editor.addContentWidget(contentWidget);

addOverlayWidget​

var overlayWidget = {
domNode: null,
getId: function () {
return 'my.overlay.widget';
},
getDomNode: function () {
if (!this.domNode) {
this.domNode = document.createElement('div');
this.domNode.innerHTML = 'My overlay widget';
this.domNode.style.background = 'grey';
this.domNode.style.right = '30px';
this.domNode.style.top = '50px';
}
return this.domNode;
},
getPosition: function () {
return null;
}
};
editor.addOverlayWidget(overlayWidget);

applyFontInfo​

让编辑器字体对齐target元素的字体

applyFontInfo(target: HTMLElement): void;

changeViewZones​

在编辑器中生成一块区域,这个区域会把命中区域的代码往后推

viewZones

见07.viewZone视图区域

createContextKey​

创建一个ContextKey,ContextKey是一个带唯一值的stringkey,可以addCommand方法的第三个参数中使用

contextKey的使用见 Demo

createDecorationsCollection​

创建decorations集合

var decorations = editor.createDecorationsCollection(
[
{
range: new monaco.Range(3, 1, 5, 1),
options: {
isWholeLine: true,
linesDecorationsClassName: 'myLineDecoration'
}
},
{
range: new monaco.Range(7, 1, 7, 24),
options: { inlineClassName: 'myInlineDecoration' }
}
]
);

deltaDecorations​

创建decorations集合,官方推荐使用createDecorationsCollection

var decorations = editor.deltaDecorations(
[],
[
{
range: new monaco.Range(3, 1, 5, 1),
options: {
isWholeLine: true,
linesDecorationsClassName: 'myLineDecoration'
}
},
{
range: new monaco.Range(7, 1, 7, 24),
options: { inlineClassName: 'myInlineDecoration' }
}
]
);

dispose​

注销编辑器

useEffect(() => {
// didmount do something
// ...

// willunmount do something
return () => {
editor.dispose();
};
}, []);

executeCommand​

执行指令(未知使用)

executeCommand(source: string | null | undefined, command: ICommand): void;

executeCommands​

执行多个指令

executeEdits​

执行编辑(未知使用)

executeEdits(source: string, edits: IIdentifiedSingleEditOperation[], endCursorState?: ICursorStateComputer | Selection[]): boolean

focus​

将浏览器焦点带到编辑器文本

editor.focus();

getAction​

获取action,返回IEditorAction对象

getAction(id: string): IEditorAction

getBottomForLineNumber​

获取该行底部相对于第一行的垂直位置(顶部偏移)。

getBottomForLineNumber(lineNumber: number): number

getContainerDomNode​

获取容器Dom节点

getContainerDomNode(): HTMLElement

editor.getContainerDomNode()

getContentHeight​

获取编辑器内容的高度。这是在计算时被“擦除”的信息scrollHeight = Math.max(contentHeight, height)

getContentHeight(): number

editor.getContentHeight()

getContentWidth​

获取编辑器内容的宽度。这是在计算时被“擦除”的信息scrollWidth = Math.max(contentWidth, width)

getContentWidth(): number

editor.getContentWidth(): number();

getContribution​

获得编辑器的贡献者(每次创建新编辑器时都会创建编辑器贡献,并在编辑器被处置时被处置。)。

getContribution<T extends IEditorContribution>(id: string): T | null;

editor.getContribution('贡献者id')

getDecorationsInRange​

获取范围内的所有装饰(从其他编辑器中过滤掉装饰)。

getDecorationsInRange(range: Range): IModelDecoration[]

export class Range {
/**
* Line number on which the range starts (starts at 1).
*/
readonly startLineNumber: number;
/**
* Column on which the range starts in line `startLineNumber` (starts at 1).
*/
readonly startColumn: number;
/**
* Line number on which the range ends.
*/
readonly endLineNumber: number;
/**
* Column on which the range ends in line `endLineNumber`.
*/
readonly endColumn: number;
constructor(startLineNumber: number, startColumn: number, endLineNumber: number, endColumn: number);
/**
* Test if this range is empty.
*/
isEmpty(): boolean;
/**
* Test if `range` is empty.
*/
static isEmpty(range: IRange): boolean;
/**
* Test if position is in this range. If the position is at the edges, will return true.
*/
containsPosition(position: IPosition): boolean;
/**
* Test if `position` is in `range`. If the position is at the edges, will return true.
*/
static containsPosition(range: IRange, position: IPosition): boolean;
/**
* Test if range is in this range. If the range is equal to this range, will return true.
*/
containsRange(range: IRange): boolean;
/**
* Test if `otherRange` is in `range`. If the ranges are equal, will return true.
*/
static containsRange(range: IRange, otherRange: IRange): boolean;
/**
* Test if `range` is strictly in this range. `range` must start after and end before this range for the result to be true.
*/
strictContainsRange(range: IRange): boolean;
/**
* Test if `otherRange` is strictly in `range` (must start after, and end before). If the ranges are equal, will return false.
*/
static strictContainsRange(range: IRange, otherRange: IRange): boolean;
/**
* A reunion of the two ranges.
* The smallest position will be used as the start point, and the largest one as the end point.
*/
plusRange(range: IRange): Range;
/**
* A reunion of the two ranges.
* The smallest position will be used as the start point, and the largest one as the end point.
*/
static plusRange(a: IRange, b: IRange): Range;
/**
* A intersection of the two ranges.
*/
intersectRanges(range: IRange): Range | null;
/**
* A intersection of the two ranges.
*/
static intersectRanges(a: IRange, b: IRange): Range | null;
/**
* Test if this range equals other.
*/
equalsRange(other: IRange | null): boolean;
/**
* Test if range `a` equals `b`.
*/
static equalsRange(a: IRange | null, b: IRange | null): boolean;
/**
* Return the end position (which will be after or equal to the start position)
*/
getEndPosition(): Position;
/**
* Return the end position (which will be after or equal to the start position)
*/
static getEndPosition(range: IRange): Position;
/**
* Return the start position (which will be before or equal to the end position)
*/
getStartPosition(): Position;
/**
* Return the start position (which will be before or equal to the end position)
*/
static getStartPosition(range: IRange): Position;
/**
* Transform to a user presentable string representation.
*/
toString(): string;
/**
* Create a new range using this range's start position, and using endLineNumber and endColumn as the end position.
*/
setEndPosition(endLineNumber: number, endColumn: number): Range;
/**
* Create a new range using this range's end position, and using startLineNumber and startColumn as the start position.
*/
setStartPosition(startLineNumber: number, startColumn: number): Range;
/**
* Create a new empty range using this range's start position.
*/
collapseToStart(): Range;
/**
* Moves the range by the given amount of lines.
*/
delta(lineCount: number): Range;
/**
* Create a new empty range using this range's start position.
*/
static collapseToStart(range: IRange): Range;
static fromPositions(start: IPosition, end?: IPosition): Range;
/**
* Create a `Range` from an `IRange`.
*/
static lift(range: undefined | null): null;
static lift(range: IRange): Range;
static lift(range: IRange | undefined | null): Range | null;
/**
* Test if `obj` is an `IRange`.
*/
static isIRange(obj: any): obj is IRange;
/**
* Test if the two ranges are touching in any way.
*/
static areIntersectingOrTouching(a: IRange, b: IRange): boolean;
/**
* Test if the two ranges are intersecting. If the ranges are touching it returns true.
*/
static areIntersecting(a: IRange, b: IRange): boolean;
/**
* A function that compares ranges, useful for sorting ranges
* It will first compare ranges on the startPosition and then on the endPosition
*/
static compareRangesUsingStarts(a: IRange | null | undefined, b: IRange | null | undefined): number;
/**
* A function that compares ranges, useful for sorting ranges
* It will first compare ranges on the endPosition and then on the startPosition
*/
static compareRangesUsingEnds(a: IRange, b: IRange): number;
/**
* Test if the range spans multiple lines.
*/
static spansMultipleLines(range: IRange): boolean;
toJSON(): IRange;
}

getDomNode​

返回编辑器的dom节点

getDomNode(): HTMLElement
editor.getDomNode()

getEditorType​

获取编辑器类型。请看EditorType。这是为了避免 instanceof 检查

getEditorType(): string

/**
* The type of the `IEditor`.
*/
export const EditorType: {
ICodeEditor: string;
IDiffEditor: string;
};

getId​

获取此编辑器实例的唯一 ID。

getId(): string

editor.getId();

getLayoutInfo​

获取编辑器的布局信息。

getLayoutInfo(): EditorLayoutInfo

export interface EditorLayoutInfo {
/**
* 编辑器宽度
*/
readonly width: number;
/**
* 编辑器高度
*/
readonly height: number;
/**
* 字形边距的左侧位置。
*/
readonly glyphMarginLeft: number;
/**
* 字形边距的宽度。
*/
readonly glyphMarginWidth: number;
/**
* 行号的左侧位置。
*/
readonly lineNumbersLeft: number;
/**
* 行号的宽度。
*/
readonly lineNumbersWidth: number;
/**
* 线条装饰的左侧位置。
*/
readonly decorationsLeft: number;
/**
* 线条装饰的宽度。
*/
readonly decorationsWidth: number;
/**
* 内容的左侧位置(实际文本)
*/
readonly contentLeft: number;
/**
* 内容的宽度(实际文本)
*/
readonly contentWidth: number;
/**
* 小地图的布局信息
*/
readonly minimap: EditorMinimapLayoutInfo;
/**
* 适合视口线的列数(典型字符)。
*/
readonly viewportColumn: number;
/**
* 是否缩小了自动换行
*/
readonly isWordWrapMinified: boolean;
/**
* 是否视口环绕
*/
readonly isViewportWrapping: boolean;
/**
* 包装列
*/
readonly wrappingColumn: number;
/**
* 垂直滚动条的宽度。
*/
readonly verticalScrollbarWidth: number;
/**
* 水平滚动条的高度。
*/
readonly horizontalScrollbarHeight: number;
/**
* 概览标尺的位置。
*/
readonly overviewRuler: OverviewRulerPosition;
}

getLineDecorations​

获取一行中的所有装饰(过滤掉其他编辑器的装饰)。

getLineDecorations(lineNumber: number): IModelDecoration[]

getModel​

获取模型,见05.model模型

getModel(): ITextModel

editor.getModel();

getOffsetForColumn​

获取列的水平位置(左偏移量)到行的开头。此方法仅在lineNumber当前呈现该行(在编辑器的视口中)时才有效。请谨慎使用此方法。

getOffsetForColumn(lineNumber: number, column: number): number

getOption​

通过id获取特定的编辑器选项。

getOption<T extends EditorOption>(id: T): FindComputedEditorOptionValueById<T>;

editor.getOption(EditorOption);

export enum EditorOption {
acceptSuggestionOnCommitCharacter = 0,
acceptSuggestionOnEnter = 1,
accessibilitySupport = 2,
accessibilityPageSize = 3,
ariaLabel = 4,
autoClosingBrackets = 5,
autoClosingDelete = 6,
autoClosingOvertype = 7,
autoClosingQuotes = 8,
autoIndent = 9,
automaticLayout = 10,
autoSurround = 11,
bracketPairColorization = 12,
guides = 13,
codeLens = 14,
codeLensFontFamily = 15,
codeLensFontSize = 16,
colorDecorators = 17,
columnSelection = 18,
comments = 19,
contextmenu = 20,
copyWithSyntaxHighlighting = 21,
cursorBlinking = 22,
cursorSmoothCaretAnimation = 23,
cursorStyle = 24,
cursorSurroundingLines = 25,
cursorSurroundingLinesStyle = 26,
cursorWidth = 27,
disableLayerHinting = 28,
disableMonospaceOptimizations = 29,
domReadOnly = 30,
dragAndDrop = 31,
dropIntoEditor = 32,
emptySelectionClipboard = 33,
extraEditorClassName = 34,
fastScrollSensitivity = 35,
find = 36,
fixedOverflowWidgets = 37,
folding = 38,
foldingStrategy = 39,
foldingHighlight = 40,
foldingImportsByDefault = 41,
foldingMaximumRegions = 42,
unfoldOnClickAfterEndOfLine = 43,
fontFamily = 44,
fontInfo = 45,
fontLigatures = 46,
fontSize = 47,
fontWeight = 48,
formatOnPaste = 49,
formatOnType = 50,
glyphMargin = 51,
gotoLocation = 52,
hideCursorInOverviewRuler = 53,
hover = 54,
inDiffEditor = 55,
inlineSuggest = 56,
letterSpacing = 57,
lightbulb = 58,
lineDecorationsWidth = 59,
lineHeight = 60,
lineNumbers = 61,
lineNumbersMinChars = 62,
linkedEditing = 63,
links = 64,
matchBrackets = 65,
minimap = 66,
mouseStyle = 67,
mouseWheelScrollSensitivity = 68,
mouseWheelZoom = 69,
multiCursorMergeOverlapping = 70,
multiCursorModifier = 71,
multiCursorPaste = 72,
occurrencesHighlight = 73,
overviewRulerBorder = 74,
overviewRulerLanes = 75,
padding = 76,
parameterHints = 77,
peekWidgetDefaultFocus = 78,
definitionLinkOpensInPeek = 79,
quickSuggestions = 80,
quickSuggestionsDelay = 81,
readOnly = 82,
renameOnType = 83,
renderControlCharacters = 84,
renderFinalNewline = 85,
renderLineHighlight = 86,
renderLineHighlightOnlyWhenFocus = 87,
renderValidationDecorations = 88,
renderWhitespace = 89,
revealHorizontalRightPadding = 90,
roundedSelection = 91,
rulers = 92,
scrollbar = 93,
scrollBeyondLastColumn = 94,
scrollBeyondLastLine = 95,
scrollPredominantAxis = 96,
selectionClipboard = 97,
selectionHighlight = 98,
selectOnLineNumbers = 99,
showFoldingControls = 100,
showUnused = 101,
snippetSuggestions = 102,
smartSelect = 103,
smoothScrolling = 104,
stickyScroll = 105,
stickyTabStops = 106,
stopRenderingLineAfter = 107,
suggest = 108,
suggestFontSize = 109,
suggestLineHeight = 110,
suggestOnTriggerCharacters = 111,
suggestSelection = 112,
tabCompletion = 113,
tabIndex = 114,
unicodeHighlighting = 115,
unusualLineTerminators = 116,
useShadowDOM = 117,
useTabStops = 118,
wordSeparators = 119,
wordWrap = 120,
wordWrapBreakAfterCharacters = 121,
wordWrapBreakBeforeCharacters = 122,
wordWrapColumn = 123,
wordWrapOverride1 = 124,
wordWrapOverride2 = 125,
wrappingIndent = 126,
wrappingStrategy = 127,
showDeprecated = 128,
inlayHints = 129,
editorClassName = 130,
pixelRatio = 131,
tabFocusMode = 132,
layoutInfo = 133,
wrappingInfo = 134
}

getOptions​

获取所有编辑器计算的选项。EditorOption见03.editor options

getOptions(): IComputedEditorOptions

editor.getOptions();

getPosition​

返回光标的位置。

getPosition(): Position

export class Position {
/**
* 行号 (从1开始)
*/
readonly lineNumber: number;
/**
* 列数 (第一个字符是在1和2列之间)
*/
readonly column: number;
/**
* 构建函数:new Position(lineNumber: number, column: number): Position
*/
constructor(lineNumber: number, column: number);
/**
* 从当前位置创建一个新的位置。
*
* @param newLineNumber new line number
* @param newColumn new column
*/
with(newLineNumber?: number, newColumn?: number): Position;
/**
* Derive a new position from this position.
* 从这个位置得到一个新的位置。
*
* @param deltaLineNumber line number delta
* @param deltaColumn column delta
*/
delta(deltaLineNumber?: number, deltaColumn?: number): Position;
/**
* 测试当前位置是否等于其他位置
*/
equals(other: IPosition): boolean;
/**
* 测试位置A是否等于位置B
*/
static equals(a: IPosition | null, b: IPosition | null): boolean;
/**
* 测试此位置是否在其他位置之前。
* 如果两个位置相等,结果将为 false。
*/
isBefore(other: IPosition): boolean;
/**
* 测试位置A是否在位置B之前。
* 如果两个位置相等,结果将为 false。
*/
static isBefore(a: IPosition, b: IPosition): boolean;
/**
* 测试此位置是否在其他位置之前。
* 如果两个位置相等,结果将为 true。
*/
isBeforeOrEqual(other: IPosition): boolean;
/**
* 测试位置A是否在位置B之前。
* 如果两个位置相等,结果将为 true。
*/
static isBeforeOrEqual(a: IPosition, b: IPosition): boolean;
/**
* 比较两个位置,用于排序
*/
static compare(a: IPosition, b: IPosition): number;
/**
* 复制
*/
clone(): Position;
/**
* 转换成string
*/
toString(): string;
/**
* 创建postion
*/
static lift(pos: IPosition): Position;
/**
* 测试是否是position
*/
static isIPosition(obj: any): obj is IPosition;
}

getRawOptions​

返回编辑器的配置(没有任何验证或默认值)。


getRawOptions(): IEditorOptions

getScrollHeight​

获取编辑器视口的滚动高度。

getScrollHeight(): number

getScrollLeft​

获取编辑器视口的 scrollLeft

getScrollLeft(): number

getScrollTop​

获取编辑器视口的 scrollTop

getScrollTop(): number

getScrollWidth​

获取编辑器视口的滚动宽度

getScrollWidth(): number

getScrolledVisiblePosition​

获取 可见位置position。

结果位置考虑了滚动,并且相对于编辑器的左上角。 position说明

  1. 如果用户滚动编辑器,此方法的结果将发生相同的变化。
  2. 如果编辑器的容器被重新定位,该方法的结果不会改变。
  3. 警告:对于当前编辑器视口之外的位置,此方法的结果不准确。
getScrolledVisiblePosition(position: IPosition): { height: number; left: number; top: number }

getSelection​

返回编辑器的选区。

getSelection(): Selection

export class Selection extends Range {
/**
* 选区开始位置的行号
*/
readonly selectionStartLineNumber: number;
/**
* 选区开始位置的列数
*/
readonly selectionStartColumn: number;
/**
* 选区结尾位置的行号
*/
readonly positionLineNumber: number;
/**
* 选区结尾位置的列数
*/
readonly positionColumn: number;
/**
* 构造函数:
* new Selection(selectionStartLineNumber: number, selectionStartColumn: number, positionLineNumber: number, positionColumn: number): Selection
*/
constructor(selectionStartLineNumber: number, selectionStartColumn: number, positionLineNumber: number, positionColumn: number);
/**
* 转string
*/
toString(): string;
/**
* 测试两个选区是否相同
*/
equalsSelection(other: ISelection): boolean;
/**
* 测试两个选区是否相同
*/
static selectionsEqual(a: ISelection, b: ISelection): boolean;
/**
* 获取选区方向(从左到右 | 从右到左)
*/
getDirection(): SelectionDirection;
/**
* 根据 结尾行号 和 结尾列数 创建选区
*/
setEndPosition(endLineNumber: number, endColumn: number): Selection;
/**
* 获取选区结尾的位置
*/
getPosition(): Position;
/**
* 获取选区开始的位置
*/
getSelectionStart(): Position;
/**
* 根据 开始行号 和 开始列数 创建选区
*/
setStartPosition(startLineNumber: number, startColumn: number): Selection;
/**
* 根据 起始位置 和 结束位置 创建选区
*/
static fromPositions(start: IPosition, end?: IPosition): Selection;
/**
* 根据 Range 和 方向 创建选区
*/
static fromRange(range: Range, direction: SelectionDirection): Selection;
/**
* 创建选区
*/
static liftSelection(sel: ISelection): Selection;
/**
* 选区数组是否相同
*/
static selectionsArrEqual(a: ISelection[], b: ISelection[]): boolean;
/**
* 判断是否是个选区
*/
static isISelection(obj: any): obj is ISelection;
/**
* 根据 开始行号、开始列数、结束行号、结束列数 和 方向 创建选区
*/
static createWithDirection(startLineNumber: number, startColumn: number, endLineNumber: number, endColumn: number, direction: SelectionDirection): Selection;
}

getSelections​

返回编辑器的所有选择。

getSelections(): Selection[]

getSupportedActions​

返回与此编辑器关联的所有操作 action。

getSupportedActions(): IEditorAction[]

getTargetAtClientPoint​

命中测试目标(clientX和clientY)。坐标相对于视口的左上角。

getTargetAtClientPoint(clientX: number, clientY: number): IMouseTarget

getTopForLineNumber​


getTopForPosition​


getValue​


getVisibleColumnFromPosition​


getVisibleRanges​


hasTextFocus​


hasWidgetFocus​


layout​


layoutContentWidget​


layoutOverlayWidget​


popUndoStop​


pushUndoStop​


removeContentWidget​


removeDecorations​


removeOverlayWidget​


render​


restoreViewState​


revealLine​


revealLineInCenter​


revealLineInCenterIfOutsideViewport​


revealLineNearTop​


revealLines​


revealLinesInCenter​


revealLinesInCenterIfOutsideViewport​


revealLinesNearTop​


revealPosition​


revealPositionInCenter​


revealPositionInCenterIfOutsideViewport​


revealPositionNearTop​


revealRange​


revealRangeAtTop​


revealRangeInCenter​


revealRangeInCenterIfOutsideViewport​


revealRangeNearTop​


revealRangeNearTopIfOutsideViewport​


saveViewState​


setBanner​


setModel​


setPosition​


setScrollLeft​


setScrollPosition​


setScrollTop​


setSelection​


setSelections​


setValue​


trigger​


updateOptions​