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

No highlighting with slonik sql.type and inline zod schema #16

Open
mgreenw opened this issue Sep 22, 2023 · 1 comment
Open

No highlighting with slonik sql.type and inline zod schema #16

mgreenw opened this issue Sep 22, 2023 · 1 comment

Comments

@mgreenw
Copy link

mgreenw commented Sep 22, 2023

Hi! Awesome plugin. I was setting up slonik on a project and noticed that the highlighting doesn't work when I use slonik's sql.type with a custom inline zod schema.

Highlights:

const schema = z.object({ num: z.number() });

sql.type(schema)`
  SELECT 1 as num
`;

Doesn't highlight:

sql.type(z.object({ num: z.number() }))`
  SELECT 1 as num
`;
@thebearingedge
Copy link
Owner

Hi @mgreenw, thanks for the report. I have not figured out a way to solve this issue after trying a couple of times back in the spring of this year, and could use help. If i recall correctly, this issue is one of knowing when the SQL template actually begins and is not part of the code in the schema definition. there are also limitations with multiple lines in textmate grammars possibly at play. but again, i could be wrong and there may be a clean solution i'm just not aware of

I'm unable to find it at the moment, but there is a discussion or github issue somewhere about this problem and the collaborators opted to just avoid inlining their schema definitions

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

No branches or pull requests

2 participants