ayamir / nvimdots

A well configured and structured Neovim.
BSD 3-Clause "New" or "Revised" License
2.82k stars 451 forks source link

Error when use `gr` to rename #1306

Open ayamir opened 1 week ago

ayamir commented 1 week ago

Version confirmation

Following prerequisites

Not a user config issue

Neovim version

NVIM v0.10.0

Operating system/version

macOS 14.5 (23F79)

Terminal name/version

kitty

$TERM environment variable

No response

Branch info

0.10 (Nightly)

Fetch Preferences

SSH (use_ssh = true)

How to reproduce the issue

Trying to rename a function that appears in different files.

Expected behavior

No error

Actual behavior

image

Additional information

No response

ayamir commented 1 week ago

It has to do with ghost_text introduced in #733.

Jint-lzxy commented 6 days ago

@ayamir Did u mean gr or gR (uppercase)? Tho I can't seem to reproduce this using either of them on my end, maybe u could upload the document in question so that things could be easier to understand?

ayamir commented 6 days ago

I'm coding for my company so the files are business secrets. But I can also reproduce this error on other files.

https://github.com/ayamir/nvimdots/assets/61657399/a3aa3589-acbc-40e9-9167-c4d8e34f1d71

package main

import (
    "fmt"
    "net"
    "sync"
    "time"
)

const (
    MAX_CONN = 10
)

func main() {
    var wg sync.WaitGroup
    wg.Add(1)
    for i := 0; i < MAX_CONN; i++ {
        go Conn("127.0.0.1:8089", i)
        time.Sleep(time.Millisecond * 100)
    }
    wg.Wait()
}

func Conn(addr string, id int) {
    conn, err := net.Dial("tcp", addr)
    if err != nil {
        fmt.Println(err)
        return
    }
    fmt.Println("connect ", id)
    go func() {
        buf := make([]byte, 1024)
        for {
            n, err := conn.Read(buf)
            if err != nil {
                break
            }
            fmt.Println(id, "read: ", string(buf[:n]))
        }
    }()
    time.Sleep(time.Second * 1)
    for {
        _, err := conn.Write([]byte("hello"))
        if err != nil {
            break
        }
        time.Sleep(time.Second * 10)
    }
}
Jint-lzxy commented 6 days ago

At first glance it seems like there's something odd happening with lspsaga (not cmp iiuc)... I'm not entirely sure about it, but it could be a good starting point tho.

ayamir commented 5 days ago

This issue can be stably reproduced for the above file. The only method to eliminate the errors is quitting nvim completely. Currently my workaround is just disable ghost_text.

ayamir commented 5 days ago

Maybe we can use https://github.com/smjonas/inc-rename.nvim to do rename. I prefer this style and has used it for my own config.