bash-lsp / bash-language-server

A language server for Bash

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

No information available for variables defined via mapfile, readarray or read

pr3c0g opened this issue · comments

Code editor

neovim

Platform

OS X

Version

5.1.2

What steps will reproduce the bug?

#!/usr/bin/env bash

this_works() {
    files=$(find test_dir/ -type f)
    printf "%s\n" "${files[@]}"

}

this_doesnt_work() {
    mapfile -t files < <(find test_dir/ -type f)
    printf "%s\n" "${files[@]}"
}

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

No response

What is the expected behavior?

Hovering on the variable files on line 11 should show "Variable: files - defined on line 8"

What do you see instead?

Variable: files - defined on line 4

Additional information

Hi there!

It looks like variables defined via mapfile, readarray or read are not detected by bashls.
This happens either with process substitution, or just redirecting from a file.

Maybe I'm missing something and this is the expected behavior, but I couldn't find any issues or info related to this.

Thank you very much for the work you do here!