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

Support for VSCode Region Marker Folding #1382

Closed
arimgibson opened this issue Feb 16, 2023 · 3 comments · Fixed by #1388
Closed

Support for VSCode Region Marker Folding #1382

arimgibson opened this issue Feb 16, 2023 · 3 comments · Fixed by #1388
Assignees
Labels
kind/feature A request for a new feature. team/schema Issue for team Schema. tech/typescript Issue for tech TypeScript. topic: visualisation
Milestone

Comments

@arimgibson
Copy link

arimgibson commented Feb 16, 2023

Problem

While modeling lots of data, it's easy for the schema.prisma file to get out of hand. A super handy feature that VSCode supports is region marker folding, which allows users to define certain regions that can be folded.

Suggested solution

The Prisma extension for VSCode should introduce functionality allowing for VSCode to fold marked regions inside a Prisma schema. It's possible that much of the code for this feature could be edited from the #region folding for VS Code (GitHub) repository.

Alternatives

Customizable Extensions (like #region folding for VS Code)
This functionality can be achieved using the aforementioned #region folding for VS Code (VSCode Marketplace) extension, which allows users to specify how region folding should work in separate file extensions. Regardless, it would improve developer experience to automatically have this functionality built into the Prisma extension.

#region folding in VS Code Extension Settings for Prisma

"maptz.regionfolder": {
  "[prisma]": {
    "foldStart": "// #region [NAME]",
    "foldStartRegex": "//[\\s]*#region[\\s]*(.*)",
    "foldEnd": "// #endregion",
    "foldEndRegex": "//[\\s]*#endregion"
  }
}

Schema File Splitting
Users working in larger applications may benefit from migrating towards something like Schemix, which allows for splitting of Prisma schema files are they are generated from TypeScript. However, for small or medium sized schema, migrating to Schemix introduces new tools developers have to learn and might be time consuming.

Additional context

None

@janpio
Copy link
Member

janpio commented Feb 16, 2023

Jsut for clarification, you are looking for a way to "group together" multiple models/views/enums via putting a marker around them, and then "fold" them into a hidden state so it is easier to navigate the file?

@arimgibson
Copy link
Author

Jsut for clarification, you are looking for a way to "group together" multiple models/views/enums via putting a marker around them, and then "fold" them into a hidden state so it is easier to navigate the file?

Yep, exactly @janpio !

@Druue Druue added kind/feature A request for a new feature. tech/typescript Issue for tech TypeScript. topic: usability team/schema Issue for team Schema. labels Mar 15, 2023
@Druue Druue added this to the 4.12.0 milestone Mar 15, 2023
@Druue Druue self-assigned this Mar 15, 2023
@Jolg42 Jolg42 modified the milestones: 4.12.0, 4.14.0 Apr 26, 2023
@arimgibson
Copy link
Author

Thanks for this @Druue !!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature A request for a new feature. team/schema Issue for team Schema. tech/typescript Issue for tech TypeScript. topic: visualisation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants