Skip to content

CodeLens References not working if function is in another file #2421

Closed
PowerShell/PowerShellEditorServices
#1161
@mrboring

Description

@mrboring

System Details

System Details Output

### VSCode version: 1.41.1 26076a4de974ead31f97692a0d32f90d735645c0 x64

### VSCode extensions:
alefragnani.Bookmarks@10.6.0
eamodio.gitlens@10.2.0
Ionide.Ionide-FAKE@1.2.3
Ionide.Ionide-fsharp@4.4.4
Ionide.Ionide-Paket@1.12.0
ms-vscode.csharp@1.21.9
ms-vscode.powershell@2020.1.0        
ms-vscode.powershell-preview@2020.1.0
streetsidesoftware.code-spell-checker@1.7.20


### PSES version: 2.0.0.0

### PowerShell version:

Name                           Value
----                           -----
PSVersion                      7.0.0-rc.1
PSEdition                      Core
GitCommitId                    7.0.0-rc.1
OS                             Microsoft Windows 10.0.18363
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}       
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Issue Description

CodeLens References does not work if the function is in another file. Both files shown below are in the same folder.

image

Note the 1 reference above the Y function definition. This is in the same file as the reference.
Note the 0 reference above the X function definition. This is in a different file to the referenc.

I wonder if this is related to: CodeLens References link only jumps to definition #2374.

Expected Behaviour

In TestModule.psm1 I expected to see 1 references above the X function definition.

Actual Behaviour

In TestModule.psm1 I see 0 references above the X function definition

Also Find All References for function X shows:

image

Find All References for function Y shows:

image

Attached Logs

PowerShell Extension Logs.txt
PowerShell Editor Services Log.txt

Activity

ghost added
Needs: TriageMaintainer attention needed!
on Jan 16, 2020
TylerLeonhardt

TylerLeonhardt commented on Jan 16, 2020

@TylerLeonhardt
Member

Nice find! I've fixed this and it will be available in the next version.

PrzemyslawKlys

PrzemyslawKlys commented on Jan 17, 2020

@PrzemyslawKlys
Contributor

Does this change cover the whole workspace? I have modules separated within multiple layers of folders and just got the same issue but with a bit diffferent thing.

It shows 0 references

image

Find References shows only 1 find in 1 file (the file the function is defined in) but clearly I have it in other files.

image

mrboring

mrboring commented on Jan 17, 2020

@mrboring
Author

@TylerLeonhardt I'm also having problems with Go to Definition. I wonder if it could be related. If it's not, let me know and I'll create another issue.

Go to Definition not working.zip

In the attached zip there is a small test project.

Expected behaviour

Go to Definition should work for all functions.

Actual behaviour

PowerShell-Preview-2019.12.0.vsix

Go to Definition works for all functions.

PowerShell-Preview-2020.1.0.vsix

Go to Definition does work for:

  • Test-FunctionLocal
  • Test-FunctionAnotherDifferentFolder

Go to Definition does not work for:

  • Test-FunctionDifferentFolder
TylerLeonhardt

TylerLeonhardt commented on Jan 21, 2020

@TylerLeonhardt
Member

Would you like to give it a try and see if it works for you?
PowerShell-insiders.vsix.zip

@PrzemyslawKlys, this also includes PowerShell/PowerShellEditorServices#1162 so I'm curious how the PSIC looks for you.

Let me know if you have trouble installing. This is an unsigned build and has 0 official support so keep that in mind.

PrzemyslawKlys

PrzemyslawKlys commented on Jan 21, 2020

@PrzemyslawKlys
Contributor

Installing :-)

PrzemyslawKlys

PrzemyslawKlys commented on Jan 21, 2020

@PrzemyslawKlys
Contributor

image

Won't run :)

mrboring

mrboring commented on Jan 21, 2020

@mrboring
Author

@TylerLeonhardt I've installed the new VSIX and done a quick test. Both references and Go to Definition are working.

PrzemyslawKlys

PrzemyslawKlys commented on Jan 21, 2020

@PrzemyslawKlys
Contributor

That's so weird that it works for you 👱‍♂️

23 remaining items

Loading
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

      Participants

      @TylerLeonhardt@mrboring@PrzemyslawKlys@SydneyhSmith

      Issue actions

        CodeLens References not working if function is in another file · Issue #2421 · PowerShell/vscode-powershell