

Also from Kynth Studios


Also from Kynth Studios


Also from Kynth Studios
12345# Workbench Tree Widgets Overview67**Location**: `src/vs/platform/list/browser/listService.ts`8**Type**: Platform Services9**Layer**: Platform1011## Purpose1213The Workbench Tree Widgets provide high-level, workbench-integrated tree components that extend the base tree implementations with VS Code-specific functionality like context menus, keyboard navigation, theming, accessibility, and dependency injection integration. These widgets serve as the primary tree components used throughout the VS Code workbench for file explorers, debug views, search results, and other hierarchical data presentations.1415## Scope1617### Included Functionality18- **Context Integration**: Automatic context key management, focus handling, and VS Code theme integration19- **Resource Navigation**: Built-in support for opening files and resources with proper editor integration20- **Accessibility**: Complete accessibility provider integration with screen reader support21- **Keyboard Navigation**: Smart keyboard navigation with search-as-you-type functionality22- **Multi-selection**: Configurable multi-selection behavior with platform-appropriate modifier keys23- **Dependency Injection**: Full integration with VS Code's service container for automatic service injection24- **Configuration**: Automatic integration with user settings for tree behavior customization2526### Integration Points27- **IInstantiationService**: For service injection and component creation28- **IContextKeyService**: For managing focus, selection, and tree state context keys29- **IListService**: For registering trees and managing workbench list lifecycle30- **IConfigurationService**: For reading tree configuration settings31- **Resource Navigators**: For handling file/resource opening with proper editor integration3233### Out of Scope34- Low-level tree rendering and virtualization (handled by base tree classes)35- Data management and async loading logic (provided by data sources)36- Custom styling beyond workbench theming integration3738## Architecture3940### Key Classes & Interfaces4142- **WorkbenchTreeInternals**: Encapsulates common workbench functionality across all tree types43- **ResourceNavigator**: Handles file/resource opening with proper editor integration44- **IOpenEvent**: Event interface for resource opening with editor options45- **IWorkbench*TreeOptions**: Configuration interfaces extending base options with workbench features46- **IResourceNavigatorOptions**: Configuration for resource opening behavior4748### Key Files4950- **`src/vs/platform/list/browser/listService.ts`**: Contains all workbench tree widget implementations, shared workbench functionality (`WorkbenchTreeInternals`), and configuration utilities51 - `src/vs/platform/list/browser/test/listService.test.ts`: Unit tests for workbench trees52- **`src/vs/base/browser/ui/tree/objectTree.ts`**: Base implementation for static trees and compressible trees53 - `src/vs/base/test/browser/ui/tree/objectTree.test.ts`: Base tree tests54- **`src/vs/base/browser/ui/tree/asyncDataTree.ts`**: Base implementation for async trees with lazy loading support55 - `src/vs/base/test/browser/ui/tree/asyncDataTree.test.ts`: Async tree tests56- **`src/vs/base/browser/ui/tree/dataTree.ts`**: Base implementation for data-driven trees with explicit data sources57 - `src/vs/base/test/browser/ui/tree/dataTree.test.ts`: Data tree tests58- **`src/vs/base/browser/ui/tree/abstractTree.ts`**: Base tree foundation59- **`src/vs/base/browser/ui/tree/tree.ts`**: Core interfaces and types6061## Development Guidelines6263### Choosing the Right Tree Widget64651. **WorkbenchObjectTree**: Use for simple, static hierarchical data that doesn't change frequently66```typescript67 // Example: Timeline items, loaded scripts68 const tree = instantiationService.createInstance(69 WorkbenchObjectTree<TimelineItem, FuzzyScore>,70 'TimelineView', container, delegate, renderers, options71 );72```73742. **WorkbenchAsyncDataTree**: Use for dynamic data that loads asynchronously75```typescript76 // Example: Debug variables, file contents77 const tree = instantiationService.createInstance(78 WorkbenchAsyncDataTree<IStackFrame, IExpression, FuzzyScore>,79 'VariablesView', container, delegate, renderers, dataSource, options80 );81```82833. **WorkbenchCompressible*Tree**: Use when you need path compression for deep hierarchies84```typescript85 // Example: File explorer, call stack86 const tree = instantiationService.createInstance(87 WorkbenchCompressibleAsyncDataTree<ExplorerItem[], ExplorerItem, FuzzyScore>,88 'FileExplorer', container, delegate, compressionDelegate, renderers, dataSource, options89 );90```9192### Construction Pattern9394**Always use IInstantiationService.createInstance()** to ensure proper dependency injection:9596```typescript97constructor(98 @IInstantiationService private instantiationService: IInstantiationService99) {100 this.tree = this.instantiationService.createInstance(101 WorkbenchAsyncDataTree<TInput, T, TFilterData>,102 'UniqueTreeId', // Used for settings and context keys103 container, // DOM container element104 delegate, // IListVirtualDelegate for item height/template105 renderers, // Array of tree renderers106 dataSource, // Data source (async trees only)107 options // Tree configuration options108 );109}110```111112### Required Options113114All workbench trees require an **accessibilityProvider**:115```typescript116const options: IWorkbenchAsyncDataTreeOptions<T, TFilterData> = {117 accessibilityProvider: {118 getAriaLabel: (element: T) => element.name,119 getRole: () => 'treeitem'120 }121 // ... other options122};123```124125### Common Configuration Patterns126127```typescript128// Standard tree setup with search, identity, and navigation129const options = {130 accessibilityProvider: new MyAccessibilityProvider(),131 identityProvider: { getId: (element) => element.id },132 keyboardNavigationLabelProvider: {133 getKeyboardNavigationLabel: (element) => element.name134 },135 multipleSelectionController: {136 isSelectionSingleChangeEvent: (e) => e.ctrlKey || e.metaKey,137 isSelectionRangeChangeEvent: (e) => e.shiftKey138 },139 overrideStyles: this.getLocationBasedColors().listOverrideStyles140};141```142143### Lifecycle Management144145- **Always register trees as disposables** in the containing component146- **Use the tree's `setInput()` method** to provide initial data147- **Always call `layout()` when the container initializes and when its size changes**148- **Handle selection and open events** through the tree's event system149150### Performance Considerations151152- Use **compression** for deep hierarchies to reduce DOM nodes153- Implement **efficient data sources** that avoid unnecessary data fetching154- Consider **virtualization settings** for large datasets155- Use **identity providers** for efficient updates and state preservation156157---158
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/vscode.github/instructions/notebook.instructions.md · 189k | Copilot instructions | no sections | 48/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 |
Same format, overlapping stack, ranked by quality.
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| chihebnabil/lovable-boilerplate.github/instructions/global.instructions.md · 63 | Copilot instructions | buildlint-formatstylearch+4 | 100/100 | 14 days ago | |
| 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 | |
| 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 | |
| thangaram611/second-brain.github/copilot-instructions.md · 0 | Copilot instructions | setupteststylearch+4 | 96/100 | 14 days ago | |
| nerolis-lab/nerolis-lab.github/copilot-instructions.md · 32 | Copilot instructions | setupbuildtestlint-format+11 | 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-tree-widgets-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.