Closed Martinsos closed 3 months ago
Related to https://github.com/wasp-lang/wasp/issues/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.
Couple more ideas:
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.
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)
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!
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.
Completed in #2035
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 haveentity 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.