bash-language-server icon indicating copy to clipboard operation
bash-language-server copied to clipboard

Renaming variable changes all instances except on `readarray`

Open LeonardoMor opened this issue 5 months ago • 1 comments

Code editor

Neovim

Platform

macOS Sequoia 15.5

Version

5.6.0

What steps will reproduce the bug?

Take this function:

tmpl::add() {
    [[ $1 && $2 ]] || {
        die e "add: source or targets is an empty string"
        help >&2
        exit 1
    }
    local tmplstr targets=()
    $EDITOR "$PREFIX/$1"
    readarray -td: targets <<<"$2"
    tmplstr="{{ template \"${PREFIX#*.chezmoitemplates/}/$1\" . }}"
    for f in "${targets[@]}"; do
        echo "$tmplstr" >"$f"
    done
}

How often does it reproduce? Is there a required condition?

Always.

What is the expected behavior?

All instances all the variable should be renamed.

What do you see instead?

With the cursor over any instance of targets except for the one on readarray, if you rename it, all instances are renamed correctly, except for the one on readarray.

If the cursor is over the targets on readarray and you try to rename it, you'd be told that there's nothing to rename.

Additional information

This might be somewhat similar to #1183

LeonardoMor avatar Jul 04 '25 23:07 LeonardoMor