Skip to content

Commit eb24923

Browse files
committed
Merge remote-tracking branch 'upstream/main' into dev/rigibson/integration-test-restore
2 parents 2493d9d + 7e40fad commit eb24923

File tree

177 files changed

+9328
-3252
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

177 files changed

+9328
-3252
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: branch_classification
2+
description: Branch classification configuration for repository
3+
resource: repository
4+
disabled: false
5+
where:
6+
configuration:
7+
branchClassificationSettings:
8+
defaultClassification: nonproduction
9+
ruleset:
10+
- name: prod-branches
11+
branchNames:
12+
- main
13+
- prerelease
14+
- release
15+
classification: production
16+
- name: nonprod-branches
17+
branchNames:
18+
- feature
19+
classification: nonproduction

.github/copilot-instructions.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# Copilot Coding Agent Instructions for `vscode-csharp`
2+
3+
## Project Overview
4+
- This is the official C# extension for Visual Studio Code, supporting C# development via OmniSharp and Roslyn-based language servers.
5+
- The codebase is TypeScript/JavaScript, with some JSON and configuration files. It integrates with .NET components and external language servers.
6+
7+
## Architecture & Key Components
8+
- **src/**: Main extension source. Key subfolders:
9+
- `lsptoolshost/`: Hosts LSP (Language Server Protocol) logic, including Copilot integration (`copilot/`), Roslyn, and Razor support.
10+
- `omnisharp/`: Protocols and logic for OmniSharp-based language server.
11+
- `razor/`: Razor language support and configuration.
12+
- **Copilot Integration**:
13+
- `src/lsptoolshost/copilot/contextProviders.ts` and `relatedFilesProvider.ts` register C# context and related files providers for GitHub Copilot and Copilot Chat extensions.
14+
- The Roslyn Copilot language server is managed as a downloadable component (see `package.json` and `CONTRIBUTING.md`).
15+
16+
## Developer Workflows
17+
- **Build**: `npm run compile` (or use VS Code build task)
18+
- **Test**: `npm test` (runs Jest tests)
19+
- **Package**: `npm run package` (creates VSIX)
20+
- **Dependencies**: Use `gulp installDependencies` to fetch .NET/LS components
21+
- **Debugging**: See `docs/debugger/` for advanced .NET debugging, including runtime and external library debugging.
22+
- **Roslyn Copilot Language Server**: To update/test, see instructions in `CONTRIBUTING.md` (triggers pipeline, checks logs for install, etc.)
23+
24+
## Infrastructure Tasks
25+
- **Tasks Directory**: Build automation is in `tasks/` using Gulp. Key modules:
26+
- `testTasks.ts`: Test orchestration for unit/integration tests across components
27+
- `offlinePackagingTasks.ts`: VSIX packaging for different platforms (`vsix:release:package:*`)
28+
- `componentUpdateTasks.ts`: Automated updates for Roslyn Copilot components
29+
- `snapTasks.ts`: Version bumping and changelog management for releases
30+
- `gitTasks.ts`: Git operations for automated PR creation and branch management
31+
- **Adding New Tasks**: Create `.ts` file in `tasks/`, define `gulp.task()` functions, require in `gulpfile.ts`
32+
- **Task Patterns**: Use `projectPaths.ts` for consistent path references, follow existing naming conventions (`test:integration:*`, `vsix:*`, etc.)
33+
34+
## Project Conventions & Patterns
35+
- **TypeScript**: Follows strict linting (`.eslintrc.js`), including header/license blocks and camelCase filenames (except for interfaces and special files).
36+
- **Component Downloads**: Language servers and debuggers are downloaded at runtime; see `package.json` for URLs and install logic.
37+
- **Copilot Providers**: Use `registerCopilotContextProviders` and `registerCopilotRelatedFilesProvider` to extend Copilot context for C#.
38+
- **Testing**: Prefer integration tests over unit tests for features. Structure follows:
39+
- `test/lsptoolshost/integrationTests/` for Roslyn/LSP features
40+
- `test/omnisharp/omnisharpIntegrationTests/` for OmniSharp features
41+
- `test/razor/razorIntegrationTests/` for Razor features
42+
- Use `test/*/integrationTests/integrationHelpers.ts` for test setup utilities
43+
- Tests use Jest with VS Code test environment and require workspace test assets
44+
- Run with `npm run test:integration:*` commands (e.g., `npm run test:integration:csharp`)
45+
46+
## Integration Points
47+
- **GitHub Copilot**: Extension registers C# context and related files providers if Copilot/Copilot Chat extensions are present.
48+
- **Roslyn Language Server**: Managed as a downloadable component, versioned in `package.json` and updated via pipeline.
49+
- **OmniSharp**: Legacy support, also downloaded as a component.
50+
51+
## Examples
52+
- To add a new Copilot context provider: see `src/lsptoolshost/copilot/contextProviders.ts`.
53+
- To update Roslyn Copilot server: follow `CONTRIBUTING.md` > "Updating the Roslyn Copilot Language Server version".
54+
55+
## References
56+
- [README.md](../README.md): User-facing overview and features
57+
- [CONTRIBUTING.md](../CONTRIBUTING.md): Dev setup, packaging, and advanced workflows
58+
- [package.json](../package.json): Component download logic, scripts
59+
- [src/lsptoolshost/copilot/](../src/lsptoolshost/copilot/): Copilot integration logic
60+
61+
---
62+
For any unclear or incomplete sections, please provide feedback to improve these instructions.

.github/workflows/branch-snap.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ jobs:
1212
with:
1313
configuration_file_path: '.config/snap-flow.json'
1414

15-
create-pull-request:
15+
bump-main-version:
16+
needs: check-script
1617
if: github.ref == 'refs/heads/main'
1718
runs-on: ubuntu-latest
1819
steps:
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# GitHub Copilot setup steps for the C# VS Code extension
2+
# This file configures the environment for the GitHub Copilot coding agent
3+
4+
name: "Copilot Setup Steps"
5+
6+
# Automatically run the setup steps when they are changed to allow for easy validation, and
7+
# allow manual testing through the repository's "Actions" tab
8+
on:
9+
workflow_dispatch:
10+
push:
11+
paths:
12+
- .github/workflows/copilot-setup-steps.yml
13+
pull_request:
14+
paths:
15+
- .github/workflows/copilot-setup-steps.yml
16+
17+
jobs:
18+
# The job MUST be called `copilot-setup-steps` or it will not be picked up by Copilot.
19+
copilot-setup-steps:
20+
runs-on: ubuntu-latest
21+
permissions:
22+
contents: read # Read access to the repository contents (required for checkout)
23+
24+
steps:
25+
- name: Checkout code
26+
uses: actions/checkout@v5
27+
28+
# Install Node.js (required for TypeScript compilation and npm packages)
29+
- uses: actions/setup-node@v4
30+
with:
31+
node-version: '20'
32+
cache: 'npm'
33+
34+
# Install .NET SDK (required for some build components and MSBuild tasks)
35+
- uses: actions/setup-dotnet@v4
36+
with:
37+
dotnet-version: '8.0.x'
38+
39+
# Install npm dependencies
40+
- name: Install dependencies
41+
run: npm ci
42+
43+
# Install gulp globally (required for build tasks)
44+
- name: Install gulp
45+
run: npm install -g gulp
46+
47+
# Install vsce (needed for packaging tasks)
48+
- name: Install vsce
49+
run: npm install -g vsce
50+
51+
# Install server dependencies (needed for integration tests and running)
52+
- name: Install dependencies
53+
run: gulp installDependencies
54+
55+
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Create GitHub Release
2+
on:
3+
push:
4+
tags:
5+
- 'v2.*'
6+
7+
permissions:
8+
contents: write
9+
10+
jobs:
11+
# This job runs against the yaml defined in the tag we were triggered on.
12+
# So we can modify the release creation without having to wait for the change to flow into the commit
13+
# that we're tagging, we call a reusable workflow from main
14+
create-release:
15+
uses: dotnet/vscode-csharp/.github/workflows/release-reusable.yml@main
16+
with:
17+
tag: ${{ github.ref_name }}
18+
secrets: inherit
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: Reusable - Create Release from Changelog
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
tag:
7+
description: Tag name to create a release for (e.g. v2.88.0 or v2.88.0-prerelease)
8+
required: true
9+
type: string
10+
11+
permissions:
12+
contents: write
13+
14+
jobs:
15+
create-release:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Checkout tag
19+
uses: actions/checkout@v4
20+
with:
21+
ref: refs/tags/${{ inputs.tag }}
22+
23+
- name: Create release from CHANGELOG
24+
uses: actions/github-script@v7
25+
env:
26+
TAG: ${{ inputs.tag }}
27+
with:
28+
github-token: ${{ secrets.GITHUB_TOKEN }}
29+
script: |
30+
const { readFile } = require('fs/promises');
31+
32+
const tag = process.env.TAG;
33+
core.info(`Creating release for tag: ${tag}`);
34+
35+
if (!tag || !tag.startsWith('v2.')) {
36+
core.setFailed('Invalid tag name. Tag name must start with "v2."');
37+
return;
38+
}
39+
40+
// Read CHANGELOG.md and extract the latest section (first single '#' header)
41+
const changelog = await readFile('CHANGELOG.md', 'utf8');
42+
const headerMatch = changelog.match(/^# .+$/m);
43+
if (!headerMatch) {
44+
core.setFailed('Could not find a top-level # header in CHANGELOG.md');
45+
return;
46+
}
47+
const startIdx = changelog.indexOf(headerMatch[0]);
48+
let endIdx = changelog.indexOf('\n# ', startIdx + headerMatch[0].length);
49+
if (endIdx === -1) {
50+
endIdx = changelog.length;
51+
}
52+
const releaseNotes = changelog.substring(startIdx, endIdx).trim();
53+
54+
const isPrerelease = tag.includes('-prerelease');
55+
core.info(`Prerelease: ${isPrerelease}`);
56+
57+
try {
58+
const response = await github.rest.repos.createRelease({
59+
owner: context.repo.owner,
60+
repo: context.repo.repo,
61+
tag_name: tag,
62+
name: tag,
63+
body: releaseNotes,
64+
prerelease: isPrerelease,
65+
});
66+
core.info(`Release created: ${response.data.html_url}`);
67+
} catch (err) {
68+
if (err && err.status === 422 && err.message && String(err.message).includes('already_exists')) {
69+
core.warning(`Release for tag '${tag}' already exists.`);
70+
} else {
71+
core.setFailed(`Error creating release: ${err?.message ?? err}`);
72+
}
73+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Update CHANGELOG
2+
on:
3+
workflow_dispatch:
4+
schedule:
5+
# Runs every Tuesday at 9 PM Pacific Time (5 AM UTC Wednesday)
6+
- cron: '0 5 * * 3'
7+
8+
permissions:
9+
contents: write
10+
pull-requests: write
11+
12+
jobs:
13+
update-changelog:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Check out
17+
uses: actions/checkout@v2
18+
with:
19+
fetch-depth: 0
20+
- name: Install roslyn-tools
21+
run: dotnet tool install -g Microsoft.RoslynTools --prerelease --add-source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json
22+
- name: Install NodeJS
23+
uses: actions/setup-node@v4
24+
with:
25+
node-version: '20.x'
26+
- name: Install dependencies
27+
run: npm ci
28+
- name: Update CHANGELOG
29+
run: npx gulp updateChangelog
30+
- name: Create update PR
31+
uses: peter-evans/create-pull-request@v4
32+
with:
33+
token: ${{ secrets.GITHUB_TOKEN }}
34+
commit-message: Update ${{ github.ref_name }} CHANGELOG
35+
title: '[automated] Update ${{ github.ref_name }} CHANGELOG'
36+
branch: merge/update-${{ github.ref_name }}-changelog

.mocharc.jsonc

Lines changed: 0 additions & 6 deletions
This file was deleted.
File renamed without changes.

.vscode/settings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
"vsix/": true
1313
},
1414
"[typescript]": {
15-
"editor.defaultFormatter": "esbenp.prettier-vscode"
15+
"editor.defaultFormatter": "esbenp.prettier-vscode",
16+
"editor.formatOnSave": true
1617
},
1718
"csharp.suppressDotnetRestoreNotification": true,
1819
"typescript.tsdk": "./node_modules/typescript/lib",

0 commit comments

Comments
 (0)