Skip to content

feat: add Rust language support with cognitive complexity analysis#327

Merged
askpt merged 7 commits into
mainfrom
repo-assist/feat-rust-support-20260517-0a08249a10a9bb4a
May 21, 2026
Merged

feat: add Rust language support with cognitive complexity analysis#327
askpt merged 7 commits into
mainfrom
repo-assist/feat-rust-support-20260517-0a08249a10a9bb4a

Conversation

@askpt
Copy link
Copy Markdown
Owner

@askpt askpt commented May 21, 2026

  • Add RustMetricsAnalyzer using tree-sitter-rust@0.21.0
  • Register 'rust' language in MetricsAnalyzerFactory
  • Add onLanguage:rust activation event in package.json
  • Add 11 unit tests for Rust analyzer (79→90 passing)
  • Add samples/Test.rs for manual extension testing

Supports: fn items, impl methods (qualified as Type::method), if/for/while/loop/match expressions, logical && and || operators, closures (when nested), and labeled break/continue.

Closes #315

- Add RustMetricsAnalyzer using tree-sitter-rust@0.21.0
- Register 'rust' language in MetricsAnalyzerFactory
- Add onLanguage:rust activation event in package.json
- Add 11 unit tests for Rust analyzer (79→90 passing)
- Add samples/Test.rs for manual extension testing

Supports: fn items, impl methods (qualified as Type::method),
if/for/while/loop/match expressions, logical && and || operators,
closures (when nested), and labeled break/continue.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 21, 2026 08:45
@askpt
Copy link
Copy Markdown
Owner Author

askpt commented May 21, 2026

@copilot resolve the merge conflicts in this pull request

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds Rust language support to the VS Code “code-metrics” extension by introducing a new Tree-sitter-based Rust cognitive complexity analyzer, wiring it into the analyzer factory, and updating the extension manifest and tests so Rust files can be analyzed and displayed via CodeLens.

Changes:

  • Added RustMetricsAnalyzer (Tree-sitter Rust) and registered the rust language ID in MetricsAnalyzerFactory.
  • Updated extension manifest to activate on Rust files and added tree-sitter-rust dependency.
  • Added Rust-focused unit tests and a samples/Test.rs file for manual verification.

Reviewed changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/metricsAnalyzer/languages/rustAnalyzer.ts New Rust cognitive complexity analyzer implementation.
src/metricsAnalyzer/metricsAnalyzerFactory.ts Registers Rust analyzer under the rust language ID.
src/unit/unit.test.ts Adds Rust analyzer unit tests and updates supported-language expectations.
package.json Adds Rust activation event/keyword and tree-sitter-rust dependency.
package-lock.json Locks the new tree-sitter-rust package (but currently with a specifier mismatch).
samples/Test.rs Adds a Rust sample file to exercise analyzer behavior manually.

Comment thread src/metricsAnalyzer/languages/rustAnalyzer.ts
Comment thread src/unit/unit.test.ts Outdated
…-support-20260517-0a08249a10a9bb4a

# Conflicts:
#	src/unit/unit.test.ts

Co-authored-by: askpt <2493377+askpt@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI commented May 21, 2026

@copilot resolve the merge conflicts in this pull request

Resolved and pushed in commit 0fd4115. I merged origin/main into this PR branch and fixed the conflict in src/unit/unit.test.ts by keeping both the Rust analyzer tests and the latest Go analyzer coverage tests.

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
    • Triggering command: /opt/hostedtoolcache/node/22.22.2/x64/bin/node node /home/REDACTED/work/code-metrics/code-metrics/node_modules/.bin/vscode-test (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI review requested due to automatic review settings May 21, 2026 10:13
@askpt askpt review requested due to automatic review settings May 21, 2026 10:13
Copilot AI review requested due to automatic review settings May 21, 2026 10:19
@askpt askpt review requested due to automatic review settings May 21, 2026 10:19
Copy link
Copy Markdown
Contributor

Copilot AI commented May 21, 2026

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

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
    • Triggering command: /opt/hostedtoolcache/node/22.22.2/x64/bin/node node /home/REDACTED/work/code-metrics/code-metrics/node_modules/.bin/vscode-test (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot finished work on behalf of askpt May 21, 2026 10:21
@askpt
Copy link
Copy Markdown
Owner Author

askpt commented May 21, 2026

@copilot Make sure the READMEs are updated and the tests that are added run in the CI

Copilot AI review requested due to automatic review settings May 21, 2026 10:29
@askpt askpt review requested due to automatic review settings May 21, 2026 10:29
Copy link
Copy Markdown
Contributor

Copilot AI commented May 21, 2026

@copilot Make sure the READMEs are updated and the tests that are added run in the CI

Addressed in commit 3bb2e5d. README now includes Rust in supported languages, and CI now runs npm run test:unit on non-Linux matrix jobs so the added tests execute in CI across all OS jobs.

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
    • Triggering command: /opt/hostedtoolcache/node/22.22.2/x64/bin/node node /home/REDACTED/work/code-metrics/code-metrics/node_modules/.bin/vscode-test (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot finished work on behalf of askpt May 21, 2026 10:31
@codecov
Copy link
Copy Markdown

codecov Bot commented May 21, 2026

Codecov Report

❌ Patch coverage is 96.63677% with 15 lines in your changes missing coverage. Please review.
✅ Project coverage is 76.23%. Comparing base (a850de1) to head (a921351).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/metricsAnalyzer/languages/rustAnalyzer.ts 96.62% 15 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #327      +/-   ##
==========================================
+ Coverage   73.66%   76.23%   +2.57%     
==========================================
  Files          12       13       +1     
  Lines        3535     3981     +446     
  Branches      364      428      +64     
==========================================
+ Hits         2604     3035     +431     
- Misses        929      944      +15     
  Partials        2        2              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@askpt askpt marked this pull request as ready for review May 21, 2026 13:19
Copilot AI review requested due to automatic review settings May 21, 2026 13:19
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 8 changed files in this pull request and generated 3 comments.

Comment thread src/metricsAnalyzer/languages/rustAnalyzer.ts
Comment thread src/unit/unit.test.ts
Comment thread .github/workflows/ci.yml
Copilot AI review requested due to automatic review settings May 21, 2026 14:48
@askpt askpt review requested due to automatic review settings May 21, 2026 14:48
Copilot finished work on behalf of askpt May 21, 2026 14:51
@askpt askpt merged commit 6e2ba04 into main May 21, 2026
9 checks passed
@askpt askpt deleted the repo-assist/feat-rust-support-20260517-0a08249a10a9bb4a branch May 21, 2026 14:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[repo-assist] feat: add Rust language support with cognitive complexity analysis

3 participants