Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,7 @@ public async Task<bool> TryStartAsync(HostStartOptions startOptions, Cancellatio
{
_logger.LogDebug("Enabling Terminal Shell Integration...");
_shellIntegrationEnabled = true;
string sourceMethod = startOptions.ShellIntegrationScript.EndsWith(".ps1") ? "." : "Import-Module";
// TODO: Make the __psEditorServices prefix shared (it's used elsewhere too).
string setupShellIntegration = $$"""
# Setup Terminal Shell Integration.
Expand All @@ -327,7 +328,7 @@ public async Task<bool> TryStartAsync(HostStartOptions startOptions, Cancellatio
function global:PSConsoleHostReadLine { $global:__psEditorServices_userInput }

# Execute the provided shell integration script.
try { . '{{startOptions.ShellIntegrationScript}}' } catch {}
try { {{sourceMethod}} '{{startOptions.ShellIntegrationScript}}' } catch {}
""";
await EnableShellIntegrationAsync(setupShellIntegration, cancellationToken).ConfigureAwait(false);
_logger.LogDebug("Shell integration enabled!");
Expand Down