Skip to content

Conversation

cprecioso
Copy link
Member

@cprecioso cprecioso commented Jul 30, 2025

This is a currently-not-working PR for allowing trailing documentation comments in a node when parsing PSL:

model Post {
  title String /// <- this trailing comment should get attached to the `title` node
}

Right now (as of #2949) we only support leading comments.


Problem

#2949 (comment)

Solution

I asked at Haskell's Matrix Room, and got the suggestion that PSL is a newline-significant language, so it is common to split the lexeme parser into one that consumes whitespace and another that consumes whitespace+newlines.

In the end I made two spaceConsumer parsers, and use the non-newline version everywhere, and the yes-newline version whenever it makes sense (in between top-level structures in the Prisma file, and inside lines in { braces }).

I kept debugging and tweaking but at some point I had to stop working on it as it is way eating into the time budget for this task.

@cprecioso cprecioso marked this pull request as draft July 30, 2025 15:24
Base automatically changed from cprecioso/2132-support-parsing-triple-slash-comments-in-schemaprisma to main August 12, 2025 09:42
@cprecioso cprecioso force-pushed the cprecioso/wip-trailing-triple-slash branch from 6fb5ef4 to 9609644 Compare August 12, 2025 14:41
@cprecioso cprecioso closed this Oct 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant