Merged
Changes from all commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Failed to load files.
Original file line numberDiff line numberDiff 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