Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/extensions/copilot/test/simulation/fixtures/edit-import-assert/index.ts
13399 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 { CellViewModel } from 'vs/workbench/contrib/notebook/browser/viewModel/notebookViewModelImpl';
7
import { ICellRange } from 'vs/workbench/contrib/notebook/common/notebookRange';
8
9
const enum CellEditorRevealType {
10
Line,
11
Range
12
}
13
14
const enum CellRevealPosition {
15
Top,
16
Center,
17
Bottom,
18
NearTop
19
}
20
21
function getVisibleCells(cells: CellViewModel[], hiddenRanges: ICellRange[]) {
22
if (!hiddenRanges.length) {
23
return cells;
24
}
25
26
let start = 0;
27
let hiddenRangeIndex = 0;
28
const result: CellViewModel[] = [];
29
30
while (start < cells.length && hiddenRangeIndex < hiddenRanges.length) {
31
if (start < hiddenRanges[hiddenRangeIndex].start) {
32
result.push(...cells.slice(start, hiddenRanges[hiddenRangeIndex].start));
33
}
34
35
start = hiddenRanges[hiddenRangeIndex].end + 1;
36
hiddenRangeIndex++;
37
}
38
39
if (start < cells.length) {
40
result.push(...cells.slice(start));
41
}
42
43
return result;
44
}
45
46
export const NOTEBOOK_WEBVIEW_BOUNDARY = 5000;
47
48
function validateWebviewBoundary(element: HTMLElement) {
49
const webviewTop = 0 - (parseInt(element.style.top, 10) || 0);
50
return webviewTop >= 0 && webviewTop <= NOTEBOOK_WEBVIEW_BOUNDARY * 2;
51
}
52
53