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

Improve Wasp IDE support for PSL #887

Closed
Tracked by #570
Martinsos opened this issue Dec 20, 2022 · 8 comments
Closed
Tracked by #570

Improve Wasp IDE support for PSL #887

Martinsos opened this issue Dec 20, 2022 · 8 comments
Labels
hm Requires more thought prisma shouldfix We should do/fix this at some point

Comments

@Martinsos
Copy link
Member

No description provided.

@Martinsos Martinsos added the shouldfix We should do/fix this at some point label Dec 20, 2022
@Martinsos
Copy link
Member Author

RIght now, we don't offer proper syntax coloring or error messages for PSL when embedded in Wasp.
This is due to us not using whole PSL syntax, but parts of it (no model {,but instead we have entity MyEntity {), so PSL LSP can't recognize those.

One solution might be to put full PSL into PSL tags, with model, another might be to take PSL out into separate files. We are not yet sure how to best do this.

@Martinsos Martinsos added the hm Requires more thought label Dec 20, 2022
@Martinsos
Copy link
Member Author

Martinsos commented Apr 27, 2023

Related to #641 , since it makes a lot of sense to fix both at the same time. Or to put it differently, solution that solves one of these is probalby going to solve the other too.

@Martinsos
Copy link
Member Author

Martinsos commented Apr 27, 2023

Couple more ideas:

  1. Implement our own LSP functionality for psl powered entities in Wasp.
  2. Implement our own DSL for entities, instead of using PSL, and then implement our own LSP support for that.
  3. Maybe do something with vscode virtual file system.

@Martinsos
Copy link
Member Author

Interesting to check out: Vue has Volar code extension. They have other languages embedded in their language (well they have xml/html which then some of it contains JS, some of it smth else) and what they do to provide proper IDE support for those is construct "fake" ("virtual", temporary) files on disk where they extract those languages -> for example one file containing Javascript -> and then do stuff on those files. Stuff like formatting, hints. Then they collect that info and apply it back to their file.

We could use this for Prisma -> we could construct prisma.schema file, run formatting and possibly even prisma LSP on it, and then apply that info in our file. We would need a bit of source mapping to correctly map it, of course.

So it might be worth checking out how are they doing it with Volar.

@Zeko369
Copy link
Collaborator

Zeko369 commented Jun 10, 2023

In the meantime volar.js became a separate project that can be used for other language extensions (i.e. Astro is using it in the latest version)

@Martinsos
Copy link
Member Author

In the meantime volar.js became a separate project that can be used for other language extensions (i.e. Astro is using it in the latest version)

Wooooooah that is amazing isn't it!? Oh man! This not only could solve our Prisma issues, but also allow us to possibly embed some JS which I always wanted (@sodic don't read this :D)!

Ok this is getting exciting!

@Martinsos
Copy link
Member Author

Martinsos commented May 21, 2024

This is now work in progress! @infomiho is working on this currently (#2002 ), and direction we took is taking PSL out of Wasp file and allowing them to use have their prisma.schema file. We will be parsing that file then so we keep the level of understanding we had so far.

@infomiho
Copy link
Contributor

Completed in #2035

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hm Requires more thought prisma shouldfix We should do/fix this at some point
Projects
None yet
Development

No branches or pull requests

3 participants