Enhance ComplexityService with GitHub CodeSearch API for more accurate issue complexity assessment #7817
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
The existing complexity scoring feature relied solely on VS Code's Language Model API using basic issue metadata (title, description, labels, etc.). This approach often produced inaccurate complexity assessments because the AI had no understanding of the actual codebase structure, dependencies, or the scope of changes required.
For example, an issue titled "Fix calculateComplexity function" would receive a generic medium complexity score without considering whether it's a simple isolated function fix or requires changes across multiple interconnected components.
Solution
This PR enhances the
ComplexityService
to integrate with GitHub's CodeSearch API (via VS Code'svscode_codesearch
tool) to provide context-aware complexity assessments. The enhancement follows the same pattern already established inSuggestFixTool.ts
.Key Changes
Enhanced ComplexityService (
src/issues/complexityService.ts
):getCodeContext()
method that uses VS Code's CodeSearch tool to find relevant codeextractSearchQueries()
method that intelligently parses issue content for:calculateComplexity()
→ "calculateComplexity")dashboard.tsx
→ "dashboard.tsx")`IssueData`
→ "IssueData")Comprehensive Testing (
src/test/issues/complexityService.test.ts
):Example Improvement
Before (LM-only):
After (with CodeSearch):
The enhanced version provides more accurate scoring by understanding the actual file structure and dependencies revealed through code search.
Technical Details
vscode_codesearch
integration asSuggestFixTool
Integration
The enhancement works seamlessly with existing infrastructure:
This improvement enables developers to make better prioritization decisions by providing complexity assessments based on actual codebase context rather than just issue descriptions.
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
update.code.visualstudio.com
node ./out/src/test/runTests.js
(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Created from VS Code via the GitHub Pull Request extension.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.