Skip to content

Comments

support solidity struct#456

Merged
jacktasia merged 2 commits intojacktasia:masterfrom
Chipe1:patch-1
Feb 21, 2026
Merged

support solidity struct#456
jacktasia merged 2 commits intojacktasia:masterfrom
Chipe1:patch-1

Conversation

@Chipe1
Copy link
Contributor

@Chipe1 Chipe1 commented Jan 30, 2025

Rule based on https://docs.soliditylang.org/en/latest/grammar.html#a4.SolidityParser.structDefinition

Summary by CodeRabbit

Release Notes

  • New Features
    • Expanded Solidity language support to recognize struct-type definitions in addition to existing contract recognition.

@coderabbitai
Copy link

coderabbitai bot commented Feb 21, 2026

Walkthrough

A new Solidity rule entry was added to the dumb-jump.el ruleset. The rule recognizes Solidity struct-type definitions using the regex pattern struct\s*JJJ\s*\{, with corresponding test cases included. This expands Solidity support to identify struct declarations in addition to existing contract rules.

Changes

Cohort / File(s) Summary
Solidity struct rule addition
dumb-jump.el
Added a new defcustom rule entry for Solidity structs with regex pattern for struct detection and test cases validating the pattern against struct declarations with and without spacing.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title directly and accurately describes the main change: adding support for Solidity struct recognition to the dumb-jump ruleset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
dumb-jump.el (1)

1422-1422: Consider \\s+ instead of \\s* between struct and JJJ

Per the Solidity grammar, structDefinition requires at least one whitespace between the struct keyword and the name — \\s* (zero-or-more) would theoretically match structMyType{ (no space), which is invalid Solidity. That said, this is consistent with every other Solidity rule in the file (function, modifier, event, error, contract all use \\s*), so the false-positive risk in practice is negligible.

♻️ Proposed change (for consistency with grammar)
-       :regex  "struct\\s*JJJ\\s*\\\{"
+       :regex  "struct\\s+JJJ\\s*\\\{"
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@dumb-jump.el` at line 1422, Update the Solidity struct regex to require at
least one whitespace between the `struct` keyword and the identifier: in the
entry that sets `:regex "struct\\s*JJJ\\s*\\\{"` replace the `\\s*` between
`struct` and `JJJ` with `\\s+` so the pattern becomes `struct\\s+JJJ\\s*\\\{`;
this ensures `structMyType{` won't match while leaving the trailing `\\s*`
before the brace unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@dumb-jump.el`:
- Line 1422: Update the Solidity struct regex to require at least one whitespace
between the `struct` keyword and the identifier: in the entry that sets `:regex
"struct\\s*JJJ\\s*\\\{"` replace the `\\s*` between `struct` and `JJJ` with
`\\s+` so the pattern becomes `struct\\s+JJJ\\s*\\\{`; this ensures
`structMyType{` won't match while leaving the trailing `\\s*` before the brace
unchanged.

@jacktasia jacktasia self-requested a review February 21, 2026 02:21
Copy link
Owner

@jacktasia jacktasia left a comment

Choose a reason for hiding this comment

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

Thanks!

@jacktasia jacktasia merged commit 04b9ad6 into jacktasia:master Feb 21, 2026
12 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