Skip to main content

modules/window/editor

Interfaces​

Position​

Defined in: modules/window/editor.d.ts:7

Properties​

character​

character: number

Defined in: modules/window/editor.d.ts:11

The 1-based character/column value.

line​

line: number

Defined in: modules/window/editor.d.ts:9

The 1-based line value.


Selection​

Defined in: modules/window/editor.d.ts:14

Properties​

end​

end: Position

Defined in: modules/window/editor.d.ts:18

The end position of the selection.

start​

start: Position

Defined in: modules/window/editor.d.ts:16

The start position of the selection.


TextDocument​

Defined in: modules/window/editor.d.ts:21

Properties​

fileName​

readonly fileName: string

Defined in: modules/window/editor.d.ts:25

The file name without the path (e.g., 'main.js').

languageId​

readonly languageId: string

Defined in: modules/window/editor.d.ts:27

The identifier of the language associated with this document (e.g., 'javascript').

uri​

readonly uri: string

Defined in: modules/window/editor.d.ts:23

The associated URI for this document (e.g., 'file:///src/main.js').

Methods​

getText()​

getText(): string

Defined in: modules/window/editor.d.ts:33

Retrieves the complete text content of this document.

Returns​

string

The text of this document as a string.


TextEditor​

Defined in: modules/window/editor.d.ts:71

Represents an active text editor in Mono Studio. Gives access to the document content, cursor selection, and safe editing methods.

Properties​

_rawMonacoEditor​

readonly _rawMonacoEditor: any

Defined in: modules/window/editor.d.ts:109

⚠️ ADVANCED / ESCAPE HATCH: Returns the raw underlying Monaco Editor instance. Modifying the editor directly may bypass internal MS Code event listeners and cause memory leaks. Use this ONLY when you need to access advanced native Monaco APIs (like decorations or widgets).

Example​
const editor = mscode.window.activeTextEditor;
const monacoInstance = editor._rawMonacoEditor;
if (monacoInstance) {
monacoInstance.focus();
}
cursor​

readonly cursor: object

Defined in: modules/window/editor.d.ts:77

The current cursor position (1-based index).

column​

column: number

line​

line: number

document​

readonly document: TextDocument

Defined in: modules/window/editor.d.ts:73

The document associated with this text editor.

options​

readonly options: TextEditorOptions

Defined in: modules/window/editor.d.ts:79

Text editor layout and indentation options.

selection​

readonly selection: Selection | null

Defined in: modules/window/editor.d.ts:75

The primary selection on this text editor.

Methods​

edit()​

edit(callback): boolean

Defined in: modules/window/editor.d.ts:95

Perform an edit on the document associated with this text editor. The edits are safely pushed to the editor's undo/redo stack.

Parameters​
callback​

(editBuilder) => void

A function that receives an editBuilder to queue modifications.

Returns​

boolean

true if the edit was successfully applied, false otherwise.

Example​
const editor = mscode.window.activeTextEditor;
editor.edit((editBuilder) => {
// Insert a console.log at line 1, column 1
editBuilder.insert(1, 1, "console.log('Hello');\n");
});

TextEditorEdit​

Defined in: modules/window/editor.d.ts:47

A complex edit that will be applied in one transaction on a TextEditor. This is passed to the callback of the TextEditor.edit method.

Methods​

insert()​

insert(line, column, text): void

Defined in: modules/window/editor.d.ts:54

Insert text at a specific location.

Parameters​
line​

number

The 1-based line number.

column​

number

The 1-based column number.

text​

string

The text to insert.

Returns​

void

replace()​

replace(startLine, startCol, endLine, endCol, text): void

Defined in: modules/window/editor.d.ts:64

Replace a certain text region with a new value.

Parameters​
startLine​

number

The 1-based start line number.

startCol​

number

The 1-based start column number.

endLine​

number

The 1-based end line number.

endCol​

number

The 1-based end column number.

text​

string

The new text to insert.

Returns​

void


TextEditorOptions​

Defined in: modules/window/editor.d.ts:36

Properties​

insertSpaces​

insertSpaces: boolean

Defined in: modules/window/editor.d.ts:40

Whether spaces should be used instead of tabs.

tabSize​

tabSize: number

Defined in: modules/window/editor.d.ts:38

The size in spaces a tab takes.

References​

ActivityBarItemOptions​

Re-exports ActivityBarItemOptions


app​

Re-exports app


authentication​

Re-exports authentication


BookmarkFolder​

Re-exports BookmarkFolder


CommandMetadata​

Re-exports CommandMetadata


