eclipse-bash-editor icon indicating copy to clipboard operation
eclipse-bash-editor copied to clipboard

handle local variables in functions inside "mark occurrences"

Open de-jcup opened this issue 3 years ago • 0 comments

Situation

#!/bin/bash 

function startMe() {
    local data
    echo "hello world" >> $data
    
    echo "xx:$data"

}

startMe

data cannot be marked - local variables in functions are currently not recognized

Wanted

local xyz and also local xyz=... shall be recognized as local variables

These local variables shall only be marked inside the function!

Solution

  • if not already done keep "isLocal" flag inside BashVariable. So we know if its a local variable or not
  • introduce a getFunction():BashFunction method. For global variables this will return null
  • getUsages() for a local variable may only return the usages inside the function - this can be done by not iterating over the complete tokens, but only those inside the function (this information should be already available)

de-jcup avatar Jul 19 '21 06:07 de-jcup