-
Notifications
You must be signed in to change notification settings - Fork 46
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
feat: add support for region comments #526
feat: add support for region comments #526
Conversation
4bb240a
to
540c870
Compare
@Xanewok can we get some support on this feat? It would be great to have for navigating large contracts and can prevent a screen-split if you're working on, for example, public functions and their errors or events. |
I'd be open to it; I thought this is a Microsoft/C#-ism but it seems to be ubiquitously supported in languages like Go (microsoft/vscode#69899), Python (microsoft/vscode-python#33) and C++, C#, TS etc. Ideally:
However, since this is such a small addition, I think it's more beneficial to have it rather than the other way around, especially if users will be migrating from the existing Juan Blanco's extension that supports it. @kanej what do you think? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have tested locally. Looks good.
Overview
This PR introduces support for region comments within Solidity
.sol
files previously mentioned in #452, addressing the issue where developers were seeking the ability to organize code into collapsible sections for improved readability and navigation.Changes
//#region
and//#endregion
patterns.Implementation Details
Region comments are implemented by modifying the Solidity language grammar to include start and end region markers. The pattern follows the typical convention of
//#region
and//#endregion
which is familiar to developers from other programming languages.The language configuration now includes logic to parse these markers and translate them into foldable regions within VS Code.
Screenshots
Included are screenshots demonstrating the collapsible regions in action within a Solidity file.
How to test this feature
.sol
file in VS Code.//#region
and//#endregion
comments around the code you wish to collapse.