Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/extensions/copilot/test/simulation/fixtures/edit-add-enum-variant/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
type CellViewModel = any;
7
type ICellRange = any;
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