Path: blob/main/extensions/copilot/test/simulation/fixtures/edit-import-assert/index.ts
13399 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 { CellViewModel } from 'vs/workbench/contrib/notebook/browser/viewModel/notebookViewModelImpl';6import { ICellRange } from 'vs/workbench/contrib/notebook/common/notebookRange';78const enum CellEditorRevealType {9Line,10Range11}1213const enum CellRevealPosition {14Top,15Center,16Bottom,17NearTop18}1920function getVisibleCells(cells: CellViewModel[], hiddenRanges: ICellRange[]) {21if (!hiddenRanges.length) {22return cells;23}2425let start = 0;26let hiddenRangeIndex = 0;27const result: CellViewModel[] = [];2829while (start < cells.length && hiddenRangeIndex < hiddenRanges.length) {30if (start < hiddenRanges[hiddenRangeIndex].start) {31result.push(...cells.slice(start, hiddenRanges[hiddenRangeIndex].start));32}3334start = hiddenRanges[hiddenRangeIndex].end + 1;35hiddenRangeIndex++;36}3738if (start < cells.length) {39result.push(...cells.slice(start));40}4142return result;43}4445export const NOTEBOOK_WEBVIEW_BOUNDARY = 5000;4647function validateWebviewBoundary(element: HTMLElement) {48const webviewTop = 0 - (parseInt(element.style.top, 10) || 0);49return webviewTop >= 0 && webviewTop <= NOTEBOOK_WEBVIEW_BOUNDARY * 2;50}515253