Skip to content

Account for function and variable scope in language service features #16

Description

@kaylaerdmann

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.

Activity

  1. daviwil commented on Nov 9, 2015

    @daviwil
    Contributor

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

  2. modified the milestones: 0.3.0, on Dec 31, 2015
  3. changed the title [-]Use correct scope on variables and parameters for intellisense features[/-] [+]Consider variable scope for language intelligence features[/+] on May 18, 2016
  4. changed the title [-]Consider variable scope for language intelligence features[/-] [+]Account for function and variable scope in language intelligence features[/+] on May 18, 2016
  5. changed the title [-]Account for function and variable scope in language intelligence features[/-] [+]Account for function and variable scope in language service features[/+] on May 18, 2016
  6. added a commit that references this issue on Jul 16, 2019
  7. removed this from the milestone on Aug 17, 2021
  8. fflaten commented on Jan 15, 2023

    @fflaten
    Contributor

    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.

  9. andyleejordan commented on Jun 15, 2026

    @andyleejordan
    Member

    Resolved by #1990 (v3.8.1) — language features now strip scope qualifiers (VisitorUtils.GetUnqualifiedFunctionName), so scoped function/variable names resolve correctly. Closing as completed.


    Drafted by GitHub Copilot (Claude Opus 4.8) at Andy Jordan (@andyleejordan)'s request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions