Skip to content

Conversation

@mhils
Copy link
Member

@mhils mhils commented May 30, 2025

No description provided.

@mhils mhils requested review from Copilot and lups2000 May 30, 2025 16:25
Copy link

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 adds a new Python API export for retrieving supported syntax highlighting languages while refactoring existing functions to use a new as_str() conversion.

  • Updated syntax highlighting functions in mitmproxy-rs/src/syntax_highlight.rs to use as_str().
  • Added a new languages() function and updated module exports in mitmproxy-rs/src/lib.rs.
  • Modified the syntax_highlight getter in mitmproxy-rs/src/contentviews.rs to return a &'static str.
  • Introduced a new VALUES array and as_str() method for Language in mitmproxy-highlight/src/lib.rs.

Reviewed Changes

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

File Description
mitmproxy-rs/src/syntax_highlight.rs Refactored tag conversion and added a new languages() function.
mitmproxy-rs/src/lib.rs Updated module exports to include the new languages() function.
mitmproxy-rs/src/contentviews.rs Changed syntax_highlight getter to return a static string reference.
mitmproxy-highlight/src/lib.rs Added Language::VALUES and renamed to_str() to as_str() for Tag.
Comments suppressed due to low confidence (1)

mitmproxy-rs/src/contentviews.rs:120

  • Changing the return type from String to a static string reference may lead to lifetime or API compatibility issues. Ensure the underlying value is truly static or update dependent code accordingly.
pub fn syntax_highlight(&self) -> &'static str {

@mhils mhils merged commit b2551ae into mitmproxy:main May 30, 2025
23 checks passed
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.

1 participant