PowerShellEditorServices
PowerShellEditorServices copied to clipboard
Account for function and variable scope in language service features
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.
This requires similar logic to #28 so potentially both could be developed at the same time.
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.