make NotebookEditor#selections writeable, https://github.com/microsoft/vscode/issues/125275

This commit is contained in:
Johannes Rieken
2021-06-07 17:07:46 +02:00
parent cec19dcfdc
commit 76fe0c90b0
4 changed files with 22 additions and 1 deletions

View File

@@ -9,6 +9,7 @@ import * as extHostConverter from 'vs/workbench/api/common/extHostTypeConverters
import { CellEditType, ICellEditOperation, ICellReplaceEdit } from 'vs/workbench/contrib/notebook/common/notebookCommon';
import * as vscode from 'vscode';
import { ExtHostNotebookDocument } from './extHostNotebookDocument';
import { illegalArgument } from 'vs/base/common/errors';
interface INotebookEditData {
documentVersionId: number;
@@ -107,6 +108,13 @@ export class ExtHostNotebookEditor {
get selections() {
return that._selections;
},
set selections(value: vscode.NotebookRange[]) {
if (!Array.isArray(value) || !value.every(extHostTypes.NotebookRange.isNotebookRange)) {
throw illegalArgument('selections');
}
that._selections = value;
that._trySetSelections(value);
},
get visibleRanges() {
return that._visibleRanges;
},
@@ -151,6 +159,10 @@ export class ExtHostNotebookEditor {
this._selections = selections;
}
private _trySetSelections(value: vscode.NotebookRange[]): void {
this._proxy.$trySetSelections(this.id, value.map(extHostConverter.NotebookRange.from));
}
_acceptViewColumn(value: vscode.ViewColumn | undefined) {
this._viewColumn = value;
}