Skip to content

Commit 7fa8fe5

Browse files
authored
Add copilot instructions (#8676)
2 parents f97de5c + 75ad9fb commit 7fa8fe5

File tree

1 file changed

+62
-0
lines changed

1 file changed

+62
-0
lines changed

.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.

0 commit comments

Comments
 (0)