repo_name
string
dataset
string
owner
string
lang
string
func_name
string
code
string
docstring
string
url
string
sha
string
aide
github_2023
codestoryai
typescript
NotebookEditorWidgetService._disposeWidget
private _disposeWidget(widget: NotebookEditorWidget): void { widget.onWillHide(); const domNode = widget.getDomNode(); widget.dispose(); domNode.remove(); }
// --- group-based editor borrowing...
https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/contrib/notebook/browser/services/notebookEditorServiceImpl.ts#L142-L147
1a8578f21ace8c9381461d295ed31c3500be43bf
aide
github_2023
codestoryai
typescript
NotebookEditorWidgetService.createWidget
protected createWidget(editorGroupContextKeyService: IContextKeyService, widgetDisposeStore: DisposableStore, editorGroupEditorProgressService: IEditorProgressService, creationOptions?: INotebookEditorCreationOptions, codeWindow?: CodeWindow, initialDimension?: Dimension) { const notebookInstantiationService = widget...
// protected for unit testing overrides
https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/contrib/notebook/browser/services/notebookEditorServiceImpl.ts#L241-L251
1a8578f21ace8c9381461d295ed31c3500be43bf
aide
github_2023
codestoryai
typescript
NotebookEditorWidgetService.addNotebookEditor
addNotebookEditor(editor: INotebookEditor): void { this._notebookEditors.set(editor.getId(), editor); this._onNotebookEditorAdd.fire(editor); }
// --- editor management
https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/contrib/notebook/browser/services/notebookEditorServiceImpl.ts#L263-L266
1a8578f21ace8c9381461d295ed31c3500be43bf
aide
github_2023
codestoryai
typescript
NotebookKernelService.selectKernelForNotebook
selectKernelForNotebook(kernel: INotebookKernel | undefined, notebook: INotebookTextModelLike): void { const key = NotebookTextModelLikeId.str(notebook); const oldKernel = this._notebookBindings.get(key); if (oldKernel !== kernel?.id) { if (kernel) { this._notebookBindings.set(key, kernel.id); } else { ...
// notebook <-1----N-> kernel
https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/contrib/notebook/browser/services/notebookKernelServiceImpl.ts#L278-L290
1a8578f21ace8c9381461d295ed31c3500be43bf
aide
github_2023
codestoryai
typescript
NotebookKernelService.getKernelSourceActions2
getKernelSourceActions2(notebook: INotebookTextModelLike): Promise<INotebookKernelSourceAction[]> { const viewType = notebook.notebookType; const providers = this._kernelSourceActionProviders.get(viewType) ?? []; const promises = providers.map(provider => provider.provideKernelSourceActions()); return Promise.a...
/** * Get kernel source actions from providers */
https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/contrib/notebook/browser/services/notebookKernelServiceImpl.ts#L413-L420
1a8578f21ace8c9381461d295ed31c3500be43bf
aide
github_2023
codestoryai
typescript
NotebookRendererMessagingService.receiveMessage
public receiveMessage(editorId: string | undefined, rendererId: string, message: unknown): Promise<boolean> { if (editorId === undefined) { const sends = [...this.scopedMessaging.values()].map(e => e.receiveMessageHandler?.(rendererId, message)); return Promise.all(sends).then(s => s.some(s => !!s)); } ret...
/** @inheritdoc */
https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/contrib/notebook/browser/services/notebookRendererMessagingServiceImpl.ts#L31-L38
1a8578f21ace8c9381461d295ed31c3500be43bf
aide
github_2023
codestoryai
typescript
NotebookRendererMessagingService.prepare
public prepare(rendererId: string) { if (this.activations.has(rendererId)) { return; } const queue: MessageToSend[] = []; this.activations.set(rendererId, queue); this.extensionService.activateByEvent(`onRenderer:${rendererId}`).then(() => { for (const message of queue) { this.postMessageEmitter.f...
/** @inheritdoc */
https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/contrib/notebook/browser/services/notebookRendererMessagingServiceImpl.ts#L41-L56
1a8578f21ace8c9381461d295ed31c3500be43bf
aide
github_2023
codestoryai
typescript
NotebookRendererMessagingService.getScoped
public getScoped(editorId: string): IScopedRendererMessaging { const existing = this.scopedMessaging.get(editorId); if (existing) { return existing; } const messaging: IScopedRendererMessaging = { postMessage: (rendererId, message) => this.postMessage(editorId, rendererId, message), dispose: () => thi...
/** @inheritdoc */
https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/contrib/notebook/browser/services/notebookRendererMessagingServiceImpl.ts#L59-L72
1a8578f21ace8c9381461d295ed31c3500be43bf
aide
github_2023
codestoryai
typescript
NotebookOutputRendererInfoStore.setPreferred
setPreferred(notebookProviderInfo: NotebookProviderInfo, mimeType: string, rendererId: string) { const mementoObj = this.preferredMimetype.value; const forNotebook = mementoObj[notebookProviderInfo.id]; if (forNotebook) { forNotebook[mimeType] = rendererId; } else { mementoObj[notebookProviderInfo.id] = {...
/** Update and remember the preferred renderer for the given mimetype in this workspace */
https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/contrib/notebook/browser/services/notebookServiceImpl.ts#L396-L406
1a8578f21ace8c9381461d295ed31c3500be43bf
aide
github_2023
codestoryai
typescript
NotebookService.createNotebookTextModel
async createNotebookTextModel(viewType: string, uri: URI, stream?: VSBufferReadableStream): Promise<NotebookTextModel> { if (this._models.has(uri)) { throw new Error(`notebook for ${uri} already exists`); } const info = await this.withNotebookDataProvider(viewType); if (!(info instanceof SimpleNotebookProvi...
// --- notebook documents: create, destory, retrieve, enumerate
https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/contrib/notebook/browser/services/notebookServiceImpl.ts#L757-L780
1a8578f21ace8c9381461d295ed31c3500be43bf
aide
github_2023
codestoryai
typescript
NotebookService.setToCopy
setToCopy(items: NotebookCellTextModel[], isCopy: boolean) { this._cutItems = items; this._lastClipboardIsCopy = isCopy; }
// --- copy & paste
https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/contrib/notebook/browser/services/notebookServiceImpl.ts#L900-L903
1a8578f21ace8c9381461d295ed31c3500be43bf
aide
github_2023
codestoryai
typescript
WorkerManager.constructor
constructor( private readonly _notebookService: INotebookService, private readonly _modelService: IModelService, ) { super(); this._editorWorkerClient = null; // this._lastWorkerUsedTime = (new Date()).getTime(); }
// private _lastWorkerUsedTime: number;
https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/contrib/notebook/browser/services/notebookWorkerServiceImpl.ts#L55-L62
1a8578f21ace8c9381461d295ed31c3500be43bf
aide
github_2023
codestoryai
typescript
updateVisibleRanges
const updateVisibleRanges = () => { if (!this.view.length) { return; } const top = this.getViewScrollTop(); const bottom = this.getViewScrollBottom(); if (top >= bottom) { return; } const topViewIndex = clamp(this.view.indexAt(top), 0, this.view.length - 1); const topElement = this.vie...
// update visibleRanges
https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/contrib/notebook/browser/view/notebookCellList.ts#L246-L269
1a8578f21ace8c9381461d295ed31c3500be43bf
aide
github_2023
codestoryai
typescript
NotebookCellList._getView
_getView() { return this.view; }
/** * Test Only */
https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/contrib/notebook/browser/view/notebookCellList.ts#L298-L300
1a8578f21ace8c9381461d295ed31c3500be43bf
aide
github_2023
codestoryai
typescript
NotebookCellList.updateHiddenAreasInView
updateHiddenAreasInView(oldRanges: ICellRange[], newRanges: ICellRange[]) { const oldViewCellEntries: CellViewModel[] = getVisibleCells(this._viewModel!.viewCells as CellViewModel[], oldRanges); const oldViewCellMapping = new Set<string>(); oldViewCellEntries.forEach(cell => { oldViewCellMapping.add(cell.uri.t...
/** * oldRanges and newRanges are all reduced and sorted. */
https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/contrib/notebook/browser/view/notebookCellList.ts#L503-L517
1a8578f21ace8c9381461d295ed31c3500be43bf
aide
github_2023
codestoryai
typescript
NotebookCellList.revealCells
revealCells(range: ICellRange) { const startIndex = this._getViewIndexUpperBound2(range.start); if (startIndex < 0) { return; } const endIndex = this._getViewIndexUpperBound2(range.end - 1); const scrollTop = this.getViewScrollTop(); const wrapperBottom = this.getViewScrollBottom(); const elementTop...
/** * The range will be revealed with as little scrolling as possible. */
https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/contrib/notebook/browser/view/notebookCellList.ts#L825-L867
1a8578f21ace8c9381461d295ed31c3500be43bf
aide
github_2023
codestoryai
typescript
NotebookCellList.revealCell
async revealCell(cell: ICellViewModel, revealType: CellRevealType): Promise<void> { const index = this._getViewIndexUpperBound(cell); if (index < 0) { return; } switch (revealType) { case CellRevealType.Top: this._revealInternal(index, false, CellRevealPosition.Top); break; case CellRevealTyp...
/** * Reveals the given cell in the notebook cell list. The cell will come into view syncronously * but the cell's editor will be attached asyncronously if it was previously out of view. * @returns The promise to await for the cell editor to be attached */
https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/contrib/notebook/browser/view/notebookCellList.ts#L893-L931
1a8578f21ace8c9381461d295ed31c3500be43bf
aide
github_2023
codestoryai
typescript
NotebookCellList.revealRangeInCell
async revealRangeInCell(cell: ICellViewModel, range: Selection | Range, revealType: CellRevealRangeType): Promise<void> { const index = this._getViewIndexUpperBound(cell); if (index < 0) { return; } switch (revealType) { case CellRevealRangeType.Default: return this._revealRangeInternalAsync(index, ...
//#region Reveal Cell Editor Range asynchronously
https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/contrib/notebook/browser/view/notebookCellList.ts#L996-L1011
1a8578f21ace8c9381461d295ed31c3500be43bf
aide
github_2023
codestoryai
typescript
NotebookCellList._revealRangeInternalAsync
private async _revealRangeInternalAsync(viewIndex: number, range: Selection | Range): Promise<void> { const scrollTop = this.getViewScrollTop(); const wrapperBottom = this.getViewScrollBottom(); const elementTop = this.view.elementTop(viewIndex); const element = this.view.element(viewIndex); if (element.edit...
// To ensure that item 10 is always there, we need to scroll item 10 to the top edge of the viewport.
https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/contrib/notebook/browser/view/notebookCellList.ts#L1016-L1048
1a8578f21ace8c9381461d295ed31c3500be43bf
aide
github_2023
codestoryai
typescript
NotebookCellList.revealCellOffsetInCenter
revealCellOffsetInCenter(cell: ICellViewModel, offset: number) { const viewIndex = this._getViewIndexUpperBound(cell); if (viewIndex >= 0) { const element = this.view.element(viewIndex); const elementTop = this.view.elementTop(viewIndex); if (element instanceof MarkupCellViewModel) { return this._reve...
/** * Reveals the specified offset of the given cell in the center of the viewport. * This enables revealing locations in the output as well as the input. */
https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/contrib/notebook/browser/view/notebookCellList.ts#L1150-L1164
1a8578f21ace8c9381461d295ed31c3500be43bf
aide
github_2023
codestoryai
typescript
NotebookCellList.domFocus
override domFocus() { const focused = this.getFocusedElements()[0]; const focusedDomElement = focused && this.domElementOfElement(focused); if (this.view.domNode.ownerDocument.activeElement && focusedDomElement && focusedDomElement.contains(this.view.domNode.ownerDocument.activeElement)) { // for example, whe...
// override
https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/contrib/notebook/browser/view/notebookCellList.ts#L1269-L1283
1a8578f21ace8c9381461d295ed31c3500be43bf
aide
github_2023
codestoryai
typescript
NotebookCellsLayout.size
get size(): number { return this._size; }
/** * Returns the sum of the sizes of all items in the range map. */
https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/contrib/notebook/browser/view/notebookCellListView.ts#L44-L46
1a8578f21ace8c9381461d295ed31c3500be43bf
aide
github_2023
codestoryai
typescript
NotebookCellsLayout.splice
splice(index: number, deleteCount: number, items?: IItem[] | undefined): void { const inserts = items ?? []; // Perform the splice operation on the items array. this._items.splice(index, deleteCount, ...inserts); this._size = this._paddingTop + this._items.reduce((total, item) => total + item.size, 0) + this._...
/** */
https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/contrib/notebook/browser/view/notebookCellListView.ts#L64-L97
1a8578f21ace8c9381461d295ed31c3500be43bf
aide
github_2023
codestoryai
typescript
NotebookCellsLayout.getWhitespacePosition
getWhitespacePosition(id: string): number { const whitespace = this._whitespace.find(ws => ws.id === id); if (!whitespace) { throw new Error('Whitespace not found'); } const afterPosition = whitespace.afterPosition; if (afterPosition === 0) { // find all whitespaces at the same position but with higher...
/** * find position of whitespace * @param id: id of the whitespace * @returns: position in the list view */
https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/contrib/notebook/browser/view/notebookCellListView.ts#L173-L195
1a8578f21ace8c9381461d295ed31c3500be43bf
aide
github_2023
codestoryai
typescript
CellOutputElement._generateInnerOutputContainer
private _generateInnerOutputContainer(previousSibling: HTMLElement | undefined, pickedMimeTypeRenderer: IOrderedMimeType) { this.innerContainer = DOM.$('.output-inner-container'); if (previousSibling && previousSibling.nextElementSibling) { this.outputContainer.domNode.insertBefore(this.innerContainer, previous...
// insert after previousSibling
https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellOutput.ts#L168-L179
1a8578f21ace8c9381461d295ed31c3500be43bf
aide
github_2023
codestoryai
typescript
CellOutputContainer.flagAsStale
flagAsStale() { this._hasStaleOutputs = true; }
/** * Notify that an output may have been swapped out without the model getting rendered. */
https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellOutput.ts#L557-L559
1a8578f21ace8c9381461d295ed31c3500be43bf
aide
github_2023
codestoryai
typescript
updateFocusModeForEditorEvent
const updateFocusModeForEditorEvent = () => { if (this._editor && (this._editor.hasWidgetFocus() || (this.statusBarContainer.ownerDocument.activeElement && this.statusBarContainer.contains(this.statusBarContainer.ownerDocument.activeElement)))) { element.focusMode = CellFocusMode.Editor; } else { cons...
// Focus Mode
https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellStatusPart.ts#L148-L161
1a8578f21ace8c9381461d295ed31c3500be43bf
aide
github_2023
codestoryai
typescript
CellChatPart.activeCell
get activeCell() { return this.currentCell; }
// private _controller: NotebookCellChatController | undefined;
https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/contrib/notebook/browser/view/cellParts/chat/cellChatPart.ts#L12-L14
1a8578f21ace8c9381461d295ed31c3500be43bf
aide
github_2023
codestoryai
typescript
BackLayerWebView._cachedInsetEqual
private _cachedInsetEqual(cachedInset: ICachedInset<T>, content: IInsetRenderOutput) { if (content.type === RenderOutputType.Extension) { // Use a new renderer return cachedInset.renderer?.id === content.renderer.id; } else { // The new renderer is the default HTML renderer return cachedInset.cachedCrea...
/** * Validate if cached inset is out of date and require a rerender * Note that it doesn't account for output content change. */
https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/contrib/notebook/browser/view/renderers/backLayerWebView.ts#L1477-L1485
1a8578f21ace8c9381461d295ed31c3500be43bf
aide
github_2023
codestoryai
typescript
checkOutputInputFocus
const checkOutputInputFocus = (e: FocusEvent) => { lastFocusedOutput = getOutputContainer(e); const activeElement = window.document.activeElement; if (!activeElement) { return; } const id = lastFocusedOutput?.id; if (id && (isEditableElement(activeElement) || activeElement.tagName === 'SELECT')) { po...
// check if an input element is focused within the output element
https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/contrib/notebook/browser/view/renderers/webviewPreloads.ts#L196-L211
1a8578f21ace8c9381461d295ed31c3500be43bf
aide
github_2023
codestoryai
typescript
_textNodesInRange
function _textNodesInRange(range: Range): Text[] { if (!range.startContainer.ownerDocument) { return []; } // If the start or end node is a text node and only partly in the range, split it. if (range.startContainer.nodeType === Node.TEXT_NODE && range.startOffset > 0) { const startContainer = range...
// derived from https://github.com/Treora/dom-highlight-range/blob/master/highlight-range.js
https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/contrib/notebook/browser/view/renderers/webviewPreloads.ts#L732-L792
1a8578f21ace8c9381461d295ed31c3500be43bf
aide
github_2023
codestoryai
typescript
wrapNodeInHighlight
function wrapNodeInHighlight(node: Text, tagName: string, attributes: any) { const highlightElement = node.ownerDocument.createElement(tagName); Object.keys(attributes).forEach(key => { highlightElement.setAttribute(key, attributes[key]); }); const tempRange = node.ownerDocument.createRange(); tempRa...
// Replace [node] with <tagName ...attributes>[node]</tagName>
https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/contrib/notebook/browser/view/renderers/webviewPreloads.ts#L795-L804
1a8578f21ace8c9381461d295ed31c3500be43bf
aide
github_2023
codestoryai
typescript
_removeHighlight
function _removeHighlight(highlightElement: Element) { if (highlightElement.childNodes.length === 1) { highlightElement.parentNode?.replaceChild(highlightElement.firstChild!, highlightElement); } else { // If the highlight somehow contains multiple nodes now, move them all. while (highlightElement.fir...
// Remove a highlight element created with wrapNodeInHighlight.
https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/contrib/notebook/browser/view/renderers/webviewPreloads.ts#L824-L834
1a8578f21ace8c9381461d295ed31c3500be43bf
aide
github_2023
codestoryai
typescript
_removeHighlights
function _removeHighlights() { // Remove each of the created highlightElements. for (const highlightIdx in highlightElements) { _removeHighlight(highlightElements[highlightIdx]); } }
// Return a function that cleans up the highlightElements.
https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/contrib/notebook/browser/view/renderers/webviewPreloads.ts#L837-L842
1a8578f21ace8c9381461d295ed31c3500be43bf
aide
github_2023
codestoryai
typescript
findFirstCommonAncestor
function findFirstCommonAncestor(nodeA: Node, nodeB: Node) { const range = new Range(); range.setStart(nodeA, 0); range.setEnd(nodeB, 0); return range.commonAncestorContainer; }
// modified from https://stackoverflow.com/a/68583466/16253823
https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/contrib/notebook/browser/view/renderers/webviewPreloads.ts#L1395-L1400
1a8578f21ace8c9381461d295ed31c3500be43bf
aide
github_2023
codestoryai
typescript
getSelectionOffsetRelativeTo
function getSelectionOffsetRelativeTo(parentElement: Node, currentNode: Node | null): number { if (!currentNode) { return 0; } let offset = 0; if (currentNode === parentElement || !parentElement.contains(currentNode)) { return offset; } // count the number of chars before the current dom elem and t...
// modified from https://stackoverflow.com/a/48812529/16253823
https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/contrib/notebook/browser/view/renderers/webviewPreloads.ts#L1417-L1436
1a8578f21ace8c9381461d295ed31c3500be43bf
aide
github_2023
codestoryai
typescript
Renderer._load
private async _load(): Promise<rendererApi.RendererApi | undefined> { this.postDebugMessage('Start loading renderer'); try { // Preloads need to be loaded before loading renderers. await kernelPreloads.waitForAllCurrent(); const importStart = performance.now(); const module: RendererModule = awa...
/** Inner function cached in the _loadPromise(). */
https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/contrib/notebook/browser/view/renderers/webviewPreloads.ts#L1946-L1994
1a8578f21ace8c9381461d295ed31c3500be43bf
aide
github_2023
codestoryai
typescript
trySendDragUpdate
const trySendDragUpdate = () => { if (this.currentDrag?.cellId !== cellId) { return; } postNotebookMessage<webviewMessages.ICellDragMessage>('cell-drag', { cellId: cellId, dragOffsetY: this.currentDrag.clientY, }); window.requestAnimationFrame(trySendDragUpdate); };
// Continuously send updates while dragging instead of relying on `updateDrag`.
https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/contrib/notebook/browser/view/renderers/webviewPreloads.ts#L3057-L3067
1a8578f21ace8c9381461d295ed31c3500be43bf
aide
github_2023
codestoryai
typescript
CodeCellViewModel.outputMinHeight
private set outputMinHeight(newMin: number) { this._outputMinHeight = newMin; }
/** * The minimum height of the output region. It's only set to non-zero temporarily when replacing an output with a new one. * It's reset to 0 when the new output is rendered, or in one second. */
https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/contrib/notebook/browser/viewModel/codeCellViewModel.ts#L121-L123
1a8578f21ace8c9381461d295ed31c3500be43bf
aide
github_2023
codestoryai
typescript
NotebookViewModel.updateSelectionsState
updateSelectionsState(state: ISelectionState, source: 'view' | 'model' = 'model') { if (this._focused || source === 'model') { if (state.kind === SelectionStateType.Handle) { const primaryIndex = state.primary !== null ? this.getCellIndexByHandle(state.primary) : null; const primarySelection = primaryIndex...
// selection change from list view's `setFocus` and `setSelection` should always use `source: view` to prevent events breaking the list view focus/selection change transaction
https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/contrib/notebook/browser/viewModel/notebookViewModelImpl.ts#L391-L408
1a8578f21ace8c9381461d295ed31c3500be43bf
aide
github_2023
codestoryai
typescript
NotebookViewModel.getNearestVisibleCellIndexUpwards
getNearestVisibleCellIndexUpwards(index: number) { for (let i = this._hiddenRanges.length - 1; i >= 0; i--) { const cellRange = this._hiddenRanges[i]; const foldStart = cellRange.start - 1; const foldEnd = cellRange.end; if (foldStart > index) { continue; } if (foldStart <= index && foldEnd >=...
/** * If this._viewCells[index] is visible then return index */
https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/contrib/notebook/browser/viewModel/notebookViewModelImpl.ts#L541-L560
1a8578f21ace8c9381461d295ed31c3500be43bf
aide
github_2023
codestoryai
typescript
NotebookViewModel.changeModelDecorations
changeModelDecorations<T>(callback: (changeAccessor: IModelDecorationsChangeAccessor) => T): T | null { const changeAccessor: IModelDecorationsChangeAccessor = { deltaDecorations: (oldDecorations: ICellModelDecorations[], newDecorations: ICellModelDeltaDecorations[]): ICellModelDecorations[] => { return this._...
/** * Editor decorations across cells. For example, find decorations for multiple code cells * The reason that we can't completely delegate this to CodeEditorWidget is most of the time, the editors for cells are not created yet but we already have decorations for them. */
https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/contrib/notebook/browser/viewModel/notebookViewModelImpl.ts#L852-L869
1a8578f21ace8c9381461d295ed31c3500be43bf
aide
github_2023
codestoryai
typescript
NotebookViewModel.find
find(value: string, options: INotebookFindOptions): CellFindMatchWithIndex[] { const matches: CellFindMatchWithIndex[] = []; let findCells: CellViewModel[] = []; if (options.findScope && (options.findScope.findScopeType === NotebookFindScopeType.Cells || options.findScope.findScopeType === NotebookFindScopeType....
//#region Find
https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/contrib/notebook/browser/viewModel/notebookViewModelImpl.ts#L920-L963
1a8578f21ace8c9381461d295ed31c3500be43bf
aide
github_2023
codestoryai
typescript
NotebookViewModel._withElement
private async _withElement(element: SingleModelEditStackElement | MultiModelEditStackElement, callback: () => Promise<void>) { const viewCells = this._viewCells.filter(cell => element.matchesResource(cell.uri)); const refs = await Promise.all(viewCells.map(cell => this._textModelService.createModelReference(cell.ur...
//#region Undo/Redo
https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/contrib/notebook/browser/viewModel/notebookViewModelImpl.ts#L1006-L1011
1a8578f21ace8c9381461d295ed31c3500be43bf
aide
github_2023
codestoryai
typescript
NotebookViewModel.equal
equal(notebook: NotebookTextModel) { return this._notebook === notebook; }
//#endregion
https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/contrib/notebook/browser/viewModel/notebookViewModelImpl.ts#L1050-L1052
1a8578f21ace8c9381461d295ed31c3500be43bf
aide
github_2023
codestoryai
typescript
NotebookStickyScroll.getVisibleOutlineEntry
static getVisibleOutlineEntry(visibleIndex: number, notebookOutlineEntries: OutlineEntry[]): OutlineEntry | undefined { let left = 0; let right = notebookOutlineEntries.length - 1; let bucket = -1; while (left <= right) { const mid = Math.floor((left + right) / 2); if (notebookOutlineEntries[mid].index =...
// take in an cell index, and get the corresponding outline entry
https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/contrib/notebook/browser/viewParts/notebookEditorStickyScroll.ts#L235-L260
1a8578f21ace8c9381461d295ed31c3500be43bf
aide
github_2023
codestoryai
typescript
MimeTypeDisplayOrder.sort
public sort(mimetypes: Iterable<string>): string[] { const remaining = new Map(Iterable.map(mimetypes, m => [m, normalizeSlashes(m)])); let sorted: string[] = []; for (const { matches } of this.order) { for (const [original, normalized] of remaining) { if (matches(normalized)) { sorted.push(original)...
/** * Returns a sorted array of the input mimetypes. */
https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/contrib/notebook/common/notebookCommon.ts#L676-L697
1a8578f21ace8c9381461d295ed31c3500be43bf
aide
github_2023
codestoryai
typescript
MimeTypeDisplayOrder.prioritize
public prioritize(chosenMimetype: string, otherMimetypes: readonly string[]) { const chosenIndex = this.findIndex(chosenMimetype); if (chosenIndex === -1) { // always first, nothing more to do this.order.unshift({ pattern: chosenMimetype, matches: glob.parse(normalizeSlashes(chosenMimetype)) }); return; ...
/** * Records that the user selected the given mimetype over the other * possible mimetypes, prioritizing it for future reference. */
https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/contrib/notebook/common/notebookCommon.ts#L703-L721
1a8578f21ace8c9381461d295ed31c3500be43bf
aide
github_2023
codestoryai
typescript
MimeTypeDisplayOrder.toArray
public toArray() { return this.order.map(o => o.pattern); }
/** * Gets an array of in-order mimetype preferences. */
https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/contrib/notebook/common/notebookCommon.ts#L726-L728
1a8578f21ace8c9381461d295ed31c3500be43bf
aide
github_2023
codestoryai
typescript
fixBackspace
function fixBackspace(txt: string) { let tmp = txt; do { txt = tmp; // Cancel out anything-but-newline followed by backspace tmp = txt.replace(/[^\n]\x08/gm, ''); } while (tmp.length < txt.length); return txt; }
/** * Took this from jupyter/notebook * https://github.com/jupyter/notebook/blob/b8b66332e2023e83d2ee04f83d8814f567e01a4e/notebook/static/base/js/utils.js * Remove characters that are overridden by backspace characters */
https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/contrib/notebook/common/notebookCommon.ts#L1139-L1147
1a8578f21ace8c9381461d295ed31c3500be43bf
aide
github_2023
codestoryai
typescript
fixCarriageReturn
function fixCarriageReturn(txt: string) { txt = txt.replace(/\r+\n/gm, '\n'); // \r followed by \n --> newline while (txt.search(/\r[^$]/g) > -1) { const base = txt.match(/^(.*)\r+/m)![1]; let insert = txt.match(/\r+(.*)$/m)![1]; insert = insert + base.slice(insert.length, base.length); txt = txt.replace(/\r+...
/** * Remove chunks that should be overridden by the effect of carriage return characters * From https://github.com/jupyter/notebook/blob/master/notebook/static/base/js/utils.js */
https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/contrib/notebook/common/notebookCommon.ts#L1153-L1162
1a8578f21ace8c9381461d295ed31c3500be43bf
aide
github_2023
codestoryai
typescript
NotebookEditorInput.rename
override async rename(group: GroupIdentifier, target: URI): Promise<IMoveResult | undefined> { if (this.editorModelReference) { return { editor: { resource: target }, options: { override: this.viewType } }; } return undefined; }
// called when users rename a notebook document
https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/contrib/notebook/common/notebookEditorInput.ts#L269-L275
1a8578f21ace8c9381461d295ed31c3500be43bf
aide
github_2023
codestoryai
typescript
DependencyList.matches
public matches(available: ReadonlyArray<string>) { // For now this is simple, but this may expand to support globs later // @see https://github.com/microsoft/vscode/issues/119899 return available.some(v => this.value.has(v)); }
/** Gets whether any of the 'available' dependencies match the ones in this list */
https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/contrib/notebook/common/notebookOutputRenderer.ts#L23-L27
1a8578f21ace8c9381461d295ed31c3500be43bf
aide
github_2023
codestoryai
typescript
NotebookCellTextModel.fastEqual
fastEqual(b: ICellDto2, ignoreMetadata: boolean): boolean { if (this.language !== b.language) { return false; } if (this.mime !== b.mime) { return false; } if (this.cellKind !== b.cellKind) { return false; } if (!ignoreMetadata) { if (this.internalMetadata?.executionOrder !== b.internalMeta...
/** * Only compares * - language * - mime * - cellKind * - internal metadata (conditionally) * - source */
https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/contrib/notebook/common/model/notebookCellTextModel.ts#L436-L469
1a8578f21ace8c9381461d295ed31c3500be43bf
aide
github_2023
codestoryai
typescript
NotebookTextModel.findNextMatch
findNextMatch(searchString: string, searchStart: { cellIndex: number; position: Position }, isRegex: boolean, matchCase: boolean, wordSeparators: string | null, searchEnd?: { cellIndex: number; position: Position }): { cell: NotebookCellTextModel; match: FindMatch } | null { // check if search cell index is valid t...
//#region Find
https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/contrib/notebook/common/model/notebookTextModel.ts#L1241-L1288
1a8578f21ace8c9381461d295ed31c3500be43bf
aide
github_2023
codestoryai
typescript
getRanges
function getRanges(cells: ICellViewModel[], included: (cell: ICellViewModel) => boolean): ICellRange[] { const ranges: ICellRange[] = []; let currentRange: ICellRange | undefined; cells.forEach((cell, idx) => { if (included(cell)) { if (!currentRange) { currentRange = { start: idx, end: idx + 1 }; rang...
/** * Return a set of ranges for the cells matching the given predicate */
https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/contrib/notebook/test/browser/notebookBrowser.test.ts#L15-L33
1a8578f21ace8c9381461d295ed31c3500be43bf
aide
github_2023
codestoryai
typescript
createCodeCellViewModel
function createCodeCellViewModel(version: number = 1, source = '# code', textmodelId = 'textId') { return { uri: { toString() { return textmodelId; } }, id: textmodelId, textBuffer: { getLineCount() { return 0; } }, getText() { return source; }, model: { textModel: { id: textmode...
// #endregion
https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/contrib/notebook/test/browser/contrib/notebookOutlineViewProviders.test.ts#L77-L98
1a8578f21ace8c9381461d295ed31c3500be43bf
aide
github_2023
codestoryai
typescript
setOutlineViewConfiguration
async function setOutlineViewConfiguration(config: { outlineShowMarkdownHeadersOnly: boolean; outlineShowCodeCells: boolean; outlineShowCodeCellSymbols: boolean; quickPickShowAllSymbols: boolean; breadcrumbsShowCodeCells: boolean; }) { await configurationService.setUserConfiguration('notebook.outline.showM...
/** * Set the configuration settings relevant to various outline views (OutlinePane, QuickPick, Breadcrumbs) * * @param outlineShowMarkdownHeadersOnly: boolean (notebook.outline.showMarkdownHeadersOnly) * @param outlineShowCodeCells: boolean (notebook.outline.showCodeCells) * @param outlineShowCodeCellSym...
https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/contrib/notebook/test/browser/contrib/notebookOutlineViewProviders.test.ts#L187-L199
1a8578f21ace8c9381461d295ed31c3500be43bf
aide
github_2023
codestoryai
typescript
updateTree
const updateTree = () => { if (newOutline.isEmpty) { // no more elements this._showMessage(localize('no-symbols', "No symbols found in document '{0}'", basename(resource))); this._captureViewState(resource); tree.setInput(undefined); } else if (!tree.getInput()) { // first: init tree this...
// update tree, listen to changes
https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/contrib/outline/browser/outlinePane.ts#L279-L297
1a8578f21ace8c9381461d295ed31c3500be43bf
aide
github_2023
codestoryai
typescript
revealActiveElement
const revealActiveElement = () => { if (!this._outlineViewState.followCursor || !newOutline.activeElement) { return; } let item = newOutline.activeElement; while (item) { const top = tree.getRelativeTop(item); if (top === null) { // not visible -> reveal tree.reveal(item, 0.5); } ...
// feature: reveal editor selection in outline
https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/contrib/outline/browser/outlinePane.ts#L328-L347
1a8578f21ace8c9381461d295ed31c3500be43bf
aide
github_2023
codestoryai
typescript
updateAllCollapsedCtx
const updateAllCollapsedCtx = () => { this._ctxAllCollapsed.set(tree.getNode(null).children.every(node => !node.collapsible || node.collapsed)); };
// feature: update all-collapsed context key
https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/contrib/outline/browser/outlinePane.ts#L382-L384
1a8578f21ace8c9381461d295ed31c3500be43bf
aide
github_2023
codestoryai
typescript
OutputLinkComputer.detectLinks
static detectLinks(line: string, lineIndex: number, patterns: RegExp[], resourceCreator: IResourceCreator): ILink[] { const links: ILink[] = []; patterns.forEach(pattern => { pattern.lastIndex = 0; // the holy grail of software development let match: RegExpExecArray | null; let offset = 0; while ((mat...
/** * Detect links. Made static to allow for tests. */
https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/contrib/output/common/outputLinkComputer.ts#L123-L181
1a8578f21ace8c9381461d295ed31c3500be43bf
aide
github_2023
codestoryai
typescript
check
const check = () => { this._fileService.exists(profileFilenamePrefix).then(exists => { if (exists) { resolve(); } else { setTimeout(check, 500); } }); };
// (2) wait for main that recreates the fail to signal profiling has stopped
https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/contrib/performance/electron-sandbox/startupProfiler.ts#L61-L69
1a8578f21ace8c9381461d295ed31c3500be43bf
aide
github_2023
codestoryai
typescript
ModelSelectionIndicator.showModelPicker
private async showModelPicker(type: 'fastModel' | 'slowModel'): Promise<void> { const computeItems = async (): Promise<QuickPickItem[]> => { const modelSelectionSettings = await this.aiModelSelectionService.getModelSelectionSettings(); const editorModelItems = getEditorModelItems(modelSelectionSettings); co...
/* private showModelSwitcher(): void { const quickPick = this.quickInputService.createQuickPick(); quickPick.placeholder = nls.localize('modelSelectionPicker.placeholder', "Select model type"); quickPick.title = nls.localize('modelSelectionPicker.title', "Select model type"); quickPick.items = [ { type:...
https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/contrib/preferences/browser/modelSelectionIndicator.ts#L152-L218
1a8578f21ace8c9381461d295ed31c3500be43bf
aide
github_2023
codestoryai
typescript
settingMatcher
const settingMatcher = (setting: ISetting) => { const { matches, matchType, keyMatchScore } = new SettingMatches(this._filter, setting, true, true, (filter, setting) => preferencesModel.findValueMatches(filter, setting), this.configurationService); const score = strings.equalsIgnoreCase(this._filter, setting.key)...
// Sort is not stable
https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/contrib/preferences/browser/preferencesSearch.ts#L101-L115
1a8578f21ace8c9381461d295ed31c3500be43bf
aide
github_2023
codestoryai
typescript
SettingsEditor2.minimumWidth
override set minimumWidth(value: number) { /*noop*/ }
// these setters need to exist because this extends from EditorPane
https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/contrib/preferences/browser/settingsEditor2.ts#L330-L330
1a8578f21ace8c9381461d295ed31c3500be43bf
aide
github_2023
codestoryai
typescript
SettingsEditor2.createHeader
private createHeader(parent: HTMLElement): void { this.headerContainer = DOM.append(parent, $('.settings-header')); const searchContainer = DOM.append(this.headerContainer, $('.search-container')); const clearInputAction = new Action(SETTINGS_EDITOR_COMMAND_CLEAR_SEARCH_RESULTS, localize('clearInput', "Clear Se...
/** * Render the header of the Settings editor, which includes the content above the splitview. */
https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/contrib/preferences/browser/settingsEditor2.ts#L615-L701
1a8578f21ace8c9381461d295ed31c3500be43bf
aide
github_2023
codestoryai
typescript
SettingsEditor2.toggleTocBySearchBehaviorType
private toggleTocBySearchBehaviorType() { const tocBehavior = this.configurationService.getValue<'filter' | 'hide'>(SEARCH_TOC_BEHAVIOR_KEY); const hideToc = tocBehavior === 'hide'; if (hideToc) { this.splitView.setViewVisible(0, false); this.splitView.style({ separatorBorder: Color.transparent }); ...
/** * Toggles the visibility of the Settings editor table of contents during a search * depending on the behavior. */
https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/contrib/preferences/browser/settingsEditor2.ts#L1591-L1602
1a8578f21ace8c9381461d295ed31c3500be43bf
aide
github_2023
codestoryai
typescript
SettingsEditor2.createFilterModel
private createFilterModel(): SearchResultModel { const filterModel = this.instantiationService.createInstance(SearchResultModel, this.viewState, this.settingsOrderByTocIndex, this.workspaceTrustManagementService.isWorkspaceTrusted()); const fullResult: ISearchResult = { filterMatches: [] }; for (const g of ...
/** * Return a fake SearchResultModel which can hold a flat list of all settings, to be filtered (@modified etc) */
https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/contrib/preferences/browser/settingsEditor2.ts#L1668-L1684
1a8578f21ace8c9381461d295ed31c3500be43bf
aide
github_2023
codestoryai
typescript
SettingsSearchFilterDropdownMenuActionViewItem.createAction
private createAction(id: string, label: string, tooltip: string, queryToAppend: string, triggerSuggest: boolean): IAction { return { id, label, tooltip, class: undefined, enabled: true, run: () => { this.doSearchWidgetAction(queryToAppend, triggerSuggest); } }; }
/** * The created action appends a query to the search widget search string. It optionally triggers suggestions. */
https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/contrib/preferences/browser/settingsSearchMenu.ts#L56-L65
1a8578f21ace8c9381461d295ed31c3500be43bf
aide
github_2023
codestoryai
typescript
SettingsSearchFilterDropdownMenuActionViewItem.createToggleAction
private createToggleAction(id: string, label: string, tooltip: string, queryToAppend: string): IAction { const splitCurrentQuery = this.searchWidget.getValue().split(' '); const queryContainsQueryToAppend = splitCurrentQuery.includes(queryToAppend); return { id, label, tooltip, class: undefined, en...
/** * The created action appends a query to the search widget search string, if the query does not exist. * Otherwise, it removes the query from the search widget search string. * The action does not trigger suggestions after adding or removing the query. */
https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/contrib/preferences/browser/settingsSearchMenu.ts#L72-L95
1a8578f21ace8c9381461d295ed31c3500be43bf
aide
github_2023
codestoryai
typescript
renderValidations
function renderValidations(dataElement: SettingsTreeSettingElement, template: ISettingTextItemTemplate, calledOnStartup: boolean): boolean { if (dataElement.setting.validator) { const errMsg = dataElement.setting.validator(template.inputBox.value); if (errMsg) { template.containerElement.classList.add('invalid-...
/** * Validate and render any error message. Returns true if the value is invalid. */
https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/contrib/preferences/browser/settingsTree.ts#L2278-L2294
1a8578f21ace8c9381461d295ed31c3500be43bf
aide
github_2023
codestoryai
typescript
renderArrayValidations
function renderArrayValidations( dataElement: SettingsTreeSettingElement, template: ISettingListItemTemplate | ISettingObjectItemTemplate, value: string[] | Record<string, unknown> | undefined, calledOnStartup: boolean ): boolean { template.containerElement.classList.add('invalid-input'); if (dataElement.setting....
/** * Validate and render any error message for arrays. Returns true if the value is invalid. */
https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/contrib/preferences/browser/settingsTree.ts#L2299-L2321
1a8578f21ace8c9381461d295ed31c3500be43bf
aide
github_2023
codestoryai
typescript
SettingsTreeGroupElement.containsSetting
containsSetting(key: string): boolean { return this._childSettingKeys.has(key); }
/** * Returns whether this group contains the given child key (to a depth of 1 only) */
https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/contrib/preferences/browser/settingsTreeModels.ts#L101-L103
1a8578f21ace8c9381461d295ed31c3500be43bf
aide
github_2023
codestoryai
typescript
trimCategoryForGroup
function trimCategoryForGroup(category: string, groupId: string): string { const doTrim = (forward: boolean) => { // Remove the Insiders portion if the category doesn't use it. if (!/insiders$/i.test(category)) { groupId = groupId.replace(/-?insiders$/i, ''); } const parts = groupId.split('.') .map(part ...
/** * Removes redundant sections of the category label. * A redundant section is a section already reflected in the groupId. * * @param category The category of the specific setting. * @param groupId The author + extension ID. * @returns The new category label to use. */
https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/contrib/preferences/browser/settingsTreeModels.ts#L740-L781
1a8578f21ace8c9381461d295ed31c3500be43bf
aide
github_2023
codestoryai
typescript
getTagsForType
function getTagsForType(query: string, filterRegex: RegExp, parsedParts: string[]): string { return query.replace(filterRegex, (_, __, quotedParsedElement, unquotedParsedElement) => { const parsedElement: string = unquotedParsedElement || quotedParsedElement; if (parsedElement) { parsedParts.push(...parsedE...
/** * A helper function to parse the query on one type of regex. * * @param query The search query * @param filterRegex The regex to use on the query * @param parsedParts The parts that the regex parses out will be appended to the array passed in here. * @returns The query with the parsed parts removed */
https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/contrib/preferences/browser/settingsTreeModels.ts#L1103-L1111
1a8578f21ace8c9381461d295ed31c3500be43bf
aide
github_2023
codestoryai
typescript
ChangeObserver.handleChange
handleChange(value: T | undefined): boolean { if (typeof value === this.typeName && value !== this.lastValue) { this.lastValue = value; return true; } return false; }
/** * Returns if there was a change compared to the last value */
https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/contrib/relauncher/browser/relauncher.contribution.ts#L194-L201
1a8578f21ace8c9381461d295ed31c3500be43bf
aide
github_2023
codestoryai
typescript
updateRemoteActions
const updateRemoteActions = () => { this.remoteMenuActionsGroups = undefined; this.updateRemoteStatusIndicator(); };
// Menu changes
https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/contrib/remote/browser/remoteIndicator.ts#L238-L241
1a8578f21ace8c9381461d295ed31c3500be43bf
aide
github_2023
codestoryai
typescript
TunnelItem.strip
public strip(): TunnelItem | undefined { return new TunnelItem( this.tunnelType, this.remoteHost, this.remotePort, this.source, this.hasRunningProcess, this.protocol, this.localUri, this.localAddress, this.localPort, this.closeable, this.name, this.runningProcess, this.pid, t...
/** * Removes all non-serializable properties from the tunnel * @returns A new TunnelItem without any services */
https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/contrib/remote/browser/tunnelView.ts#L600-L617
1a8578f21ace8c9381461d295ed31c3500be43bf
aide
github_2023
codestoryai
typescript
RemoteTunnelWorkbenchContribution.getAllSessions
private async getAllSessions(): Promise<ExistingSessionItem[]> { const authenticationProviders = await this.getAuthenticationProviders(); const accounts = new Map<string, ExistingSessionItem>(); const currentAccount = await this.remoteTunnelService.getMode(); let currentSession: ExistingSessionItem | undefined;...
/** * Returns all authentication sessions available from {@link getAuthenticationProviders}. */
https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/contrib/remoteTunnel/electron-sandbox/remoteTunnel.contribution.ts#L428-L453
1a8578f21ace8c9381461d295ed31c3500be43bf
aide
github_2023
codestoryai
typescript
RemoteTunnelWorkbenchContribution.getAuthenticationProviders
private async getAuthenticationProviders(): Promise<IAuthenticationProvider[]> { // Get the list of authentication providers configured in product.json const authenticationProviders = this.serverConfiguration.authenticationProviders; const configuredAuthenticationProviders = Object.keys(authenticationProviders).r...
/** * Returns all authentication providers which can be used to authenticate * to the remote storage service, based on product.json configuration * and registered authentication providers. */
https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/contrib/remoteTunnel/electron-sandbox/remoteTunnel.contribution.ts#L470-L482
1a8578f21ace8c9381461d295ed31c3500be43bf
aide
github_2023
codestoryai
typescript
onDidChangeContentHeight
const onDidChangeContentHeight = () => { const contentHeight = templateData.inputWidget.getContentHeight(); this.contentHeights.set(input, contentHeight); if (templateData.inputWidgetHeight !== contentHeight) { this.updateHeight(input, contentHeight + 10); templateData.inputWidgetHeight = contentHeigh...
// Rerender the element whenever the editor content height changes
https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/contrib/scm/browser/scmViewPane.ts#L355-L364
1a8578f21ace8c9381461d295ed31c3500be43bf
aide
github_2023
codestoryai
typescript
layoutEditor
const layoutEditor = () => templateData.inputWidget.layout();
// Layout the editor whenever the outer layout happens
https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/contrib/scm/browser/scmViewPane.ts#L375-L375
1a8578f21ace8c9381461d295ed31c3500be43bf
aide
github_2023
codestoryai
typescript
updatePlaceholderText
const updatePlaceholderText = () => { const binding = this.keybindingService.lookupKeybinding('scm.acceptInput'); const label = binding ? binding.getLabel() : (platform.isMacintosh ? 'Cmd+Enter' : 'Ctrl+Enter'); const placeholderText = format(input.placeholder, label); this.inputEditor.updateOptions({ plac...
// Update placeholder text
https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/contrib/scm/browser/scmViewPane.ts#L1675-L1681
1a8578f21ace8c9381461d295ed31c3500be43bf
aide
github_2023
codestoryai
typescript
updateEnablement
const updateEnablement = (enabled: boolean) => { this.inputEditor.updateOptions({ readOnly: !enabled }); };
// Update input enablement
https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/contrib/scm/browser/scmViewPane.ts#L1705-L1707
1a8578f21ace8c9381461d295ed31c3500be43bf
aide
github_2023
codestoryai
typescript
SCMInputHistory.migrateStorage
private migrateStorage(): boolean { let didSomethingChange = false; const machineKeys = Iterable.filter(this.storageService.keys(StorageScope.APPLICATION, StorageTarget.MACHINE), key => key.startsWith('scm/input:')); for (const key of machineKeys) { try { const legacyHistory = JSON.parse(this.storageServi...
// TODO@joaomoreno: Change from January 2024 onwards such that the only code is to remove all `scm/input:` storage keys
https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/contrib/scm/common/scmService.ts#L308-L341
1a8578f21ace8c9381461d295ed31c3500be43bf
aide
github_2023
codestoryai
typescript
SCMService.repositories
get repositories(): Iterable<ISCMRepository> { return this._repositories.values(); }
// used in tests
https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/contrib/scm/common/scmService.ts#L354-L354
1a8578f21ace8c9381461d295ed31c3500be43bf
aide
github_2023
codestoryai
typescript
SyncScroll.toggleStatusbarItem
private toggleStatusbarItem(active: boolean): void { if (active) { if (!this.statusBarEntry.value) { const text = localize('mouseScrolllingLocked', 'Scrolling Locked'); const tooltip = localize('mouseLockScrollingEnabled', 'Lock Scrolling Enabled'); this.statusBarEntry.value = this.statusbarService.add...
// Actions & Commands
https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/contrib/scrollLocking/browser/scrollLocking.ts#L161-L182
1a8578f21ace8c9381461d295ed31c3500be43bf
aide
github_2023
codestoryai
typescript
AnythingQuickAccessProvider.createAnythingPick
private createAnythingPick(resourceOrEditor: URI | EditorInput | IResourceEditorInput, configuration: { openSideBySideDirection: 'right' | 'down' | undefined }): IAnythingQuickPickItem { const isEditorHistoryEntry = !URI.isUri(resourceOrEditor); let resource: URI | undefined; let label: string; let description...
//#region Helpers
https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/contrib/search/browser/anythingQuickAccess.ts#L958-L1041
1a8578f21ace8c9381461d295ed31c3500be43bf
aide
github_2023
codestoryai
typescript
expandSelectSubtree
async function expandSelectSubtree(accessor: ServicesAccessor) { const viewsService = accessor.get(IViewsService); const searchView = getSearchView(viewsService); if (searchView) { const viewer = searchView.getControl(); const selected = viewer.getFocus()[0]; await forcedExpandRecursively(viewer, selected); }...
//#region Helpers
https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/contrib/search/browser/searchActionsFind.ts#L299-L307
1a8578f21ace8c9381461d295ed31c3500be43bf
aide
github_2023
codestoryai
typescript
toggleCaseSensitiveCommand
function toggleCaseSensitiveCommand(accessor: ServicesAccessor) { const searchView = getSearchView(accessor.get(IViewsService)); searchView?.toggleCaseSensitive(); }
//#endregion
https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/contrib/search/browser/searchActionsNav.ts#L421-L424
1a8578f21ace8c9381461d295ed31c3500be43bf
aide
github_2023
codestoryai
typescript
performReplace
async function performReplace(accessor: ServicesAccessor, context: ISearchActionContext | undefined) { const configurationService = accessor.get(IConfigurationService); const viewsService = accessor.get(IViewsService); const viewlet: SearchView | undefined = getSearchView(viewsService); const viewer: WorkbenchCom...
//#endregion
https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/contrib/search/browser/searchActionsRemoveReplace.ts#L259-L321
1a8578f21ace8c9381461d295ed31c3500be43bf
aide
github_2023
codestoryai
typescript
clearHistoryCommand
const clearHistoryCommand: ICommandHandler = accessor => { const searchHistoryService = accessor.get(ISearchHistoryService); searchHistoryService.clearHistory(); };
//#endregion
https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/contrib/search/browser/searchActionsTopBar.ts#L212-L215
1a8578f21ace8c9381461d295ed31c3500be43bf
aide
github_2023
codestoryai
typescript
AIFolderMatchWorkspaceRootImpl.constructor
constructor(private _resource: URI, _id: string, private _index: number, private _query: IAITextQuery, private _parent: ITextSearchHeading, @IInstantiationService private instantiationService: IInstantiationService, @ILabelService labelService: ILabelService, ) { super(); this._fileMatches = new Map<st...
// id to fileMatch
https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/contrib/search/browser/AISearch/aiSearchModel.ts#L91-L105
1a8578f21ace8c9381461d295ed31c3500be43bf
aide
github_2023
codestoryai
typescript
compareItems
function compareItems(a: WorkspaceSymbolItem, b: WorkspaceSymbolItem): number { let res = compare(a.symbol.name, b.symbol.name); if (res === 0) { res = a.symbol.kind - b.symbol.kind; } if (res === 0) { res = compare(a.symbol.location.uri.toString(), b.symbol.location.uri.toString()); } if (res === 0) ...
// de-duplicate entries
https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/contrib/search/common/search.ts#L94-L117
1a8578f21ace8c9381461d295ed31c3500be43bf
aide
github_2023
codestoryai
typescript
SnippetsService._initExtensionSnippets
private _initExtensionSnippets(): void { snippetExt.point.setHandler(extensions => { for (const [key, value] of this._files) { if (value.source === SnippetSource.Extension) { this._files.delete(key); } } for (const extension of extensions) { for (const contribution of extension.value) { ...
// --- loading, watching
https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/contrib/snippets/browser/snippetsService.ts#L363-L414
1a8578f21ace8c9381461d295ed31c3500be43bf
aide
github_2023
codestoryai
typescript
WorkspaceTags.reportAzureNode
private reportAzureNode(workspaceUris: URI[], tags: Tags): Promise<Tags> { // TODO: should also work for `node_modules` folders several levels down const uris = workspaceUris.map(workspaceUri => { const path = workspaceUri.path; return workspaceUri.with({ path: `${path !== '/' ? path : ''}/node_modules` }); ...
/* __GDPR__FRAGMENT__ "AzureTags" : { "node" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true } } */
https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/contrib/tags/electron-sandbox/workspaceTags.ts#L138-L156
1a8578f21ace8c9381461d295ed31c3500be43bf
aide
github_2023
codestoryai
typescript
WorkspaceTags.reportAzureJava
private reportAzureJava(workspaceUris: URI[], tags: Tags): Promise<Tags> { return Promise.all(workspaceUris.map(workspaceUri => { const path = workspaceUri.path; const uri = workspaceUri.with({ path: `${path !== '/' ? path : ''}/pom.xml` }); return this.fileService.exists(uri).then(exists => { if (!exist...
/* __GDPR__FRAGMENT__ "AzureTags" : { "java" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true } } */
https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/contrib/tags/electron-sandbox/workspaceTags.ts#L167-L186
1a8578f21ace8c9381461d295ed31c3500be43bf
aide
github_2023
codestoryai
typescript
WorkspaceTagsService.resolveWorkspaceTags
private async resolveWorkspaceTags(): Promise<Tags> { const tags: Tags = Object.create(null); const state = this.contextService.getWorkbenchState(); const workspace = this.contextService.getWorkspace(); tags['workspace.id'] = await this.getTelemetryWorkspaceId(workspace, state); const { filesToOpenOrCreate...
/* __GDPR__FRAGMENT__ "WorkspaceTags" : { "workbench.filesToOpenOrCreate" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true }, "workbench.filesToDiff" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true }, "workbench.filesToMerge...
https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/contrib/tags/electron-sandbox/workspaceTagsService.ts#L1204-L1479
1a8578f21ace8c9381461d295ed31c3500be43bf
aide
github_2023
codestoryai
typescript
CustomTask.getKey
public override getKey(): string | undefined { interface ICustomKey { type: string; folder: string; id: string; } const workspaceFolder = this.getFolderId(); if (!workspaceFolder) { return undefined; } let id: string = this.configurationProperties.identifier!; if (this._source.kind !== TaskSou...
/** * @returns A key representing the task */
https://github.com/codestoryai/aide/blob/1a8578f21ace8c9381461d295ed31c3500be43bf/src/vs/workbench/contrib/tasks/common/tasks.ts#L797-L813
1a8578f21ace8c9381461d295ed31c3500be43bf