Skip to content

Commit 7925b3d

Browse files
committed
fix #1393: Always use local help to return cmdlet help text
If the user has overridden the Get-Help -Online parameter to always be true, then calls to Get-Help will always launch a new browser window to the cmdlet help. Instead, we want it to return the full cmdlet text as intended, otherwise things like intellisense and tooltips may end up opening the cmdlet help in a new browser window.
1 parent 44ea602 commit 7925b3d

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

src/PowerShellEditorServices/Services/PowerShellContext/Handlers/ShowHelpHandler.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public async Task<Unit> Handle(ShowHelpParams request, CancellationToken cancell
6262
[System.Net.ServicePointManager]::SecurityProtocol = $oldSslVersion
6363
}
6464
65-
return Microsoft.PowerShell.Core\Get-Help $CommandName -Full
65+
return Microsoft.PowerShell.Core\Get-Help $CommandName -Full -Online:$false
6666
";
6767

6868
string helpParams = request.Text;

src/PowerShellEditorServices/Services/PowerShellContext/Utilities/CommandHelpers.cs

+1
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ public static async Task<string> GetCommandSynopsisAsync(
139139
// We use .Name here instead of just passing in commandInfo because
140140
// CommandInfo.ToString() duplicates the Prefix if one exists.
141141
.AddParameter("Name", commandInfo.Name)
142+
.AddParameter("Online", false)
142143
.AddParameter("ErrorAction", "Ignore");
143144

144145
var results = await powerShellContext.ExecuteCommandAsync<PSObject>(command, sendOutputToHost: false, sendErrorToHost: false).ConfigureAwait(false);

0 commit comments

Comments
 (0)