prisma / language-tools

🌐 Prisma Language Tools = Language Server and Prisma's VS Code extension.
https://marketplace.visualstudio.com/items?itemName=Prisma.prisma
Apache License 2.0
253 stars 36 forks source link

Fail validating when using not English column #1781

Closed sacru2red closed 1 month ago

sacru2red commented 1 month ago

Bug description

extension shows

Error validating: This line is not a valid field or attribute definition.Prisma

image

How to reproduce

add columns not english charaters

Expected behavior

prisma pass validating

Prisma information

Environment & setup

Druue commented 1 month ago

Can confirm this

model A {
  lööps String
}

This is due to how we parse field identifiers in PEST:

identifier = @{ ASCII_ALPHANUMERIC ~ ( "_" | "-" | ASCII_ALPHANUMERIC)* }

So the character that you highlight is non-ascii and therefore doesn't get picked up, we need to update the identifier to be inclusive of unicode characters :) The docs are here: https://pest.rs/book/grammars/built-ins.html

sacru2red commented 1 month ago

cool! Thank you for quick response.

Druue commented 1 month ago

Note: having discussed this internally, we're going to move forward with adding a validation warning specifically for using non-ASCII characters which includes a recommendation to use the @map attribute if wanting to use unicode characters, as the current validation for it is generic and unhelpful.

Fully supporting bare unicode characters would be a wider-spread feature request which would affect the client as well. If you could please open a feature request in prisma/prisma where you outline your use case for direct usage of unicode characters instead of through @map, that would be appreciated 🙏

sacru2red commented 1 month ago

hello. I'm not a native English speaker, and the translator doesn't work properly, so I didn't understand exactly what it meant.

Is this what you mean?

Druue commented 1 month ago

Yes! @sacru2red