* chore: ralph loop checkpoint - 2026-02-17 12:48 * fix shell script * Inline compile stage into platform jobs Remove the standalone Compile stage from the ADO pipeline. Each platform job (Windows, Linux, macOS, Alpine, Web) now compiles TypeScript itself instead of downloading a shared Compilation artifact. - Add VSCODE_RUN_CHECKS parameter to Linux jobs for hygiene/lint/CG - Add VSCODE_RUN_COMPILE_EXTRAS parameter to macOS jobs for telemetry extraction and sourcemap upload - Remove VSCODE_COMPILE_ONLY parameter entirely - Delete product-compile.yml (no longer referenced) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Always run telemetry extraction on macOS builds The macOS Universal app merge requires both x64 and arm64 builds to have identical file sets. Telemetry extraction was only running on arm64 (via VSCODE_RUN_COMPILE_EXTRAS), causing the universal merge to fail due to missing telemetry-core.json and telemetry-extensions.json in the x64 build. Move telemetry extraction outside the VSCODE_RUN_COMPILE_EXTRAS gate so it runs on all macOS builds. Sourcemap upload remains gated. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Run telemetry extraction on all client builds All client builds (Linux, Windows, macOS) need telemetry-core.json and telemetry-extensions.json. Previously only macOS arm64 ran extract-telemetry. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Only run telemetry extraction on Linux x64 (client build) Linux arm64 and armhf are server-only builds, no need for telemetry files. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Remove .ralph scaffolding files Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Fix telemetry extraction on Windows with native PowerShell The bash extract-telemetry.sh script fails on Windows because the Unix bin shim gets interpreted as Node.js code. Use a native PowerShell implementation that calls the extractor JS entry point directly. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Handle missing telemetry files gracefully on Windows The telemetry extractor may skip emitting declarations-resolved.json when no events are found. Handle this case with a warning instead of failing the build. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Use deterministic build date from git commit timestamp When each platform compiles independently, the build date embedded in cli.js (via INSERT_PRODUCT_CONFIGURATION) differs between machines because each uses new Date().toISOString(). This causes the macOS Universal app merge to fail since cli.js SHA differs between x64/arm64. Fix: use the git commit date (git log -1 --format=%cI HEAD) instead of the current wall-clock time. This ensures all independent builds on different machines produce identical timestamps. Updated in: - build/lib/date.ts: writeISODate() uses git commit date - build/next/index.ts: bundle(), transpile, and readISODate fallback all use git commit date Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Remove redundant extensions-ci task from CI pipelines core-ci (esbuild path) already includes cleanExtensionsBuildTask, compileNonNativeExtensionsBuildTask, and compileExtensionMediaBuildTask. Running extensions-ci in parallel caused a race condition where core-ci's rimraf of .build/extensions clashed with extensions-ci writing to the same directory. Also removes dead code: - extensions-ci and extensions-ci-pr task definitions (fully subsumed) - core-ci-old task (useEsbuildTranspile is always true) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * remove VSCODE_RUN_COMPILE_EXTRAS * address PR feedback regarding code duplication of `getGitCommitDate()` function by exporting a single helper function from `build/lib/date.ts` and importing it in `build/next/index.ts` to ensure consistent behavior and improve code maintainability. * update readISODate function to return git commit date instead of current date * add telemetry sorting script and integrate into build process for consistent output * refactor telemetry extraction process: replace shell script with TypeScript implementation * update skill * update telemetry-extractor dependency to version 1.19.0 * fix build * fix more duplicate telemetry definition issues * cleanup * refactor: consolidate validation checks into quality checks and remove obsolete tasks * bust the cache * undo cache bust * fix expression * fix * fix: update Azure storage account name in quality checks * fix: initialize stages set with 'Quality' * fix: add VSCODE_BUILD_TYPE parameter with options for Product and CI builds * fix: update Azure Pipeline CLI to use parameters instead of variables for queueing builds * fix: update VSCODE_BUILD_TYPE parameter values for clarity * fix: update default value for VSCODE_BUILD_TYPE parameter to 'Product' * leaner * even leaner * only npm ci in build * 💄 * run entire npm ci * fix * fix * fix it * Inline CompileCLI into platform stages - Remove centralized CompileCLI stage - Move CLI jobs into Windows, Linux, macOS stages as independent jobs - CLI jobs now compile, publish unsigned mid-job, sign, and publish signed - Platform compile jobs use deemon + waitForArtifacts for async CLI download - Delete separate CLI sign jobs (now merged into CLI compile jobs) - Remove CompileCLI from publish.ts stage tracking * fix: macOS CLI signing - use proper directory structure for ESRP * fix: add BUILDS_API_URL to Windows and Linux job templates * fix: label Linux CLI jobs clearly --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: João Moreno <22350+joaomoreno@users.noreply.github.com>
8.7 KiB
VS Code Copilot Instructions
Project Overview
Visual 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:
Root Folders
src/: Main TypeScript source code with unit tests insrc/vs/*/test/foldersbuild/: Build scripts and CI/CD toolsextensions/: Built-in extensions that ship with VS Codetest/: Integration tests and test infrastructurescripts/: Development and build scriptsresources/: Static resources (icons, themes, etc.)out/: Compiled JavaScript output (generated during build)
Core Architecture (src/ folder)
src/vs/base/- Foundation utilities and cross-platform abstractionssrc/vs/platform/- Platform services and dependency injection infrastructuresrc/vs/editor/- Text editor implementation with language services, syntax highlighting, and editing featuressrc/vs/workbench/- Main application workbench for web and desktopworkbench/browser/- Core workbench UI components (parts, layout, actions)workbench/services/- Service implementationsworkbench/contrib/- Feature contributions (git, debug, search, terminal, etc.)workbench/api/- Extension host and VS Code API implementation
src/vs/code/- Electron main process specific implementationsrc/vs/server/- Server specific implementation
The core architecture follows these principles:
- Layered architecture - from
base,platform,editor, toworkbench - Dependency injection - Services are injected through constructor parameters
- If non-service parameters are needed, they need to come after the service parameters
- Contribution model - Features contribute to registries and extension points
- Cross-platform compatibility - Abstractions separate platform-specific code
Built-in Extensions (extensions/ folder)
The extensions/ directory contains first-party extensions that ship with VS Code:
- Language support -
typescript-language-features/,html-language-features/,css-language-features/, etc. - Core features -
git/,debug-auto-launch/,emmet/,markdown-language-features/ - Themes -
theme-*folders for default color themes - Development tools -
extension-editing/,vscode-api-tests/
Each extension follows the standard VS Code extension structure with package.json, TypeScript sources, and contribution points to extend the workbench through the Extension API.
Finding Related Code
- Semantic search first: Use file search for general concepts
- Grep for exact strings: Use grep for error messages or specific function names
- Follow imports: Check what files import the problematic module
- Check test files: Often reveal usage patterns and expected behavior
Validating TypeScript changes
MANDATORY: Always check the VS Code - Build watch task output via #runTasks/getTaskOutput for compilation errors before running ANY script or declaring work complete, then fix all compilation errors before moving forward.
- NEVER run tests if there are compilation errors
- NEVER use
npm run compileto compile TypeScript files but call #runTasks/getTaskOutput instead
TypeScript compilation steps
- Monitor the
VS Code - Buildtask outputs for real-time compilation errors as you make changes - This task runs
Core - BuildandExt - Buildto incrementally compile VS Code TypeScript sources and built-in extensions - Start the task if it's not already running in the background
- For TypeScript changes in the
buildfolder, you can simply runnpm run typecheckin thebuildfolder.
TypeScript validation steps
- Use the run test tool if you need to run tests. If that tool is not available, then you can use
scripts/test.sh(orscripts\test.baton Windows) for unit tests (add--grep <pattern>to filter tests) orscripts/test-integration.sh(orscripts\test-integration.baton Windows) for integration tests (integration tests end with .integrationTest.ts or are in /extensions/). - Use
npm run valid-layers-checkto check for layering issues
Coding Guidelines
Indentation
We use tabs, not spaces.
Naming Conventions
- Use PascalCase for
typenames - Use PascalCase for
enumvalues - Use camelCase for
functionandmethodnames - Use camelCase for
propertynames andlocal variables - Use whole words in names when possible
Types
- Do not export
typesorfunctionsunless you need to share it across multiple components - Do not introduce new
typesorvaluesto the global namespace
Comments
- Use JSDoc style comments for
functions,interfaces,enums, andclasses
Strings
- Use "double quotes" for strings shown to the user that need to be externalized (localized)
- Use 'single quotes' otherwise
- All strings visible to the user need to be externalized using the
vs/nlsmodule - Externalized strings must not use string concatenation. Use placeholders instead (
{0}).
UI labels
- Use title-style capitalization for command labels, buttons and menu items (each word is capitalized).
- Don't capitalize prepositions of four or fewer letters unless it's the first or last word (e.g. "in", "with", "for").
Style
- Use arrow functions
=>over anonymous function expressions - Only surround arrow function parameters when necessary. For example,
(x) => x + xis wrong but the following are correct:
x => x + x
(x, y) => x + y
<T>(x: T, y: T) => x === y
- Always surround loop and conditional bodies with curly braces
- Open curly braces always go on the same line as whatever necessitates them
- Parenthesized constructs should have no surrounding whitespace. A single space follows commas, colons, and semicolons in those constructs. For example:
for (let i = 0, n = str.length; i < 10; i++) {
if (x < 10) {
foo();
}
}
function f(x: number, y: string): void { }
- Whenever possible, use in top-level scopes
export function x(…) {…}instead ofexport const x = (…) => {…}. One advantage of using thefunctionkeyword is that the stack-trace shows a good name when debugging.
Code Quality
- All files must include Microsoft copyright header
- Prefer
asyncandawaitoverPromiseandthencalls - All user facing messages must be localized using the applicable localization framework (for example
nls.localize()method) - Don't add tests to the wrong test suite (e.g., adding to end of file instead of inside relevant suite)
- Look for existing test patterns before creating new structures
- Use
describeandtestconsistently with existing patterns - Prefer regex capture groups with names over numbered capture groups.
- 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 task
- Never duplicate imports. Always reuse existing imports if they are present.
- Do not use
anyorunknownas the type for variables, parameters, or return values unless absolutely necessary. If they need type annotations, they should have proper types or interfaces defined. - When adding file watching, prefer correlated file watchers (via fileService.createWatcher) to shared ones.
- When adding tooltips to UI elements, prefer the use of IHoverService service.
- 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.
- You MUST deal with disposables by registering them immediately after creation for later disposal. Use helpers such as
DisposableStore,MutableDisposableorDisposableMap. Do NOT register a disposable to the containing class if the object is created within a method that is called repeadedly to avoid leaks. Instead, return aIDisposablefrom such method and let the caller register it. - 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.
- Use
IEditorServiceto open editors instead ofIEditorGroupsService.activeGroup.openEditorto ensure that the editor opening logic is properly followed and to avoid bypassing important features such asrevealIfOpenedorpreserveFocus. - Avoid using
bind(),call()andapply()solely to controlthisor 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.
Learnings
- Minimize the amount of assertions in tests. Prefer one snapshot-style
assert.deepStrictEqualover multiple precise assertions, as they are much more difficult to understand and to update.