question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

CodeLens References not working if function is in another file

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:27 (18 by maintainers)

github_iconTop GitHub Comments

3reactions
PrzemyslawKlyscommented, Jan 23, 2020

You don’t have to tell me that 😃 While I code only in PowerShell over my modules I get how hard some things are and that resources are slim. I have 40 PS modules that I manage mostly alone with some help from the community. I appreciate all the work you and your team do. I’ll keep opening bugs/feature requests to make sure everything runs great. Even my F5 debug issue is no big deal now after you taught me how to “workaround” it - since I see what is happening now.

So take your time 😃 I just wish there was a much faster process for preview between fix and release date so those small bugs like this one would go away faster than once per month. But as you explained, it’s not an automated process so until that is done I’m fine 😃 I automated my PowerShell modules building just so I don’t have to spend time doing manual releases because I release modules daily, even multiple times per day.

2reactions
mrboringcommented, Jan 23, 2020

@TylerLeonhardt With regard to Go to Definition and workspaces, I’ve tried the latest stable and test versions of the extension. Both give the following message: No definition found for '<function name>'.

Looking at the comments on the issue created by @PrzemyslawKlys, it looks like this functionality has not yet been added.

Read more comments on GitHub >

github_iconTop Results From Across the Web

CodeLens not showing references - visual studio
Go to Tools -> Options -> Text Editor -> All Languages -> CodeLens then click the "Enable CodeLens" option if it is not...
Read more >
Codelens references not updating when making code ...
Codelens references are no longer updating as I change code within a different file. The only way to get them to update seems...
Read more >
Reference not showing up above functions. Or if they do, it's ...
We can Go tools=>Options=>Text Editor=>All languages=>CodeLens to find the dialog box we need. After that, the reference can work normally. For ...
Read more >
CodeLens in Visual Studio Code - YouTube
Enable CodeLens in Visual Studio Code - Check the Property or Method References in Javascript file Using CodeLens in Visual Studio Code Blog ......
Read more >
Finding code changes and references with CodeLens
If needed, you can modify the configuration under Tools > Options > Text Editor > All Languages > CodeLens > Show Submitted Changelists...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found