Skip to content

Commit

Permalink
Return the start line number for Describe block (#873)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
rkeithhill authored Mar 5, 2019
1 parent 1a86d4b commit 5a6299e
Showing 1 changed file with 12 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,7 @@ public PesterCodeLensProvider(EditorSession editorSession)
/// <param name="pesterSymbol">The Pester symbol to get CodeLenses for.</param>
/// <param name="scriptFile">The script file the Pester symbol comes from.</param>
/// <returns>All CodeLenses for the given Pester symbol.</returns>
private CodeLens[] GetPesterLens(
PesterSymbolReference pesterSymbol,
ScriptFile scriptFile)
private CodeLens[] GetPesterLens(PesterSymbolReference pesterSymbol, ScriptFile scriptFile)
{
var codeLensResults = new CodeLens[]
{
Expand All @@ -54,7 +52,11 @@ private CodeLens[] GetPesterLens(
new ClientCommand(
"PowerShell.RunPesterTests",
"Run tests",
new object[] { scriptFile.ClientFilePath, false /* No debug */, pesterSymbol.TestName })),
new object[] {
scriptFile.ClientFilePath,
false /* No debug */,
pesterSymbol.TestName,
pesterSymbol.ScriptRegion?.StartLineNumber })),

new CodeLens(
this,
Expand All @@ -63,7 +65,11 @@ private CodeLens[] GetPesterLens(
new ClientCommand(
"PowerShell.RunPesterTests",
"Debug tests",
new object[] { scriptFile.ClientFilePath, true /* Run in debugger */, pesterSymbol.TestName })),
new object[] {
scriptFile.ClientFilePath,
true /* Run in the debugger */,
pesterSymbol.TestName,
pesterSymbol.ScriptRegion?.StartLineNumber })),
};

return codeLensResults;
Expand Down Expand Up @@ -99,9 +105,7 @@ public CodeLens[] ProvideCodeLenses(ScriptFile scriptFile)
/// <param name="codeLens">The code lens to resolve.</param>
/// <param name="cancellationToken"></param>
/// <returns>The given CodeLens, wrapped in a task.</returns>
public Task<CodeLens> ResolveCodeLensAsync(
CodeLens codeLens,
CancellationToken cancellationToken)
public Task<CodeLens> ResolveCodeLensAsync(CodeLens codeLens, CancellationToken cancellationToken)
{
// This provider has no specific behavior for
// resolving CodeLenses.
Expand Down

0 comments on commit 5a6299e

Please sign in to comment.