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

local variables in outline: fix bug on display under function; introduce hiding in list above functions #243

Open
sebalis opened this issue Jul 22, 2021 · 2 comments
Assignees
Labels

Comments

@sebalis
Copy link

sebalis commented Jul 22, 2021

Hi, there seems to be an inconsistency in the way local variables are handled in the outline window, here is an example:

#!/bin/bash

f_a() {
  local v_a
  v_a="_"
  echo $v_a
}

f_b() {
  local v_b=""
  v_b="."
}

v_global=1

v_exported=2
export v_exported

If this file is opened in Eclipse with Bash Editor, the Outline window shows all variables first, and function_b has an expandable sublist containing var_b. But function_a does not have a corresponding sublist. That seems like a bug to me, unless I’ve overlooked something?

I also have a request: It should be possible to make the list of above the list of functions show only global variables – if not by default, then through an option. Maybe different icons could also be used to distinguish local from global variables. And I wonder if exported variables should be treated differently again, although I realise that variables can have a “double life” starting out as local or global variables and then being exported later.

Thank you for your work.

@sebalis
Copy link
Author

sebalis commented Jul 22, 2021

(I also realise that a local variable can start out as non-local, but that is not the reason for Bash Editor to treat it differently. If I change function_b to

f_b() {
  v_b="-"
  local v_b=""
  v_b="."
}

then v_b changes from being global to local; callers to f_b will see v_b set to the first value ("-") after f_b is run. But Bash Editor still shows v_b in the sublist of f_b as if it were a “true” local.)

@de-jcup
Copy link
Owner

de-jcup commented Dec 30, 2021

Thanx for reporting the bug.

When I try your example I got following output inside IDE:
image

Yes. The local variables are not handled correctly here. Must be fixed.

@de-jcup de-jcup added the bug label Dec 30, 2021
@de-jcup de-jcup self-assigned this Dec 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants