PowerShellEditorServices icon indicating copy to clipboard operation
PowerShellEditorServices copied to clipboard

Account for function and variable scope in language service features

Open kaylaerdmann opened this issue 10 years ago • 2 comments

For the following intellisense features the entire file (or multiple files if dot sourced) is/are being searched through for variable and parameters:

  • Get definition
  • Get references
  • Get occurrences

We need fix this to use the correct scope when searching on variables and parameters.

kaylaerdmann avatar Aug 12 '15 21:08 kaylaerdmann

This requires similar logic to #28 so potentially both could be developed at the same time.

daviwil avatar Nov 09 '15 01:11 daviwil

Adding an example of this:

function myDemo ($o) {
    $o = "second"
}

$o = "first"
$o # Go to definition here will go to first match -> reassignment on line 2

Update: Preview extension v2023.2.0 includes change from #1984 which now shows all definitions. Good enough? Matching scope is hard, so not sure if/when that will be fixed.

fflaten avatar Jan 15 '23 15:01 fflaten