From 485ad950c4b7805f76e61be1dfdda7823f1546a9 Mon Sep 17 00:00:00 2001 From: Keith Hill Date: Sat, 18 Apr 2020 17:10:47 -0600 Subject: [PATCH 1/5] Display preview status and version info in the PSIC startup banner --- src/session.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/session.ts b/src/session.ts index 9251d298f2..fb89d0269b 100644 --- a/src/session.ts +++ b/src/session.ts @@ -191,6 +191,18 @@ export class SessionManager implements Middleware { if (this.sessionSettings.integratedConsole.suppressStartupBanner) { this.editorServicesArgs += "-StartupBanner '' "; + } else { + const packageJSON: any = require("../../package.json"); + const previewStr = (packageJSON.name.toLowerCase() === "powershell-preview") ? "Preview " : ""; + const version = packageJSON.version; + + const startupBanner = ` + + =====> PowerShell ${previewStr}Integrated Console v${version} <===== + + `; + + this.editorServicesArgs += `-StartupBanner "${startupBanner}" `; } if (this.sessionSettings.developer.editorServicesWaitForDebugger) { From 8014d52d3566caebf52bb8c98e46d84e10ff54fc Mon Sep 17 00:00:00 2001 From: Keith Hill Date: Sat, 18 Apr 2020 17:19:49 -0600 Subject: [PATCH 2/5] Use the existing this.HostVersion for version info --- src/session.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/session.ts b/src/session.ts index fb89d0269b..977dba13e7 100644 --- a/src/session.ts +++ b/src/session.ts @@ -194,11 +194,10 @@ export class SessionManager implements Middleware { } else { const packageJSON: any = require("../../package.json"); const previewStr = (packageJSON.name.toLowerCase() === "powershell-preview") ? "Preview " : ""; - const version = packageJSON.version; const startupBanner = ` - =====> PowerShell ${previewStr}Integrated Console v${version} <===== + =====> PowerShell ${previewStr}Integrated Console v${this.HostVersion} <===== `; From 52d5d17e972b26fe87ff95dd223fdeae9abfad2b Mon Sep 17 00:00:00 2001 From: Keith Hill Date: Sat, 18 Apr 2020 19:57:09 -0600 Subject: [PATCH 3/5] Pass in displayName to SessionMgr, adjust banner whitespace --- src/main.ts | 1 + src/session.ts | 16 ++++++---------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/src/main.ts b/src/main.ts index 02a152f5ef..fc2272f16d 100644 --- a/src/main.ts +++ b/src/main.ts @@ -136,6 +136,7 @@ export function activate(context: vscode.ExtensionContext): void { requiredEditorServicesVersion, logger, documentSelector, + PackageJSON.displayName, PackageJSON.version, telemetryReporter); diff --git a/src/session.ts b/src/session.ts index 977dba13e7..91c5646d04 100644 --- a/src/session.ts +++ b/src/session.ts @@ -4,6 +4,7 @@ import fs = require("fs"); import net = require("net"); +import * as os from "os"; import path = require("path"); import * as semver from "semver"; import vscode = require("vscode"); @@ -35,6 +36,7 @@ export enum SessionStatus { } export class SessionManager implements Middleware { + public HostName: string; public HostVersion: string; public PowerShellExeDetails: IPowerShellExeDetails; private ShowSessionMenuCommandName = "PowerShell.ShowSessionMenu"; @@ -68,11 +70,13 @@ export class SessionManager implements Middleware { private requiredEditorServicesVersion: string, private log: Logger, private documentSelector: DocumentSelector, + private hostName: string, private version: string, private reporter: TelemetryReporter) { this.platformDetails = getPlatformDetails(); + this.HostName = hostName; this.HostVersion = version; this.telemetryReporter = reporter; @@ -81,7 +85,7 @@ export class SessionManager implements Middleware { this.log.write( `Visual Studio Code v${vscode.version} ${procBitness}`, - `PowerShell Extension v${this.HostVersion}`, + `${this.HostName} Extension v${this.HostVersion}`, `Operating System: ${OperatingSystem[this.platformDetails.operatingSystem]} ${osBitness}`); // Fix the host version so that PowerShell can consume it. @@ -192,15 +196,7 @@ export class SessionManager implements Middleware { if (this.sessionSettings.integratedConsole.suppressStartupBanner) { this.editorServicesArgs += "-StartupBanner '' "; } else { - const packageJSON: any = require("../../package.json"); - const previewStr = (packageJSON.name.toLowerCase() === "powershell-preview") ? "Preview " : ""; - - const startupBanner = ` - - =====> PowerShell ${previewStr}Integrated Console v${this.HostVersion} <===== - - `; - + const startupBanner = `=====> ${this.HostName} Integrated Console v${this.HostVersion} <=====${os.EOL}`; this.editorServicesArgs += `-StartupBanner "${startupBanner}" `; } From 563d9a295b912c5f387541f64b239205985e0893 Mon Sep 17 00:00:00 2001 From: Keith Hill Date: Sun, 19 Apr 2020 12:53:44 -0600 Subject: [PATCH 4/5] Add some leading whitespace to startup banner --- src/session.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/session.ts b/src/session.ts index 91c5646d04..7d7f98204d 100644 --- a/src/session.ts +++ b/src/session.ts @@ -4,7 +4,6 @@ import fs = require("fs"); import net = require("net"); -import * as os from "os"; import path = require("path"); import * as semver from "semver"; import vscode = require("vscode"); @@ -196,7 +195,9 @@ export class SessionManager implements Middleware { if (this.sessionSettings.integratedConsole.suppressStartupBanner) { this.editorServicesArgs += "-StartupBanner '' "; } else { - const startupBanner = `=====> ${this.HostName} Integrated Console v${this.HostVersion} <=====${os.EOL}`; + const startupBanner = ` + =====> ${this.HostName} Integrated Console v${this.HostVersion} <===== +`; this.editorServicesArgs += `-StartupBanner "${startupBanner}" `; } From 6a871b773fdf3e9bd52b6de9b8b59d826e898416 Mon Sep 17 00:00:00 2001 From: Keith Hill Date: Sun, 19 Apr 2020 13:37:03 -0600 Subject: [PATCH 5/5] Go with whitespace option #5 - less is more :-) --- src/session.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/session.ts b/src/session.ts index 7d7f98204d..a65484ecc1 100644 --- a/src/session.ts +++ b/src/session.ts @@ -195,8 +195,7 @@ export class SessionManager implements Middleware { if (this.sessionSettings.integratedConsole.suppressStartupBanner) { this.editorServicesArgs += "-StartupBanner '' "; } else { - const startupBanner = ` - =====> ${this.HostName} Integrated Console v${this.HostVersion} <===== + const startupBanner = `=====> ${this.HostName} Integrated Console v${this.HostVersion} <===== `; this.editorServicesArgs += `-StartupBanner "${startupBanner}" `; }