Copilot instructions
.github/copilot-instructions.mdCopilot instructions
Quality
74/100
Scores the file, not the repository.Length
1,588 words
18 headings · 2 code blocksRepository
188k
— · pushed 0 days agoLast changed
2 days ago
First indexed 3 days ago.1# VS Code Copilot Instructions23## Project Overview45Visual Studio Code is built with a layered architecture using TypeScript, web APIs and Electron, combining web technologies with native app capabilities. The codebase is organized into key architectural layers:67### Root Folders8- `src/`: Main TypeScript source code with unit tests in `src/vs/*/test/` folders9- `build/`: Build scripts and CI/CD tools10- `extensions/`: Built-in extensions that ship with VS Code11- `test/`: Integration tests and test infrastructure12- `scripts/`: Development and build scripts13- `resources/`: Static resources (icons, themes, etc.)14- `out/`: Compiled JavaScript output (generated during build)1516### Core Architecture (`src/` folder)17- `src/vs/base/` - Foundation utilities and cross-platform abstractions18- `src/vs/platform/` - Platform services and dependency injection infrastructure19- `src/vs/editor/` - Text editor implementation with language services, syntax highlighting, and editing features20- `src/vs/workbench/` - Main application workbench for web and desktop21 - `workbench/browser/` - Core workbench UI components (parts, layout, actions)22 - `workbench/services/` - Service implementations23 - `workbench/contrib/` - Feature contributions (git, debug, search, terminal, etc.)24 - `workbench/api/` - Extension host and VS Code API implementation25- `src/vs/code/` - Electron main process specific implementation26- `src/vs/server/` - Server specific implementation27- `src/vs/sessions/` - Agent sessions window, a dedicated workbench layer for agentic workflows (sits alongside `vs/workbench`, may import from it but not vice versa)2829The core architecture follows these principles:30- **Layered architecture** - from `base`, `platform`, `editor`, to `workbench`31- **Dependency injection** - Services are injected through constructor parameters32 - If non-service parameters are needed, they need to come before the service parameters33- **Contribution model** - Features contribute to registries and extension points34- **Cross-platform compatibility** - Abstractions separate platform-specific code3536### Built-in Extensions (`extensions/` folder)37The `extensions/` directory contains first-party extensions that ship with VS Code:38- **Language support** - `typescript-language-features/`, `html-language-features/`, `css-language-features/`, etc.39- **Core features** - `git/`, `debug-auto-launch/`, `emmet/`, `markdown-language-features/`40- **Themes** - `theme-*` folders for default color themes41- **Development tools** - `extension-editing/`, `vscode-api-tests/`4243Each extension follows the standard VS Code extension structure with `package.json`, TypeScript sources, and contribution points to extend the workbench through the Extension API.4445### Finding Related Code461. **Semantic search first**: Use file search for general concepts472. **Grep for exact strings**: Use grep for error messages or specific function names483. **Follow imports**: Check what files import the problematic module494. **Check test files**: Often reveal usage patterns and expected behavior5051## Validating TypeScript changes5253Choose validation based on the scope and risk of the change. Large-scale builds and typechecking can be slow, and consume significant resources, so minimize their use. Prefer existing editor or watch-task diagnostics and the smallest targeted tests that cover the changed behavior. Do not start build or watch tasks, run broad type checks, or make type checking a prerequisite for targeted tests solely as a completion ritual.5455Run a targeted type check or build when you are not fully confident in the change, and the change is broad or cross-cutting, it affects build or type configuration, or another validation step reports a compilation problem. Useful commands include:5657- `npm run typecheck-client` for the main sources under `src/`58- `npm run gulp compile-extensions` for built-in extensions59- `npm run typecheck` from the `build` folder for build tooling6061Development compile tasks already type-check their inputs. Do not run `npm run typecheck-client` immediately before `npm run compile` or `npm run compile-client`; choose the command that covers the required validation. When tests only need fresh output files, use the fast one-shot `npm run transpile-client` instead of compiling.6263Use `scripts/test.sh` (or `scripts\test.bat` on Windows) for unit tests and `scripts/test-integration.sh` (or `scripts\test-integration.bat` on Windows) for integration tests. Add a targeted selector such as `--grep` whenever possible. Run `npm run valid-layers-check` only when a change may affect module layering.6465## Coding Guidelines6667### Indentation6869We use tabs, not spaces.7071### Naming Conventions7273- Use PascalCase for `type` names74- Use PascalCase for `enum` values75- Use camelCase for `function` and `method` names76- Use camelCase for `property` names and `local variables`77- Use whole words in names when possible7879### Types8081- Do not export `types` or `functions` unless you need to share it across multiple components82- Do not introduce new `types` or `values` to the global namespace8384### Comments8586- Use JSDoc style comments for `functions`, `interfaces`, `enums`, and `classes`8788### Strings8990- Use "double quotes" for strings shown to the user that need to be externalized (localized)91- Use 'single quotes' otherwise92- All strings visible to the user need to be externalized using the `vs/nls` module93- Externalized strings must not use string concatenation. Use placeholders instead (`{0}`).9495### UI labels96- Use title-style capitalization for command labels, buttons and menu items (each word is capitalized).97- Don't capitalize prepositions of four or fewer letters unless it's the first or last word (e.g. "in", "with", "for").9899### Designing UI100- When creating, editing, or reviewing any visual surface, reason in **design terms, not pixels**: name the **feeling** (Calm, Focused, Consistent, Delightful), find the **principle** it breaks, then reach for the **move** (token/tier/ramp) that restores it. Describe a bug by its role/tier/ramp (e.g. "this overlay is rounded at the control tier"), not its number.101- See the [`design-philosophy` skill](skills/design-philosophy/SKILL.md) for the full Values→Principles→Moves vocabulary, worked examples, and feedback guidance, and [design-tokens.instructions.md](instructions/design-tokens.instructions.md) for the token reference.102103### Style104105- Use arrow functions `=>` over anonymous function expressions106- Only surround arrow function parameters when necessary. For example, `(x) => x + x` is wrong but the following are correct:107108```typescript109x => x + x110(x, y) => x + y111<T>(x: T, y: T) => x === y112```113114- Always surround loop and conditional bodies with curly braces115- Open curly braces always go on the same line as whatever necessitates them116- Parenthesized constructs should have no surrounding whitespace. A single space follows commas, colons, and semicolons in those constructs. For example:117118```typescript119for (let i = 0, n = str.length; i < 10; i++) {120 if (x < 10) {121 foo();122 }123}124function f(x: number, y: string): void { }125```126127- Whenever possible, in top-level scopes, use `export function x(…) {…}` instead of `export const x = (…) => {…}`. One advantage of using the `function` keyword is that the stack trace shows a good name when debugging.128129### Code Quality130131- All files must include Microsoft copyright header132- Prefer `async` and `await` over `Promise` and `then` calls133- All user facing messages must be localized using the applicable localization framework (for example `nls.localize()` method)134- Don't add tests to the wrong test suite (e.g., adding to end of file instead of inside relevant suite)135- Look for existing test patterns before creating new structures136- Use `describe` and `test` consistently with existing patterns137- Prefer regex capture groups with names over numbered capture groups.138- If you create any temporary new files, scripts, or helper files for iteration, clean up these files by removing them at the end of the task139- Never duplicate imports. Always reuse existing imports if they are present.140- When removing an import, do not leave behind blank lines where the import was. Ensure the surrounding code remains compact.141- Do not use `any` or `unknown` as the type for variables, parameters, or return values unless absolutely necessary. If they need type annotations, they should have proper types or interfaces defined.142- When adding file watching, prefer correlated file watchers (via fileService.createWatcher) to shared ones.143- When adding tooltips to UI elements, prefer the use of IHoverService service.144- Do not duplicate code. Always look for existing utility functions, helpers, or patterns in the codebase before implementing new functionality. Reuse and extend existing code whenever possible.145- You MUST deal with disposables by registering them immediately after creation for later disposal. Use helpers such as `DisposableStore`, `MutableDisposable` or `DisposableMap`. Do NOT register a disposable to the containing class if the object is created within a method that is called repeatedly to avoid leaks. Instead, return an `IDisposable` from such method and let the caller register it.146- You MUST NOT use storage keys of another component only to make changes to that component. You MUST come up with proper API to change another component.147- Use `IEditorService` to open editors instead of `IEditorGroupsService.activeGroup.openEditor` to ensure that the editor opening logic is properly followed and to avoid bypassing important features such as `revealIfOpened` or `preserveFocus`.148- Avoid using `bind()`, `call()` and `apply()` solely to control `this` or partially apply arguments; prefer arrow functions or closures to capture the necessary context, and use these methods only when required by an API or interoperability.149- Avoid using events to drive control flow between components. Instead, prefer direct method calls or service interactions to ensure clearer dependencies and easier traceability of logic. Events should be reserved for broadcasting state changes or notifications rather than orchestrating behavior across components.150- Service dependencies MUST be declared in constructors and MUST NOT be accessed through the `IInstantiationService` at any other point in time.151152## Learnings153- Minimize the amount of assertions in tests. Prefer one snapshot-style `assert.deepStrictEqual` over multiple precise assertions, as they are much more difficult to understand and to update.154- Do not stub a global object (e.g. `(mainWindow as any).ResizeObserver = ...`) or use `any` casts to install fakes in tests. Instead, make the dependency injectable: add an optional constructor parameter on the production class that defaults to the real implementation (e.g. `targetWindow.ResizeObserver`), and have the test pass a fake that implements the real interface.155
Also in microsoft/vscode
Diff this repo’s formatsOne 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/accessibility.instructions.md · 188k | Copilot instructions | styledo-not | 61/100 | 3 days ago | |
| microsoft/vscode.github/instructions/chat.instructions.md · 188k | Copilot instructions | no sections | 39/100 | 3 days ago | |
| microsoft/vscodeextensions/copilot/src/platform/authentication/common/AGENTS.md · 188k | AGENTS.md | archsecurityagent-behaviour | 58/100 | 3 days ago | |
| microsoft/vscode.github/instructions/agentHostTesting.instructions.md · 188k | Copilot instructions | teststyletesting-strategyagent-behaviour | 55/100 | 3 days ago | |
| microsoft/vscode.github/instructions/ai-customization.instructions.md · 188k | Copilot instructions | archtypesui | 58/100 | 3 days ago | |
| microsoft/vscode.github/instructions/best-practices.instructions.md · 188k | Copilot instructions | styleui | 60/100 | 3 days ago | |
| microsoft/vscode.github/instructions/buildNext.instructions.md · 188k | Copilot instructions | setupbuildtestarch+1 | 66/100 | 3 days ago | |
| microsoft/vscode.github/instructions/coding-guidelines.instructions.md · 188k | Copilot instructions | styletypesuidocs | 60/100 | 3 days ago | |
| microsoft/vscode.github/instructions/committing.instructions.md · 188k | Copilot instructions | do-not | 23/100 | 3 days ago | |
| microsoft/vscode.github/instructions/css-best-practices.instructions.md · 188k | Copilot instructions | styleui | 29/100 | 3 days ago | |
| microsoft/vscode.github/instructions/design-philosophy.instructions.md · 188k | Copilot instructions | style | 34/100 | 3 days ago | |
| microsoft/vscode.github/instructions/design-tokens.instructions.md · 188k | Copilot instructions | styledo-not | 65/100 | 3 days ago | |
| microsoft/vscode.github/instructions/disposable.instructions.md · 188k | Copilot instructions | no sections | 16/100 | 3 days ago | |
| microsoft/vscode.github/instructions/interactive.instructions.md · 188k | Copilot instructions | ui | 43/100 | 3 days ago | |
| microsoft/vscode.github/instructions/kusto.instructions.md · 188k | Copilot instructions | agent-behaviour | 16/100 | 3 days ago | |
| microsoft/vscode.github/instructions/learnings.instructions.md · 188k | Copilot instructions | style | 40/100 | 3 days ago | |
| microsoft/vscode.github/instructions/notebook.instructions.md · 188k | Copilot instructions | no sections | 48/100 | 3 days ago | |
| microsoft/vscode.github/instructions/observables.instructions.md · 188k | Copilot instructions | no sections | 40/100 | 3 days ago | |
| microsoft/vscode.github/instructions/oss-third-party-notices.instructions.md · 188k | Copilot instructions | buildgitdependenciesdeployment+1 | 65/100 | 3 days ago | |
| microsoft/vscode.github/instructions/oss.instructions.md · 188k | Copilot instructions | git | 44/100 | 3 days ago |
Diff against .github/instructions/accessibility.instructions.md Diff against .github/instructions/chat.instructions.md Diff against extensions/copilot/src/platform/authentication/common/AGENTS.md Diff against .github/instructions/agentHostTesting.instructions.md Diff against .github/instructions/ai-customization.instructions.md Diff against .github/instructions/best-practices.instructions.md Diff against .github/instructions/buildNext.instructions.md Diff against .github/instructions/coding-guidelines.instructions.md Diff against .github/instructions/committing.instructions.md Diff against .github/instructions/css-best-practices.instructions.md Diff against .github/instructions/design-philosophy.instructions.md Diff against .github/instructions/design-tokens.instructions.md Diff against .github/instructions/disposable.instructions.md Diff against .github/instructions/interactive.instructions.md Diff against .github/instructions/kusto.instructions.md Diff against .github/instructions/learnings.instructions.md Diff against .github/instructions/notebook.instructions.md Diff against .github/instructions/observables.instructions.md Diff against .github/instructions/oss-third-party-notices.instructions.md Diff against .github/instructions/oss.instructions.md
Similar configs
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 | 3 days ago | |
| HerringtonDarkholme/megarepo.github/copilot-instructions.md · 17 | Copilot instructions | setupbuildtestlint-format+7 | 100/100 | 3 days ago | |
| louislam/uptime-kuma.github/copilot-instructions.md · 90k | Copilot instructions | setupbuildtestlint-format+9 | 100/100 | 3 days ago | |
| JCodesMore/ai-website-cloner-template.github/copilot-instructions.md · 31k | Copilot instructions | buildlint-formatstylearch+3 | 97/100 | 2 days ago | |
| bagisto/bagisto.github/copilot-instructions.md · 28k | Copilot instructions | setupbuildteststyle+5 | 97/100 | 3 days ago | |
| darkmatter/nixmac.github/copilot-instructions.md · 24 | Copilot instructions | setupbuildtestlint-format+8 | 96/100 | 3 days ago | |
| nerolis-lab/nerolis-lab.github/copilot-instructions.md · 32 | Copilot instructions | setupbuildtestlint-format+11 | 96/100 | 3 days ago | |
| thangaram611/second-brain.github/copilot-instructions.md · 0 | Copilot instructions | setupteststylearch+4 | 96/100 | 3 days ago |
