Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add "rust" as an analysis language #3970

Merged
merged 3 commits into from
Mar 28, 2025
Merged

Add "rust" as an analysis language #3970

merged 3 commits into from
Mar 28, 2025

Conversation

redsun82
Copy link
Contributor

@redsun82 redsun82 commented Mar 26, 2025

This allows to interact with qlpacks that use rust as a language, which is currently experimental. The CLI will currently advertise Rust language support only if CODEQL_ENABLE_EXPERIMENTAL_FEATURES is set to true. By looking at past changes for Swift, I understand we don't need to do anything special about that in the extension, as the extension will just query the CLI for supported languages.

@Copilot Copilot bot review requested due to automatic review settings March 26, 2025 15:37
@redsun82 redsun82 requested a review from a team as a code owner March 26, 2025 15:37
@redsun82 redsun82 marked this pull request as draft March 26, 2025 15:37
Copy link

@Copilot 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

This PR introduces support for Rust as an experimental analysis language.

  • Updated query wizard tests to include "rust"
  • Extended query history mappers and DTOs to support a new Rust language case
  • Modified language selection data and common language definitions to incorporate Rust

Reviewed Changes

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

Show a summary per file
File Description
extensions/ql-vscode/test/vscode-tests/cli-integration/local-queries/skeleton-query-wizard.test.ts Added "rust" to the list of languages for testing the query wizard
extensions/ql-vscode/src/query-history/store/query-history-language-dto-mapper.ts Mapped QueryLanguageDto.Rust to QueryLanguage.Rust
extensions/ql-vscode/src/query-history/store/query-history-language-domain-mapper.ts Mapped QueryLanguage.Rust to QueryLanguageDto.Rust
extensions/ql-vscode/src/query-history/store/query-history-dto.ts Added a new enum value for Rust
extensions/ql-vscode/src/language-selection-panel/language-selection-data-provider.ts Included Rust in the language selection options
extensions/ql-vscode/src/common/query-language.ts Updated enum, display name mapping, and pack associations to support Rust

Tip: If you use Visual Studio Code, you can request a review from Copilot before you push from the "Source Control" tab. Learn more

@redsun82 redsun82 marked this pull request as ready for review March 27, 2025 11:22
Copy link
Member

@koesie10 koesie10 left a comment

Choose a reason for hiding this comment

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

Thanks, this makes sense to me.

The only thing I can find that might be missing is this constant. While we may not have a good repo yet, we also don't really handle it being empty. This is probably fine for now since the CLI server will not return Rust as a supported language, but if we do have a repo that we can add here, that would be nice. Perhaps just adding github/stack-graphs for now would be fine?

@redsun82
Copy link
Contributor Author

Thanks, this makes sense to me.

The only thing I can find that might be missing is this constant. While we may not have a good repo yet, we also don't really handle it being empty. This is probably fine for now since the CLI server will not return Rust as a supported language, but if we do have a repo that we can add here, that would be nice. Perhaps just adding github/stack-graphs for now would be fine?

@koesie10 Thanks for spotting that. What should be the qualities of a repo to be added to that mapping? Long term, I'd probably go for https://github.com/denoland/deno, it's a top-rated rust repository and we know we extract it pretty well already. Should I go for that already, or should I stick to GitHub owned repositories while we only staff shipped?

@koesie10
Copy link
Member

@koesie10 Thanks for spotting that. What should be the qualities of a repo to be added to that mapping? Long term, I'd probably go for https://github.com/denoland/deno, it's a top-rated rust repository and we know we extract it pretty well already. Should I go for that already, or should I stick to GitHub owned repositories while we only staff shipped?

I think generally we go for somewhat well-known repositories that also aren't too large. I think it could make sense to go for denoland/deno, unless it has a very large database. It seems like the largest database currently in that list it the Swift database at 12MB, so much more than that is probably too large and then it might make sense to choose another prominent Rust project that has a smaller database.

@redsun82
Copy link
Contributor Author

redsun82 commented Mar 28, 2025

I think generally we go for somewhat well-known repositories that also aren't too large. I think it could make sense to go for denoland/deno, unless it has a very large database. It seems like the largest database currently in that list it the Swift database at 12MB, so much more than that is probably too large and then it might make sense to choose another prominent Rust project that has a smaller database.

Ok, denoland/deno seems like is too large. I'll go for https://github.com/sharkdp/bat, also quite successful and the (zipped) DB is currently at 7.7 MB

@redsun82
Copy link
Contributor Author

redsun82 commented Mar 28, 2025

I could test that VSCode is succeeding in starting out a MRVA run on rust 🎉
image
All query runs are currently failing, but that is due to still missing upgrade and downgrade scripts (we'll get to that hopefully soon), so that's expected.

Copy link
Member

@koesie10 koesie10 left a comment

Choose a reason for hiding this comment

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

Thanks!

@redsun82 redsun82 merged commit 09a41cf into main Mar 28, 2025
18 of 20 checks passed
@redsun82 redsun82 deleted the redsun82/rust branch March 28, 2025 16:08
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.

2 participants