Path: blob/main/extensions/copilot/src/util/common/test/shims/notebookEditor.ts
13405 views
/*---------------------------------------------------------------------------------------------1* Copyright (c) Microsoft Corporation. All rights reserved.2* Licensed under the MIT License. See License.txt in the project root for license information.3*--------------------------------------------------------------------------------------------*/45import type * as vscode from 'vscode';6import { ExtHostNotebookDocumentData } from './notebookDocument';78export class ExtHostNotebookEditor {9private _selections: vscode.NotebookRange[] = [];10private _viewColumn?: vscode.ViewColumn;11private _editor?: vscode.NotebookEditor;1213constructor(14readonly notebookData: ExtHostNotebookDocumentData,15selections: vscode.NotebookRange[]16) {17this._selections = selections;18}1920get apiEditor(): vscode.NotebookEditor {21if (!this._editor) {22const that = this;23this._editor = {24get notebook() {25return that.notebookData.document;26},27get selection() {28return that._selections[0];29},30set selection(selection: vscode.NotebookRange) {31this.selections = [selection];32},33get selections() {34return that._selections;35},36set selections(value: vscode.NotebookRange[]) {37that._selections = value;38},39get visibleRanges() {40return [];41},42revealRange(range, revealType) {43// no-op44},45get viewColumn() {46return that._viewColumn;47},48};49}50return this._editor;51}52}5354