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

LSP: Can't rename if the server getting position that is not the end of word. #576

Closed
LumaKernel opened this issue Oct 19, 2020 · 0 comments · Fixed by #572
Closed

LSP: Can't rename if the server getting position that is not the end of word. #576

LumaKernel opened this issue Oct 19, 2020 · 0 comments · Fixed by #572
Assignees
Labels
bug/2-confirmed Bug has been reproduced and confirmed. kind/bug A reported bug. topic: language server

Comments

@LumaKernel
Copy link
Contributor

LumaKernel commented Oct 19, 2020

I will make #572 clearer.

Please consider below file for example.

model Post {
    id        Int               @id @default(autoincrement())
    author    User? @relation(fields: [authorId], references: [id])
    //        ^ Cursor is here and rename to "Customer"
    authorId  Int?
}

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

VSCode

model Post {
    id        Int               @id @default(autoincrement())
    author    User? @relation(fields: [authorId], references: [id])
    //            ^ VSCode will send this position to LSP
    authorId  Int?
}

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

some clients like vim-lsp

model Post {
    id        Int               @id @default(autoincrement())
    author    User? @relation(fields: [authorId], references: [id])
    //        ^ vim-lsp sends this position if cursor is here
    authorId  Int?
}

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

This causes...

Customermodel Post {
    id        Int               @id @default(autoincrement())
    author    User? @relation(fields: [authorId], references: [id])
    //        ^ vim-lsp sends this position if cursor is here
    authorId  Int?
	@@map("")
}

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

Note: It's tested with commenting out console.log around renaming because vim-lsp stuck with broken response from this LSP ( #571 ).

Expected one is...

model Post {
    id        Int               @id @default(autoincrement())
    author    Customer? @relation(fields: [authorId], references: [id])
    //        ^ vim-lsp sends this points if cursor is here
    authorId  Int?
}

model Customer {
    id        Int      @id @default(autoincrement())
    posts     Post[]
	@@map("User")
}
@LumaKernel LumaKernel changed the title Can't rename if the server getting position that is not the end of word. LSP: Can't rename if the server getting position that is not the end of word. Oct 19, 2020
@carmenberndt carmenberndt added bug/2-confirmed Bug has been reproduced and confirmed. kind/bug A reported bug. topic: language server labels Oct 19, 2020
@carmenberndt carmenberndt added this to the Release 2.10.0 milestone Oct 19, 2020
🌐 Language Tools Issue Categorization automation moved this from Bug to Closed/Done Oct 19, 2020
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. kind/bug A reported bug. topic: language server
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants