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

Adding union to be recognized as a keyword in Rust #3949

Merged
merged 1 commit into from
Jan 1, 2024

Conversation

Jaebaek-Lee
Copy link
Contributor

@Jaebaek-Lee Jaebaek-Lee commented Dec 26, 2023

Adding union to be recognized as a keyword in Rust.

#3948

Changes

Added the union keyword to the KEYWORDS array in rust.js.
image

Checklist

  • Added markup tests, or they don't apply here because...
    Even without adding any markup tests, the following code ensures that the highlighting is applied correctly.
        begin: [
          /(?:trait|enum|struct|union|impl|for)/,
          /\s+/,
          UNDERSCORE_IDENT_RE
        ],
        className: {
          1: "keyword",
          3: "title.class"
        }
  • Updated the changelog at CHANGES.md

Copy link

Build Size Report

Changes to minified artifacts in /build, after gzip compression.

3 files changed

Total change +4 B

View Changes
file base pr diff
es/languages/rust.min.js 1.48 KB 1.49 KB +3 B
highlight.min.js 8.21 KB 8.21 KB -1 B
languages/rust.min.js 1.49 KB 1.49 KB +2 B

@joshgoebel
Copy link
Member

Please also provide a test case of union used in context (outside of defining a union)... see tests/markup, etc.

@Jaebaek-Lee
Copy link
Contributor Author

Jaebaek-Lee commented Dec 26, 2023

As I commented in the issue #3948, union is not commonly used except when defining unions, so I didn't write a separate test case for it.
Of course, It can be used outside of defining a union, such as let r#union, but that's not relevant to this issue, as it's a case of the regex not recognizing union as a keyword.

@joshgoebel
Copy link
Member

union is not commonly used except when defining unions, so I didn't write a separate test case for it.

Can you provide at least one sample usage outside of a union declaration other than r#union? The keywords list is not necessarily intended to be exhaustive if the keywords already have their own separate rules.

Copy link

github-actions bot commented Jan 1, 2024

Build Size Report

Changes to minified artifacts in /build, after gzip compression.

2 files changed

Total change +5 B

View Changes
file base pr diff
es/languages/rust.min.js 1.48 KB 1.49 KB +3 B
languages/rust.min.js 1.49 KB 1.49 KB +2 B

@joshgoebel joshgoebel merged commit 0fac1c6 into highlightjs:main Jan 1, 2024
15 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.

2 participants