Skip to content

Commit c5aae6b

Browse files
rkeithhillTylerLeonhardt
authored andcommitted
Return the start line number for Describe block (PowerShell#873)
* Return the start line number for Describe block Supports PR 1776 in vscode-powershell * Null check pesterSymbol.ScriptRegion * Update comment to cause new build to kick off * Whitespace change to kick off a new build
1 parent 3023a8b commit c5aae6b

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

src/PowerShellEditorServices.Host/CodeLens/PesterCodeLensProvider.cs

+12-8
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,7 @@ public PesterCodeLensProvider(EditorSession editorSession)
4141
/// <param name="pesterSymbol">The Pester symbol to get CodeLenses for.</param>
4242
/// <param name="scriptFile">The script file the Pester symbol comes from.</param>
4343
/// <returns>All CodeLenses for the given Pester symbol.</returns>
44-
private CodeLens[] GetPesterLens(
45-
PesterSymbolReference pesterSymbol,
46-
ScriptFile scriptFile)
44+
private CodeLens[] GetPesterLens(PesterSymbolReference pesterSymbol, ScriptFile scriptFile)
4745
{
4846
var codeLensResults = new CodeLens[]
4947
{
@@ -54,7 +52,11 @@ private CodeLens[] GetPesterLens(
5452
new ClientCommand(
5553
"PowerShell.RunPesterTests",
5654
"Run tests",
57-
new object[] { scriptFile.ClientFilePath, false /* No debug */, pesterSymbol.TestName })),
55+
new object[] {
56+
scriptFile.ClientFilePath,
57+
false /* No debug */,
58+
pesterSymbol.TestName,
59+
pesterSymbol.ScriptRegion?.StartLineNumber })),
5860

5961
new CodeLens(
6062
this,
@@ -63,7 +65,11 @@ private CodeLens[] GetPesterLens(
6365
new ClientCommand(
6466
"PowerShell.RunPesterTests",
6567
"Debug tests",
66-
new object[] { scriptFile.ClientFilePath, true /* Run in debugger */, pesterSymbol.TestName })),
68+
new object[] {
69+
scriptFile.ClientFilePath,
70+
true /* Run in the debugger */,
71+
pesterSymbol.TestName,
72+
pesterSymbol.ScriptRegion?.StartLineNumber })),
6773
};
6874

6975
return codeLensResults;
@@ -99,9 +105,7 @@ public CodeLens[] ProvideCodeLenses(ScriptFile scriptFile)
99105
/// <param name="codeLens">The code lens to resolve.</param>
100106
/// <param name="cancellationToken"></param>
101107
/// <returns>The given CodeLens, wrapped in a task.</returns>
102-
public Task<CodeLens> ResolveCodeLensAsync(
103-
CodeLens codeLens,
104-
CancellationToken cancellationToken)
108+
public Task<CodeLens> ResolveCodeLensAsync(CodeLens codeLens, CancellationToken cancellationToken)
105109
{
106110
// This provider has no specific behavior for
107111
// resolving CodeLenses.

0 commit comments

Comments
 (0)