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