bash-lsp / bash-language-server

A language server for Bash
MIT License
2.02k stars 118 forks source link

Inlay Hint Support #1173

Open Popkornium18 opened 1 week ago

Popkornium18 commented 1 week ago

What is the problem this feature will solve?

Bash function calls with lots of arguments are hard to parse

somefunction()
{
  local -r foo=$1
  local -r bar=$2
  local -r foo2=$3
  local -r bar2=$4
  # Do something useful
}

somefunction one two three four

What is the feature you are proposing to solve the problem?

Inlay Hints try to solve this problem by displaying a "virtual text" with the argument name. Here is a lua example:

grafik

With inlay hints it could be displayed in the IDE like this:

somefunction foo: one bar: two foo2: three bar2: four

This is obviously a little tougher with bash, as there is no strict function argument definition that could be parsed. Possible solutions would be parsing (and possibly establishing) a docstring format that explains the arguments, or reacting to the pattern where the first lines of the function are renaming $1 and so on.

What alternatives have you considered?

No response

EmilyGraceSeville7cf commented 1 week ago

I would rather rely on the renaming $1, $2, ... parameters because in such a way:

😄