-
Notifications
You must be signed in to change notification settings - Fork 40
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 prisma format functionality #1798
Conversation
I am looking for someone to test it locally. If you're interested. Please contribute. |
Hello @mcnaveen, First of all, thanks for your contribution and willingness to collaborate in making prisma better! Have you tried using the built-in format option in VSCode? Language formatting via the Prisma’s extension formatting tool is automatically invoked by VSCode when running the “Format Document” command from the taskbar. I think that should serve the purpose to what you're trying to achieve here. Screen.Recording.2024-08-13.at.17.44.07.mov |
Hi @apolanc Thanks for giving feedback on this PR. You're making a great point on the VSCode format option and I agree with that. But still, there is a functionality Let's say you have two models Running the I hope you're getting my point. If it doesn't make sense. let me know, I'll record a video. Thank you. |
@mcnaveen thanks for the answer. Please record a short video to showcase what you had in mind here :) I'll keep this contribution PR open until we get the capacity to review it. Thanks once again! |
Hi @apolanc I didn't realize it works with the VSCode format option. prisma-format.mp4 |
Help me here a bit, would you still see this PR as beneficial or do you realize it's not necessary anymore? :) |
@mcnaveen thoughts here? if none, I'll close this PR to not keep it hanging. |
Hi @apolanc Yes, it's a nice option to have in terms of DX. It can be merged! |
Thanks for the answer. I'll add this in our list of community contributions and an Engineer should be able to review and evaluate the solution. We will then decide what will happen in the PR or if we need anything from you, we'll let you know. Thanks once again for contributing! |
Hey @mcnaveen! Thanks for the PR and sorry for the delay in response. While this is an interesting idea, I don't believe formatting should be available as a code lens, this is superfluous and inconsistent with how other language servers and language-specific plugins work. We provide the formatting functionality via the language server protocol, so you can format your Prisma schema exactly the same way as when editing other file types: via the command palette or application menu, using the keybindings ( |
Hi @aqrln, Thank you for the response. It makes sense that we should also follow best practices to be consistent with other tooling. |
format
option to the Prisma language tool when theschema.prisma
file is opened.Warning
Untested code. Looking for someone to test it locally. I'm unsure about running and building it. But I added the functionality. Hope this works or Happy to fix and Improve it.