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

Inner (variable) symbols not found/displayed #1465

Closed
MartinSGill opened this issue Aug 3, 2018 · 4 comments
Closed

Inner (variable) symbols not found/displayed #1465

MartinSGill opened this issue Aug 3, 2018 · 4 comments
Assignees
Labels
Area-Symbols & References Issue-Bug A bug to squash. Resolution-Fixed Will close automatically.

Comments

@MartinSGill
Copy link

MartinSGill commented Aug 3, 2018

System Details

code -v
1.25.1
1dfc5e557209371715f655691b1235b6b26a06be
x64
$pseditor.EditorServicesVersion

Major  Minor  Build  Revision
-----  -----  -----  --------
1      8      2      0
code --list-extensions --show-versions
castwide.solargraph@0.17.6
DavidAnson.vscode-markdownlint@0.19.0
dbaeumer.vscode-eslint@1.4.12
DotJoshJohnson.xml@2.3.1
dracula-theme.theme-dracula@2.12.1
EditorConfig.EditorConfig@0.12.4
eg2.tslint@1.0.34
helixquar.asciidecorator@0.2.0
HookyQR.beautify@1.3.2
igochkov.vscode-ebnf@1.0.3
jebbs.plantuml@2.8.4
ms-vscode.cpptools@0.17.7
ms-vscode.csharp@1.15.2
ms-vscode.PowerShell@1.8.2
msjsdiag.debugger-for-chrome@4.8.2
octref.vetur@0.12.5
Pendrica.chef@0.7.0
PeterJausovec.vscode-docker@0.1.0
pradiphudekar.cf-templates@0.1.1
rebornix.Ruby@0.19.0
robertohuertasm.vscode-icons@7.25.0
Shan.code-settings-sync@3.0.0
slevesque.vscode-hexdump@1.6.0
streetsidesoftware.code-spell-checker@1.6.10
sysoev.language-stylus@1.9.2
tuxtina.json2yaml@0.2.0
twxs.cmake@0.0.17
wayou.vscode-todo-highlight@1.0.4
yzhang.markdown-all-in-one@1.6.0
zhuangtongfa.Material-theme@2.15.3
 $PSVersionTable

Name                           Value
----                           -----
PSVersion                      5.1.17134.165
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.17134.165
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Issue Description

Not sure if this is vscode-powershell or PowerShellEditorServices issue, but vscode is where I noticed it.

Not all symbols are indexed for the currently loaded script file, and therefore are not available as navigation targets.

For example:

This simple script has, in my opinion, five symbols defined.

image

The outliner and the symbol search only show three symbols though:

image image

The two inner variables are not captured.

In larger scripts, and especially in module functions, this means almost every single variable is unavailable for navigation.

It would be good if these inner symbols were also available for navigation.

Attached Logs

@fflaten
Copy link
Contributor

fflaten commented Feb 7, 2023

This is implemented in the latest preview. Please give it a try and provide feedback.

Personal opinion: it feels a bit noisy, so would probably vote for hiding all variable (re-)assignments in outline/go to symbol.

@andyleejordan
Copy link
Member

You now @fflaten I just thought of a clever albeit maybe hacky way to do that. When adding a variable, if there's already one marked as a declaration in the bag of variables, just add it as a non-declaration. So there's only ever one "declaration" and it's probably the first one encountered.

@fflaten
Copy link
Contributor

fflaten commented Feb 7, 2023

When adding a variable, if there's already one marked as a declaration in the bag of variables, just add it as a non-declaration. So there's only ever one "declaration" and it's probably the first one encountered.

I believe that would make the inner assignment the definition in the example below which feels a bit weird.

Function abc {
    $myvar = 'inner'
}

$myvar = 'outer'

Maybe first assignment per parent (when that is tracked)?

(Also, just adding a reference to duplicate issue #356)

@ghost ghost closed this as completed Feb 7, 2023
@ghost
Copy link

ghost commented Feb 7, 2023

This issue has been marked as fixed. It has been automatically closed for housekeeping purposes.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Symbols & References Issue-Bug A bug to squash. Resolution-Fixed Will close automatically.
Projects
None yet
Development

No branches or pull requests

4 participants