Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Variable peek doesn't work if variable defined in another file. #710

Closed
bobfrankly opened this issue May 2, 2017 · 2 comments
Closed

Variable peek doesn't work if variable defined in another file. #710

bobfrankly opened this issue May 2, 2017 · 2 comments
Assignees
Milestone

Comments

@bobfrankly
Copy link
Contributor

bobfrankly commented May 2, 2017

System Details

  • OS: Windows 10
  • VS Code version: 1.11.2
  • PowerShell extension version: 0.12.2
  • Output from $PSVersionTable:
    PSVersion 5.0.10240.16384
    WSManStackVersion 3.0
    SerializationVersion 1.1.0.1
    CLRVersion 4.0.30319.42000
    BuildVersion 10.0.10240.16384
    PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
    PSRemotingProtocolVersion 2.3
Copy / paste the below commands into the PowerShell Integrated Terminal, and paste the output here

code -v       1.11.2
6eaebe3b9c70406d67c97779468c324a7a95db0e

$pseditor.EditorServicesVersion   - 0      12     1      0

code --list-extensions --show-versions
dbaeumer.vscode-eslint@1.2.8
ms-mssql.mssql@0.3.0
ms-vscode.csharp@1.9.0
ms-vscode.PowerShell@0.12.2
schneiderpat.aspnet-helper@0.6.3

$PSVersionTable
PSVersion                      5.0.10240.16384
WSManStackVersion              3.0
SerializationVersion           1.1.0.1
CLRVersion                     4.0.30319.42000
BuildVersion                   10.0.10240.16384
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion      2.3

Issue Description

I setup an example here: https://github.com/bobfrankly/Derp

Peeking a variable definition doesn't appear to behave the same as peeking function definitions, when the variable is defined in a separate file. In the example, opening 'derp.ps1' and peeking the testFunction takes you to the definition in the /Resources/filePaths.ps1. However, peeking the $filePaths variable in derp.ps1, does not find the definition in the /Resources/filePaths.ps1 file, it just finds the first usage of the variable within the same file.

Is this expected behavior?

EDITS: To clarify issue description.

@kapilmb
Copy link

kapilmb commented May 3, 2017

There are two issues here.

  • The symbol look-up feature is relatively naive, in the sense that it doesn't understand scope qualifiers. filePaths is declared $global:filePaths but when you try to find $filePaths' references, the language server looks only for instances of $filePaths in the workspace and so it cannot find $global:filePaths.
  • But if we change $global:filePaths to $filePaths, the reference look up works fine. However, the definition look up does not succeed because there seems to a bug in the way a variable definition look-up is handled.

@kapilmb
Copy link

kapilmb commented May 3, 2017

The first issue that I pointed out is already being tracked here, #393. So, I will mark this as bug to track the second issue.

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

No branches or pull requests

3 participants