You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
References CodeLens provider does not show indicators in Untitled files #507
Thanks man! This is because we're checking the file extension to see if it ends with .tests.ps1 before returning symbols, but maybe we should support authoring in untitled files too.
However, now that I think about it, you can't run a Pester test without it being saved to a file... This does actually affect the References CodeLens provider though, so I'll make a fix for that.
changed the title [-]Pester CodeLens does not show indicators for and Untitled file[/-][+]References CodeLens provider does not show indicators in Untitled files[/+]on Jun 10, 2017
@tylerl0706 This if statement needs to support untitled tabs that contain PowerShell. The main difficulty would be determining that it's definitely PowerShell. Trying to run that on untitled tabs with different languages could cause some nasty unexpected issues.
Code lens appears after #1098. Command references in untitled documents (with PowerShell language set) are counted since #1917 (included in vscode-powershell v2022.9.0)
Pester code lens (Run/Debug Tests) still require *.tests.ps1 saved files and that should continue imo. to avoid accidently passing this ps1-file to Invoke-Pester just because it mentions Describe/Context/It in a internal scriptblock:
$c=New-PesterConfiguration$containers= (New-PesterContainer-Data @{ abc='def' } -ScriptBlock {
Describe 'd1' {
Context '123' {
It 'a'-Tag 'a.d' { 1| should -be 1 }
It 'b'-Tag 'a.d' { 1| should -be 1 } -Skip
}
}
})
$c.Run.Container=$containers$r=Invoke-Pester-Configuration $c
Activity
daviwil commentedon Jun 10, 2017
Thanks man! This is because we're checking the file extension to see if it ends with .tests.ps1 before returning symbols, but maybe we should support authoring in untitled files too.
However, now that I think about it, you can't run a Pester test without it being saved to a file... This does actually affect the References CodeLens provider though, so I'll make a fix for that.
[-]Pester CodeLens does not show indicators for and Untitled file[/-][+]References CodeLens provider does not show indicators in Untitled files[/+]dfinke commentedon Jun 10, 2017
You can F5 the file before saving and it runs the tests.
TylerLeonhardt commentedon Jan 10, 2018
David Wilson (@daviwil) do you think you could elaborate on how it affects the References CodeLens provider?
SeeminglyScience commentedon Jan 11, 2018
@tylerl0706 This if statement needs to support untitled tabs that contain PowerShell. The main difficulty would be determining that it's definitely PowerShell. Trying to run that on untitled tabs with different languages could cause some nasty unexpected issues.
Add CodeLens support for function and cmdlet references
fflaten commentedon Feb 7, 2023
Status: Ready to close?
Code lens appears after #1098. Command references in untitled documents (with PowerShell language set) are counted since #1917 (included in vscode-powershell v2022.9.0)
Pester code lens (
Run/Debug Tests) still require*.tests.ps1saved files and that should continue imo. to avoid accidently passing this ps1-file toInvoke-Pesterjust because it mentionsDescribe/Context/Itin a internal scriptblock:andyleejordan commentedon Jun 15, 2026
Resolved by #1839 (v3.4.4) — CodeLens now works in untitled files. Closing as completed.
Drafted by GitHub Copilot (Claude Opus 4.8) at Andy Jordan (@andyleejordan)'s request.