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

Spans and positions get shifted out of sync when schema includes multibyte characters #1308

Closed
jacksonyu opened this issue Dec 1, 2022 · 7 comments · Fixed by prisma/prisma-engines#4815
Labels
bug/2-confirmed Bug has been reproduced and confirmed. domain/schema Issue in the "Schema" domain: Prisma Schema, Introspection, Migrations etc. kind/bug A reported bug. topic: code action LSP code actions topic: multi-byte topic: rename LSP rename topic: validation
Milestone

Comments

@jacksonyu
Copy link

Bug description

when there are any Chinese characters in the comment , the prompt message will be displaced.
pls check the picture:
企业微信截图_16698730889157.png

and you delete the Chinese characters, everything works fine:
企业微信截图_16698730889157.png

How to reproduce

Expected behavior

the prompt messages are displaced normally

Prisma information

// Add your schema.prisma
// Add your code using Prisma Client

Environment & setup

  • OS:
  • Database:
  • Node.js version:

Prisma Version

4.7.0
@jacksonyu jacksonyu added the kind/bug A reported bug. label Dec 1, 2022
@tomhoule tomhoule transferred this issue from prisma/prisma Dec 1, 2022
@tomhoule tomhoule added process/candidate Candidate for next Milestone. domain/schema Issue in the "Schema" domain: Prisma Schema, Introspection, Migrations etc. bug/1-unconfirmed Bug should have enough information for reproduction, but confirmation has not happened yet. labels Dec 1, 2022
@iamel89
Copy link

iamel89 commented Dec 8, 2022

Have the same problem. Not only Chinese characters in comments cause the highlight misposition, but any non-latin symbols!
To reproduce just try to paste into comments 'абвгд'
There is a problem with errors highlighting too. And when have a lot of such comments debugging is very awful.

Prisma version 4.7.1
Снимок экрана 2022-12-08 111149

@Druue Druue added bug/2-confirmed Bug has been reproduced and confirmed. and removed bug/1-unconfirmed Bug should have enough information for reproduction, but confirmation has not happened yet. labels Dec 9, 2022
@Druue
Copy link
Contributor

Druue commented Dec 9, 2022

Yep, can confirm! Seems to be something about how we handle utf-16 vs utf-8 characters and the conversion between how we represent Positions here vs in Engines
image

Running on: Prisma v4.7.1, VSCode: v1.74.0


Schema for ref

generator client {
  provider        = "prisma-client-js"
}

datasource db {
  provider = "mysql"
  url      = env("DATABASE_URL")
  relationMode = "prisma"
}

model User {
  id Int @id @default(autoincrement())
  email String @unique
  posts Post[]
}

/// абвгд
model Post {
  id Int @id @default(autoincrement())
  author User @relation(fields: [authorId], references: [id])
  authorId Int
}

@janpio janpio removed the process/candidate Candidate for next Milestone. label Dec 21, 2022
@iamel89
Copy link

iamel89 commented May 12, 2023

Can anyone says when this would be done? Is there any plan to close this issue?

@janpio
Copy link
Contributor

janpio commented May 12, 2023

Can anyone says when this would be done?

No.

Is there any plan to close this issue?

Yes, when there is capacity. PRs welcome as well, happy to review.

@janpio janpio changed the title VSCode extention bug with Chinese comment VSCode extension bug with Chinese comment Mar 18, 2024
@Druue Druue changed the title VSCode extension bug with Chinese comment Validations get shifted out of sync when schema includes multibyte characters Jun 12, 2024
@Druue Druue changed the title Validations get shifted out of sync when schema includes multibyte characters Validation squiggles get shifted out of sync when schema includes multibyte characters Jun 12, 2024
@Huliiiiii
Copy link

This also breaks quick fix, for example: quick fix of automatically add @@index will insert into the wrong line.

@Druue
Copy link
Contributor

Druue commented Jun 13, 2024

Cheers @Huliiiiii, am able to confirm that too, gonna take a look

Screen.Recording.2024-06-13.at.02.12.24.mov

@Druue
Copy link
Contributor

Druue commented Jun 13, 2024

Rename also breaks

Screen.Recording.2024-06-13.at.02.19.54.mov

@Druue Druue added topic: rename LSP rename topic: code action LSP code actions labels Jun 13, 2024
@Druue Druue changed the title Validation squiggles get shifted out of sync when schema includes multibyte characters Spans and positions get shifted out of sync when schema includes multibyte characters Jun 13, 2024
@Druue Druue closed this as completed Jun 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug/2-confirmed Bug has been reproduced and confirmed. domain/schema Issue in the "Schema" domain: Prisma Schema, Introspection, Migrations etc. kind/bug A reported bug. topic: code action LSP code actions topic: multi-byte topic: rename LSP rename topic: validation
Projects
None yet
6 participants