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

Inlay Hint Support #1173

Open
Popkornium18 opened this issue Jul 5, 2024 · 3 comments
Open

Inlay Hint Support #1173

Popkornium18 opened this issue Jul 5, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@Popkornium18
Copy link

Popkornium18 commented Jul 5, 2024

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

@Popkornium18 Popkornium18 added the enhancement New feature or request label Jul 5, 2024
@EmilyGraceSeville7cf
Copy link
Contributor

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

  • it's possible to use these renamed parameters because they are variables actually
  • it allows writing more readable code which becomes self-documented

😄

@Bdrake317
Copy link

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

  • it's possible to use these renamed parameters because they are variables actually

  • it allows writing more readable code which becomes self-documented

😄

@Bdrake317

@Popkornium18
Copy link
Author

Since the virtual text can be anything you want, I think the most readable variant would be:

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants