

Also from Kynth Studios


Also from Kynth Studios


Also from Kynth Studios
12345# Notebook Architecture67This document describes the internal architecture of VS Code's notebook implementation.89## Model resolution1011Notebook model resolution is handled by `NotebookService`. It resolves notebook models from the file system or other sources. The notebook model is a tree of cells, where each cell has a type (code or markdown) and a list of outputs.1213## Viewport rendering (virtualization)1415The notebook viewport is virtualized to improve performance. Only visible cells are rendered, and cells outside the viewport are recycled. The viewport rendering is handled by `NotebookCellList` which extends `WorkbenchList<CellViewModel>`.16171819The rendering has the following steps:20211. **Render Viewport** - Layout/render only the cells that are in the visible viewport222. **Render Template** - Each cell type has a template (code cell, markdown cell) that is instantiated via `CodeCellRenderer` or `MarkupCellRenderer`233. **Render Element** - The cell content is rendered into the template244. **Get Dynamic Height** - Cell height is computed dynamically based on content (editor lines, outputs, etc.)255. **Cell Parts Lifecycle** - Each cell has lifecycle parts that manage focus, selection, and other state2627### Cell resize above viewport2829When a cell above the viewport is resized (e.g., output grows), the viewport needs to be updated to maintain scroll position. This is handled by tracking scroll anchors.30313233## Cell Rendering3435The notebook editor renders cells through a contribution system. Cell parts are organized into two categories via `CellPartsCollection`:3637- **CellContentPart** - Non-floating elements rendered inside a cell synchronously to avoid flickering38 - `prepareRenderCell()` - Prepare model (no DOM operations)39 - `renderCell()` / `didRenderCell()` - Update DOM for the cell40 - `unrenderCell()` - Cleanup when cell leaves viewport41 - `updateInternalLayoutNow()` - Update layout per cell layout changes42 - `updateState()` - Update per cell state change43 - `updateForExecutionState()` - Update per execution state change4445- **CellOverlayPart** - Floating elements rendered on top, may be deferred to next animation frame4647Cell parts are located in `view/cellParts/` and contribute to different aspects:48- **Editor** - The Monaco editor for code cells49- **Outputs** - Rendered outputs from code execution50- **Toolbar** - Cell toolbar with actions51- **Status Bar** - Execution status, language info52- **Decorations** - Fold regions, diagnostics, etc.53- **Context Keys** - Cell-specific context key management54- **Drag and Drop** - Cell reordering via `CellDragAndDropController`5556## Focus Tracking5758Focus in the notebook editor is complex because there are multiple focusable elements:59601. The notebook list itself (`NotebookCellList`)612. Individual cell containers623. Monaco editors within cells634. Output elements (webviews via `BackLayerWebView`)6465The `NotebookEditorWidget` tracks focus state and provides APIs to manage focus across these components. Context keys like `NOTEBOOK_EDITOR_FOCUSED`, `NOTEBOOK_OUTPUT_FOCUSED`, and `NOTEBOOK_OUTPUT_INPUT_FOCUSED` are used to track focus state.6667## Optimizations6869### Output virtualization7071Large outputs are virtualized similar to cells. Only visible portions of outputs are rendered.7273### Cell DOM recycling7475Cell DOM elements are pooled and recycled to reduce DOM operations. When scrolling, cells that move out of the viewport have their templates returned to the pool. Editor instances are managed via `NotebookCellEditorPool`.7677### Webview reuse7879Output webviews are reused across cells when possible to reduce the overhead of creating new webview contexts. The `BackLayerWebView` manages the webview lifecycle.8081---8283# Find in Notebook Outputs8485The notebook find feature supports searching in both text models and rendered outputs. The find functionality is implemented via `FindModel` and `CellFindMatchModel` classes.8687## Hybrid Find8889For rendered outputs (HTML, images with alt text, etc.), the find uses a hybrid approach:90911. **Text model search** - Searches cell source code using standard text search via `FindMatch`922. **DOM search in webview** - Uses `window.find()` to search rendered output content via `CellWebviewFindMatch`93949596The hybrid find works by:97981. First finding matches in text models (cell inputs) - stored in `contentMatches`992. Then finding matches in rendered outputs via webview - stored in `webviewMatches`1003. Mixing both match types into a unified result set via `CellFindMatchModel`1014. Navigating between matches reveals the appropriate editor or output102103### Implementation details104105- Uses `window.find()` for DOM searching in webview106- Uses `document.execCommand('hiliteColor')` to highlight matches107- Serializes `document.getSelection()` to get match positions108- Creates ranges for current match highlighting109
One repository carrying more than one format is the comparison this product exists for: does anyone actually write different content in each file, or is one a copy of the other?
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| microsoft/vscode.github/instructions/best-practices.instructions.md · 189k | Copilot instructions | styleui | 60/100 | 14 days ago | |
| microsoft/vscodeextensions/copilot/src/platform/authentication/common/AGENTS.md · 189k | AGENTS.md | archsecurityagent-behaviour | 58/100 | 14 days ago | |
| microsoft/vscode.github/copilot-instructions.md · 189k | Copilot instructions | stylearchtypesui+2 | 74/100 | 13 days ago | |
| microsoft/vscode.github/instructions/accessibility.instructions.md · 189k | Copilot instructions | styledo-not | 61/100 | 14 days ago | |
| microsoft/vscode.github/instructions/agentHostTesting.instructions.md · 189k | Copilot instructions | teststyletesting-strategyagent-behaviour | 55/100 | 7 days ago | |
| microsoft/vscode.github/instructions/chat.instructions.md · 189k | Copilot instructions | no sections | 39/100 | 14 days ago | |
| microsoft/vscode.github/instructions/coding-guidelines.instructions.md · 189k | Copilot instructions | styletypesuidocs | 60/100 | 14 days ago | |
| microsoft/vscode.github/instructions/committing.instructions.md · 189k | Copilot instructions | do-not | 23/100 | 14 days ago | |
| microsoft/vscode.github/instructions/css-best-practices.instructions.md · 189k | Copilot instructions | styleui | 29/100 | 14 days ago | |
| microsoft/vscode.github/instructions/design-philosophy.instructions.md · 189k | Copilot instructions | style | 34/100 | 14 days ago | |
| microsoft/vscode.github/instructions/design-tokens.instructions.md · 189k | Copilot instructions | styledo-not | 65/100 | 14 days ago | |
| microsoft/vscode.github/instructions/interactive.instructions.md · 189k | Copilot instructions | ui | 43/100 | 14 days ago | |
| microsoft/vscodeextensions/copilot/.github/instructions/model-prompts.instructions.md · 189k | Copilot instructions | testsecurityui | 58/100 | 14 days ago | |
| microsoft/vscodeextensions/copilot/.github/instructions/prompt-tsx.instructions.md · 189k | Copilot instructions | archuiperformance | 58/100 | 14 days ago | |
| microsoft/vscodeextensions/copilot/.github/instructions/vitest-unit-tests.instructions.md · 189k | Copilot instructions | teststyletesting-strategydo-not | 51/100 | 14 days ago | |
| microsoft/vscodesrc/vs/platform/agentHost/common/state/AGENTS.md · 189k | AGENTS.md | buildarchtypesgit+2 | 64/100 | 14 days ago | |
| microsoft/vscodesrc/vs/platform/agentHost/node/copilot/prompts/AGENTS.md · 189k | AGENTS.md | styleagent-behaviour | 58/100 | 14 days ago | |
| microsoft/vscode.github/instructions/observables.instructions.md · 189k | Copilot instructions | no sections | 40/100 | 14 days ago | |
| microsoft/vscode.github/instructions/oss-third-party-notices.instructions.md · 189k | Copilot instructions | buildgitdependenciesdeployment+1 | 65/100 | 14 days ago | |
| microsoft/vscode.github/instructions/oss.instructions.md · 189k | Copilot instructions | git | 44/100 | 14 days ago |
Same format, overlapping stack, ranked by quality.
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| louislam/uptime-kuma.github/copilot-instructions.md · 90k | Copilot instructions | setupbuildtestlint-format+9 | 100/100 | 14 days ago | |
| HerringtonDarkholme/megarepo.github/copilot-instructions.md · 17 | Copilot instructions | setupbuildtestlint-format+7 | 100/100 | 14 days ago | |
| chihebnabil/lovable-boilerplate.github/instructions/global.instructions.md · 63 | Copilot instructions | buildlint-formatstylearch+4 | 100/100 | 14 days ago | |
| bagisto/bagisto.github/copilot-instructions.md · 28k | Copilot instructions | setupbuildteststyle+5 | 97/100 | 14 days ago | |
| JCodesMore/ai-website-cloner-template.github/copilot-instructions.md · 31k | Copilot instructions | buildlint-formatstylearch+3 | 97/100 | 7 days ago | |
| nerolis-lab/nerolis-lab.github/copilot-instructions.md · 32 | Copilot instructions | setupbuildtestlint-format+11 | 96/100 | 14 days ago | |
| thangaram611/second-brain.github/copilot-instructions.md · 0 | Copilot instructions | setupteststylearch+4 | 96/100 | 14 days ago | |
| darkmatter/nixmac.github/copilot-instructions.md · 25 | Copilot instructions | setupbuildtestlint-format+8 | 96/100 | 14 days ago |
A badge carrying the measured quality of the strongest agent config file in this repository, out of 100. It reads from this index every time somebody loads your page, so it changes when the measurement changes and there is nothing to keep up to date. Free, no account, and the value is not something you or we can set by hand.
[](https://rulestack.kynth.studio/configs/microsoft-vscode-github-instructions-notebook-instructions)Would rather not hotlink us? Every badge is also served in shields.io’s endpoint schema, so shields renders the image and your readers never talk to our domain:
Published by Toolproof, the masthead over this index and eight others. The method behind the number is at toolproof.kynth.studio/methodology, and the whole thing is readable as JSON with no key at /api.