commands​

Re-exports commands


CommitOptions​

Re-exports CommitOptions


ConfigurationProperty​

Re-exports ConfigurationProperty


CopyOptions​

Re-exports CopyOptions


Diagnostic​

Re-exports Diagnostic


DiagnosticCollection​

Re-exports DiagnosticCollection


DiagnosticSeverity​

Re-exports DiagnosticSeverity


Disposable​

Re-exports Disposable


DocumentSymbol​

Re-exports DocumentSymbol


ExtensionContext​

Re-exports ExtensionContext


ExtensionInfo​

Re-exports ExtensionInfo


extensions​

Re-exports extensions


FileDecoration​

Re-exports FileDecoration


FileFilter​

Re-exports FileFilter


FileStat​

Re-exports FileStat


FileSystemAPI​

Re-exports FileSystemAPI


FindOptions​

Re-exports FindOptions


fs​

Re-exports fs


git​

Re-exports git


GitBranch​

Re-exports GitBranch


GitChangedFile​

Re-exports GitChangedFile


GitCommit​

Re-exports GitCommit


GitFileStatus​

Re-exports GitFileStatus


GitHubUser​

Re-exports GitHubUser


GitRepository​

Re-exports GitRepository


GitSortMode​

Re-exports GitSortMode


GitStash​

Re-exports GitStash


IConfigurationSection​

Re-exports IConfigurationSection


IconThemeDefinition​

Re-exports IconThemeDefinition


IconThemeMap​

Re-exports IconThemeMap


InputBoxOptions​

Re-exports InputBoxOptions


languages​

Re-exports languages


lsp​

Re-exports lsp


LspServerConfig​

Re-exports LspServerConfig


Re-exports MenuItem


Re-exports menus


ModalOptions​

Re-exports ModalOptions


MSCodeUIColors​

Re-exports MSCodeUIColors


MultiPickerOptions​

Re-exports MultiPickerOptions


NotificationAction​

Re-exports NotificationAction


OutputChannel​

Re-exports OutputChannel


PickerOptions​

Re-exports PickerOptions


ProgressNotification​

Re-exports ProgressNotification


QuickPickItem​

Re-exports QuickPickItem


QuickPickOptions​

Re-exports QuickPickOptions


RecentWorkspace​

Re-exports RecentWorkspace


ReplaceOptions​

Re-exports ReplaceOptions


ResolvedIcon​

Re-exports ResolvedIcon


Re-exports search


SearchFileResult​

Re-exports SearchFileResult


SearchMatch​

Re-exports SearchMatch


SettingOption​

Re-exports SettingOption


SettingType​

Re-exports SettingType


SidebarPanelDef​

Re-exports SidebarPanelDef


SidebarPanelHeader​

Re-exports SidebarPanelHeader


SidebarSectionContent​

Re-exports SidebarSectionContent


SidebarSectionContext​

Re-exports SidebarSectionContext


SidebarSectionDef​

Re-exports SidebarSectionDef


SidebarState​

Re-exports SidebarState


SilentSearchOptions​

Re-exports SilentSearchOptions


StashOptions​

Re-exports StashOptions


StatusBarAlignment​

Re-exports StatusBarAlignment


StatusBarItemController​

Re-exports StatusBarItemController


StatusBarItemOptions​

Re-exports StatusBarItemOptions


SymbolKind​

Re-exports SymbolKind


SymbolProvider​

Re-exports SymbolProvider


Tab​

Re-exports Tab


TabDiffData​

Re-exports TabDiffData


TabOptions​

Re-exports TabOptions


TabType​

Re-exports TabType


TaskExecution​

Re-exports TaskExecution


TaskOptions​

Re-exports TaskOptions


tasks​

Re-exports tasks


Terminal​

Re-exports Terminal


TerminalExitStatus​

Re-exports TerminalExitStatus


TerminalOptions​

Re-exports TerminalOptions


termis​

Re-exports termis


TermisView​

Re-exports TermisView


ThemeDefinition​

Re-exports ThemeDefinition


themes​

Re-exports themes


TokenColor​

Re-exports TokenColor


TreeDataProvider​

Re-exports TreeDataProvider


TreeItem​

Re-exports TreeItem


TreeView​

Re-exports TreeView


TreeViewOptions​

Re-exports TreeViewOptions


window​

Re-exports window


workspace​

Re-exports workspace


WorkspaceConfiguration​

Re-exports WorkspaceConfiguration


WorkspaceFolder​

Re-exports WorkspaceFolder


WriteOptions​

Re-exports WriteOptions