ruff
209ea065 - Implement goto-definition and find-references for global/nonlocal statements (#21616)

Commit
15 days ago
Implement goto-definition and find-references for global/nonlocal statements (#21616) ## Summary The implementation here is to just record the idents of these statements in `scopes_by_expression` (which already supported idents but only ones that happened to appear in expressions), so that `definitions_for_name` Just Works. goto-type (and therefore hover) notably does not work on these statements because the typechecker does not record info for them. I am tempted to just introduce `type_for_name` which runs `definitions_for_name` to find other expressions and queries the inferred type... but that's a bit whack because it won't be the computed type at the right point in the code. It probably wouldn't be particularly expensive to just compute/record the type at those nodes, as if they were a load, because global/nonlocal is so scarce? ## Test Plan Snapshot tests added/re-enabled.
Author
Parents
Loading