From ac822d60199ad5187e6e05428bb9b87acf3aef9b Mon Sep 17 00:00:00 2001 From: Corbob Date: Thu, 28 Nov 2019 21:44:08 -0800 Subject: [PATCH 01/19] Add commands to set and unset ISE Compatibility features --- package.json | 12 ++++++++ src/features/ISECompatibility.ts | 52 ++++++++++++++++++++++++++++++++ src/main.ts | 2 ++ 3 files changed, 66 insertions(+) create mode 100644 src/features/ISECompatibility.ts diff --git a/package.json b/package.json index 0d94be3db3..1afa7c9878 100644 --- a/package.json +++ b/package.json @@ -38,6 +38,8 @@ "onCommand:PowerShell.ShowSessionConsole", "onCommand:PowerShell.ShowSessionMenu", "onCommand:PowerShell.RestartSession", + "onCommand:PowerShell.SetISECompatibility", + "onCommand:PowerShell.UnsetISECompatibility", "onView:PowerShellCommands" ], "dependencies": { @@ -133,6 +135,16 @@ "title": "Expand Alias", "category": "PowerShell" }, + { + "command": "PowerShell.SetISECompatibility", + "title": "Set ISE like compatibility", + "category": "PowerShell" + }, + { + "command": "PowerShell.UnsetISECompatibility", + "title": "Unset ISE like compatibility (restore to defaults)", + "category": "PowerShell" + }, { "command": "PowerShell.RefreshCommandsExplorer", "title": "Refresh Command Explorer", diff --git a/src/features/ISECompatibility.ts b/src/features/ISECompatibility.ts new file mode 100644 index 0000000000..4c4007cdd7 --- /dev/null +++ b/src/features/ISECompatibility.ts @@ -0,0 +1,52 @@ +/*--------------------------------------------------------- + * Copyright (C) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------*/ +import * as vscode from "vscode"; +import { LanguageClient } from "vscode-languageclient"; +import { IFeature } from "../feature"; + +/** + * A feature to implement commands to make code like the ISE and reset the settings. + */ +export class ISECompatibilityFeature implements IFeature { + private iseCommand: vscode.Disposable; + private defaultCommand: vscode.Disposable; + private settings = [ + {section: "workbench.activityBar", setting: "visible", value: false}, + {section: "debug", setting: "openDebug", value: "neverOpen"}, + {section: "editor", setting: "tabCompletion", value: "on"}, + {section: "powershell.integratedConsole", setting: "focusConsoleOnExecute", value: false}, + {section: "powershell.integratedConsole", setting: "showOnStartup", value: false}, + {section: "files", setting: "defaultLanguage", value: "powershell"}, + {section: "workbench", setting: "colorTheme", value: "PowerShell ISE"}, + ]; + private languageClient: LanguageClient; + + constructor() { + this.iseCommand = vscode.commands.registerCommand("PowerShell.SetISECompatibility", + () => this.SetISECompatibility()); + this.defaultCommand = vscode.commands.registerCommand("PowerShell.UnsetISECompatibility", + () => this.UnsetISECompatibility()); + } + + public dispose() { + this.iseCommand.dispose(); + this.defaultCommand.dispose(); + } + + public setLanguageClient(languageclient: LanguageClient) { + this.languageClient = languageclient; + } + + private SetISECompatibility() { + this.settings.forEach((value) => { + vscode.workspace.getConfiguration(value.section).update(value.setting, value.value, true); + }); + } + + private UnsetISECompatibility() { + this.settings.forEach((value) => { + vscode.workspace.getConfiguration(value.section).update(value.setting, undefined, true); + }); + } +} diff --git a/src/main.ts b/src/main.ts index b88886f9ca..02a152f5ef 100644 --- a/src/main.ts +++ b/src/main.ts @@ -23,6 +23,7 @@ import { FindModuleFeature } from "./features/FindModule"; import { GenerateBugReportFeature } from "./features/GenerateBugReport"; import { GetCommandsFeature } from "./features/GetCommands"; import { HelpCompletionFeature } from "./features/HelpCompletion"; +import { ISECompatibilityFeature } from "./features/ISECompatibility"; import { NewFileOrProjectFeature } from "./features/NewFileOrProject"; import { OpenInISEFeature } from "./features/OpenInISE"; import { PesterTestsFeature } from "./features/PesterTests"; @@ -146,6 +147,7 @@ export function activate(context: vscode.ExtensionContext): void { new GenerateBugReportFeature(sessionManager), new ExpandAliasFeature(logger), new GetCommandsFeature(logger), + new ISECompatibilityFeature(), new ShowHelpFeature(logger), new FindModuleFeature(), new PesterTestsFeature(sessionManager), From 50e8349bf8e942c4976dd404d07a5f97c2e04c52 Mon Sep 17 00:00:00 2001 From: Corbob Date: Fri, 29 Nov 2019 21:36:15 -0800 Subject: [PATCH 02/19] Rename to Enable/Disable ISE Mode. Some formatting changes due to vscode format document. Remove option to hide PSIC Check that user hasn't modified settings from ISE settings before returning them to default. --- package.json | 12 ++++++------ src/features/ISECompatibility.ts | 32 +++++++++++++++++--------------- 2 files changed, 23 insertions(+), 21 deletions(-) diff --git a/package.json b/package.json index 1afa7c9878..ce5d9694c0 100644 --- a/package.json +++ b/package.json @@ -38,8 +38,8 @@ "onCommand:PowerShell.ShowSessionConsole", "onCommand:PowerShell.ShowSessionMenu", "onCommand:PowerShell.RestartSession", - "onCommand:PowerShell.SetISECompatibility", - "onCommand:PowerShell.UnsetISECompatibility", + "onCommand:PowerShell.EnableISEMode", + "onCommand:PowerShell.DisableISEMode", "onView:PowerShellCommands" ], "dependencies": { @@ -136,13 +136,13 @@ "category": "PowerShell" }, { - "command": "PowerShell.SetISECompatibility", - "title": "Set ISE like compatibility", + "command": "PowerShell.EnableISEMode", + "title": "Enable ISE Mode", "category": "PowerShell" }, { - "command": "PowerShell.UnsetISECompatibility", - "title": "Unset ISE like compatibility (restore to defaults)", + "command": "PowerShell.DisableISEMode", + "title": "Disable ISE Mode (restore to defaults)", "category": "PowerShell" }, { diff --git a/src/features/ISECompatibility.ts b/src/features/ISECompatibility.ts index 4c4007cdd7..61c52b79ed 100644 --- a/src/features/ISECompatibility.ts +++ b/src/features/ISECompatibility.ts @@ -12,21 +12,20 @@ export class ISECompatibilityFeature implements IFeature { private iseCommand: vscode.Disposable; private defaultCommand: vscode.Disposable; private settings = [ - {section: "workbench.activityBar", setting: "visible", value: false}, - {section: "debug", setting: "openDebug", value: "neverOpen"}, - {section: "editor", setting: "tabCompletion", value: "on"}, - {section: "powershell.integratedConsole", setting: "focusConsoleOnExecute", value: false}, - {section: "powershell.integratedConsole", setting: "showOnStartup", value: false}, - {section: "files", setting: "defaultLanguage", value: "powershell"}, - {section: "workbench", setting: "colorTheme", value: "PowerShell ISE"}, + { section: "workbench.activityBar", setting: "visible", value: false }, + { section: "debug", setting: "openDebug", value: "neverOpen" }, + { section: "editor", setting: "tabCompletion", value: "on" }, + { section: "powershell.integratedConsole", setting: "focusConsoleOnExecute", value: false }, + { section: "files", setting: "defaultLanguage", value: "powershell" }, + { section: "workbench", setting: "colorTheme", value: "PowerShell ISE" }, ]; private languageClient: LanguageClient; constructor() { - this.iseCommand = vscode.commands.registerCommand("PowerShell.SetISECompatibility", - () => this.SetISECompatibility()); - this.defaultCommand = vscode.commands.registerCommand("PowerShell.UnsetISECompatibility", - () => this.UnsetISECompatibility()); + this.iseCommand = vscode.commands.registerCommand("PowerShell.EnableISEMode", + () => this.EnableISEMode()); + this.defaultCommand = vscode.commands.registerCommand("PowerShell.DisableISEMode", + () => this.DisableISEMode()); } public dispose() { @@ -38,15 +37,18 @@ export class ISECompatibilityFeature implements IFeature { this.languageClient = languageclient; } - private SetISECompatibility() { + private EnableISEMode() { this.settings.forEach((value) => { vscode.workspace.getConfiguration(value.section).update(value.setting, value.value, true); }); } - private UnsetISECompatibility() { + private DisableISEMode() { this.settings.forEach((value) => { - vscode.workspace.getConfiguration(value.section).update(value.setting, undefined, true); + const currently = vscode.workspace.getConfiguration(value.section).get(value.setting); + if (currently === value.value) { + vscode.workspace.getConfiguration(value.section).update(value.setting, undefined, true); + } }); - } + } } From 162241a64cc8b0dd29504933c1858a7609d22b02 Mon Sep 17 00:00:00 2001 From: Corbob Date: Wed, 4 Dec 2019 21:47:59 -0800 Subject: [PATCH 03/19] use async await --- src/features/ISECompatibility.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/features/ISECompatibility.ts b/src/features/ISECompatibility.ts index 61c52b79ed..0ae1b6c26e 100644 --- a/src/features/ISECompatibility.ts +++ b/src/features/ISECompatibility.ts @@ -38,16 +38,16 @@ export class ISECompatibilityFeature implements IFeature { } private EnableISEMode() { - this.settings.forEach((value) => { - vscode.workspace.getConfiguration(value.section).update(value.setting, value.value, true); + this.settings.forEach(async (value) => { + await vscode.workspace.getConfiguration(value.section).update(value.setting, value.value, true); }); } private DisableISEMode() { - this.settings.forEach((value) => { + this.settings.forEach(async (value) => { const currently = vscode.workspace.getConfiguration(value.section).get(value.setting); if (currently === value.value) { - vscode.workspace.getConfiguration(value.section).update(value.setting, undefined, true); + await vscode.workspace.getConfiguration(value.section).update(value.setting, undefined, true); } }); } From 9d48cdf1c7b983487433a92d26801813bce1b23b Mon Sep 17 00:00:00 2001 From: Corbob Date: Mon, 9 Dec 2019 21:11:27 -0800 Subject: [PATCH 04/19] Update Variable Names. Add interface for settings. --- src/features/ISECompatibility.ts | 44 ++++++++++++++++++-------------- 1 file changed, 25 insertions(+), 19 deletions(-) diff --git a/src/features/ISECompatibility.ts b/src/features/ISECompatibility.ts index 0ae1b6c26e..39c96c3f50 100644 --- a/src/features/ISECompatibility.ts +++ b/src/features/ISECompatibility.ts @@ -5,32 +5,38 @@ import * as vscode from "vscode"; import { LanguageClient } from "vscode-languageclient"; import { IFeature } from "../feature"; +interface ISetting { + path: string; + name: string; + value: string|boolean; +} + /** * A feature to implement commands to make code like the ISE and reset the settings. */ export class ISECompatibilityFeature implements IFeature { - private iseCommand: vscode.Disposable; - private defaultCommand: vscode.Disposable; - private settings = [ - { section: "workbench.activityBar", setting: "visible", value: false }, - { section: "debug", setting: "openDebug", value: "neverOpen" }, - { section: "editor", setting: "tabCompletion", value: "on" }, - { section: "powershell.integratedConsole", setting: "focusConsoleOnExecute", value: false }, - { section: "files", setting: "defaultLanguage", value: "powershell" }, - { section: "workbench", setting: "colorTheme", value: "PowerShell ISE" }, + private iseCommandRegistration: vscode.Disposable; + private defaultCommandRegistration: vscode.Disposable; + private settings: ISetting[] = [ + { path: "workbench.activityBar", name: "visible", value: false }, + { path: "debug", name: "openDebug", value: "neverOpen" }, + { path: "editor", name: "tabCompletion", value: "on" }, + { path: "powershell.integratedConsole", name: "focusConsoleOnExecute", value: false }, + { path: "files", name: "defaultLanguage", value: "powershell" }, + { path: "workbench", name: "colorTheme", value: "PowerShell ISE" }, ]; private languageClient: LanguageClient; constructor() { - this.iseCommand = vscode.commands.registerCommand("PowerShell.EnableISEMode", + this.iseCommandRegistration = vscode.commands.registerCommand("PowerShell.EnableISEMode", () => this.EnableISEMode()); - this.defaultCommand = vscode.commands.registerCommand("PowerShell.DisableISEMode", + this.defaultCommandRegistration = vscode.commands.registerCommand("PowerShell.DisableISEMode", () => this.DisableISEMode()); } public dispose() { - this.iseCommand.dispose(); - this.defaultCommand.dispose(); + this.iseCommandRegistration.dispose(); + this.defaultCommandRegistration.dispose(); } public setLanguageClient(languageclient: LanguageClient) { @@ -38,16 +44,16 @@ export class ISECompatibilityFeature implements IFeature { } private EnableISEMode() { - this.settings.forEach(async (value) => { - await vscode.workspace.getConfiguration(value.section).update(value.setting, value.value, true); + this.settings.forEach(async (iseSetting) => { + await vscode.workspace.getConfiguration(iseSetting.path).update(iseSetting.name, iseSetting.value, true); }); } private DisableISEMode() { - this.settings.forEach(async (value) => { - const currently = vscode.workspace.getConfiguration(value.section).get(value.setting); - if (currently === value.value) { - await vscode.workspace.getConfiguration(value.section).update(value.setting, undefined, true); + this.settings.forEach(async (iseSetting) => { + const currently = vscode.workspace.getConfiguration(iseSetting.path).get(iseSetting.name); + if (currently === iseSetting.value) { + await vscode.workspace.getConfiguration(iseSetting.path).update(iseSetting.name, undefined, true); } }); } From c7062eb1a0b976127de4f38f9d6b49d543e84ed8 Mon Sep 17 00:00:00 2001 From: Corbob Date: Wed, 11 Dec 2019 20:17:43 -0800 Subject: [PATCH 05/19] Change foreach to for. --- src/features/ISECompatibility.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/features/ISECompatibility.ts b/src/features/ISECompatibility.ts index 39c96c3f50..64efe54d15 100644 --- a/src/features/ISECompatibility.ts +++ b/src/features/ISECompatibility.ts @@ -8,7 +8,7 @@ import { IFeature } from "../feature"; interface ISetting { path: string; name: string; - value: string|boolean; + value: string | boolean; } /** @@ -43,18 +43,18 @@ export class ISECompatibilityFeature implements IFeature { this.languageClient = languageclient; } - private EnableISEMode() { - this.settings.forEach(async (iseSetting) => { + private async EnableISEMode() { + for (const iseSetting of this.settings) { await vscode.workspace.getConfiguration(iseSetting.path).update(iseSetting.name, iseSetting.value, true); - }); + } } - private DisableISEMode() { - this.settings.forEach(async (iseSetting) => { + private async DisableISEMode() { + for (const iseSetting of this.settings) { const currently = vscode.workspace.getConfiguration(iseSetting.path).get(iseSetting.name); if (currently === iseSetting.value) { await vscode.workspace.getConfiguration(iseSetting.path).update(iseSetting.name, undefined, true); } - }); + } } } From 9e1690359b790a63a87a45b7e1dbbf458787a792 Mon Sep 17 00:00:00 2001 From: Corbob Date: Wed, 11 Dec 2019 20:19:02 -0800 Subject: [PATCH 06/19] Allow testing on Linux. Caveat: This is sometimes inconsistent if there were compile errors. Sometimes need to run Invoke-Build Clean before Invoke-Build Test will pick up code changes. --- vscode-powershell.build.ps1 | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/vscode-powershell.build.ps1 b/vscode-powershell.build.ps1 index b5958ea059..75c0e45012 100644 --- a/vscode-powershell.build.ps1 +++ b/vscode-powershell.build.ps1 @@ -101,13 +101,8 @@ task BuildAll BuildEditorServices, Build #region Test tasks task Test Build, { - if (!$global:IsLinux) { - Write-Host "`n### Running extension tests" -ForegroundColor Green - exec { & npm run test } - } - else { - Write-Warning "Skipping extension tests on Linux platform because vscode does not support it." - } + Write-Host "`n### Running extension tests" -ForegroundColor Green + exec { & npm run test } } task TestEditorServices { From 2e5299f220d55d433afe0fede4c790d123ba7f5d Mon Sep 17 00:00:00 2001 From: Corbob Date: Wed, 11 Dec 2019 21:17:12 -0800 Subject: [PATCH 07/19] Add some tests. --- src/features/ISECompatibility.ts | 7 ++--- test/features/ISECompatibility.test.ts | 36 ++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 3 deletions(-) create mode 100644 test/features/ISECompatibility.test.ts diff --git a/src/features/ISECompatibility.ts b/src/features/ISECompatibility.ts index 64efe54d15..42589a97ae 100644 --- a/src/features/ISECompatibility.ts +++ b/src/features/ISECompatibility.ts @@ -15,9 +15,8 @@ interface ISetting { * A feature to implement commands to make code like the ISE and reset the settings. */ export class ISECompatibilityFeature implements IFeature { - private iseCommandRegistration: vscode.Disposable; - private defaultCommandRegistration: vscode.Disposable; - private settings: ISetting[] = [ + // Marking settings as public so we can use it within the tests without needing to duplicate the list of settings. + public settings: ISetting[] = [ { path: "workbench.activityBar", name: "visible", value: false }, { path: "debug", name: "openDebug", value: "neverOpen" }, { path: "editor", name: "tabCompletion", value: "on" }, @@ -25,6 +24,8 @@ export class ISECompatibilityFeature implements IFeature { { path: "files", name: "defaultLanguage", value: "powershell" }, { path: "workbench", name: "colorTheme", value: "PowerShell ISE" }, ]; + private iseCommandRegistration: vscode.Disposable; + private defaultCommandRegistration: vscode.Disposable; private languageClient: LanguageClient; constructor() { diff --git a/test/features/ISECompatibility.test.ts b/test/features/ISECompatibility.test.ts new file mode 100644 index 0000000000..90e976ae1d --- /dev/null +++ b/test/features/ISECompatibility.test.ts @@ -0,0 +1,36 @@ +/*--------------------------------------------------------- + * Copyright (C) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------*/ +import * as assert from "assert"; +import * as vscode from "vscode"; +import { ISECompatibilityFeature } from "../../src/features/ISECompatibility"; + +const ISECompatibility: ISECompatibilityFeature = new ISECompatibilityFeature(); + +suite("ISECompatibility feature", () => { + test("It sets ISE Settings", async () => { + await vscode.commands.executeCommand("PowerShell.EnableISEMode"); + for (const iseSetting of ISECompatibility.settings) { + const currently = vscode.workspace.getConfiguration(iseSetting.path).get(iseSetting.name); + assert.equal(currently, iseSetting.value); + } + }); + test("It unsets ISE Settings", async () => { + await vscode.commands.executeCommand("PowerShell.DisableISEMode"); + for (const iseSetting of ISECompatibility.settings) { + const currently = vscode.workspace.getConfiguration(iseSetting.path).get(iseSetting.name); + assert.notEqual(currently, iseSetting.value); + } + }); + test("It leaves Theme after being changed after enabling ISE Mode", async () => { + await vscode.commands.executeCommand("PowerShell.EnableISEMode"); + await vscode.workspace.getConfiguration("workbench").update("colorTheme", "Dark+", true); + await vscode.commands.executeCommand("PowerShell.DisableISEMode"); + for (const iseSetting of ISECompatibility.settings) { + const currently = vscode.workspace.getConfiguration(iseSetting.path).get(iseSetting.name); + assert.notEqual(currently, iseSetting.value); + } + assert.equal(vscode.workspace.getConfiguration("workbench").get("colorTheme"), "Dark+"); + }); +}); +ISECompatibility.dispose(); From 71c33fd4622f76567441b2fbc0fee5b644100c81 Mon Sep 17 00:00:00 2001 From: Tyler Leonhardt Date: Thu, 12 Dec 2019 11:02:38 -0800 Subject: [PATCH 08/19] change registerCommand to fix tests --- src/features/ISECompatibility.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/features/ISECompatibility.ts b/src/features/ISECompatibility.ts index 42589a97ae..36ca03474a 100644 --- a/src/features/ISECompatibility.ts +++ b/src/features/ISECompatibility.ts @@ -29,10 +29,8 @@ export class ISECompatibilityFeature implements IFeature { private languageClient: LanguageClient; constructor() { - this.iseCommandRegistration = vscode.commands.registerCommand("PowerShell.EnableISEMode", - () => this.EnableISEMode()); - this.defaultCommandRegistration = vscode.commands.registerCommand("PowerShell.DisableISEMode", - () => this.DisableISEMode()); + this.iseCommandRegistration = vscode.commands.registerCommand("PowerShell.EnableISEMode", this.EnableISEMode); + this.defaultCommandRegistration = vscode.commands.registerCommand("PowerShell.DisableISEMode", this.DisableISEMode); } public dispose() { @@ -52,7 +50,7 @@ export class ISECompatibilityFeature implements IFeature { private async DisableISEMode() { for (const iseSetting of this.settings) { - const currently = vscode.workspace.getConfiguration(iseSetting.path).get(iseSetting.name); + const currently = vscode.workspace.getConfiguration(iseSetting.path).get(iseSetting.name); if (currently === iseSetting.value) { await vscode.workspace.getConfiguration(iseSetting.path).update(iseSetting.name, undefined, true); } From a93920b1a257f41910391e0168344608dcf6c749 Mon Sep 17 00:00:00 2001 From: Tyler Leonhardt Date: Thu, 12 Dec 2019 11:27:18 -0800 Subject: [PATCH 09/19] line length --- src/features/ISECompatibility.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/features/ISECompatibility.ts b/src/features/ISECompatibility.ts index 36ca03474a..3abe586187 100644 --- a/src/features/ISECompatibility.ts +++ b/src/features/ISECompatibility.ts @@ -29,8 +29,10 @@ export class ISECompatibilityFeature implements IFeature { private languageClient: LanguageClient; constructor() { - this.iseCommandRegistration = vscode.commands.registerCommand("PowerShell.EnableISEMode", this.EnableISEMode); - this.defaultCommandRegistration = vscode.commands.registerCommand("PowerShell.DisableISEMode", this.DisableISEMode); + this.iseCommandRegistration = vscode.commands.registerCommand( + "PowerShell.EnableISEMode", this.EnableISEMode); + this.defaultCommandRegistration = vscode.commands.registerCommand( + "PowerShell.DisableISEMode", this.DisableISEMode); } public dispose() { From b8214dd59eafc7a9a322b9b9f7e111a19d155d0e Mon Sep 17 00:00:00 2001 From: Tyler Leonhardt Date: Thu, 12 Dec 2019 12:51:53 -0800 Subject: [PATCH 10/19] move to static --- src/features/ISECompatibility.ts | 6 +++--- test/features/ISECompatibility.test.ts | 9 +++------ 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/src/features/ISECompatibility.ts b/src/features/ISECompatibility.ts index 3abe586187..d681420d06 100644 --- a/src/features/ISECompatibility.ts +++ b/src/features/ISECompatibility.ts @@ -16,7 +16,7 @@ interface ISetting { */ export class ISECompatibilityFeature implements IFeature { // Marking settings as public so we can use it within the tests without needing to duplicate the list of settings. - public settings: ISetting[] = [ + public static settings: ISetting[] = [ { path: "workbench.activityBar", name: "visible", value: false }, { path: "debug", name: "openDebug", value: "neverOpen" }, { path: "editor", name: "tabCompletion", value: "on" }, @@ -45,13 +45,13 @@ export class ISECompatibilityFeature implements IFeature { } private async EnableISEMode() { - for (const iseSetting of this.settings) { + for (const iseSetting of ISECompatibilityFeature.settings) { await vscode.workspace.getConfiguration(iseSetting.path).update(iseSetting.name, iseSetting.value, true); } } private async DisableISEMode() { - for (const iseSetting of this.settings) { + for (const iseSetting of ISECompatibilityFeature.settings) { const currently = vscode.workspace.getConfiguration(iseSetting.path).get(iseSetting.name); if (currently === iseSetting.value) { await vscode.workspace.getConfiguration(iseSetting.path).update(iseSetting.name, undefined, true); diff --git a/test/features/ISECompatibility.test.ts b/test/features/ISECompatibility.test.ts index 90e976ae1d..b33d01dc66 100644 --- a/test/features/ISECompatibility.test.ts +++ b/test/features/ISECompatibility.test.ts @@ -5,19 +5,17 @@ import * as assert from "assert"; import * as vscode from "vscode"; import { ISECompatibilityFeature } from "../../src/features/ISECompatibility"; -const ISECompatibility: ISECompatibilityFeature = new ISECompatibilityFeature(); - suite("ISECompatibility feature", () => { test("It sets ISE Settings", async () => { await vscode.commands.executeCommand("PowerShell.EnableISEMode"); - for (const iseSetting of ISECompatibility.settings) { + for (const iseSetting of ISECompatibilityFeature.settings) { const currently = vscode.workspace.getConfiguration(iseSetting.path).get(iseSetting.name); assert.equal(currently, iseSetting.value); } }); test("It unsets ISE Settings", async () => { await vscode.commands.executeCommand("PowerShell.DisableISEMode"); - for (const iseSetting of ISECompatibility.settings) { + for (const iseSetting of ISECompatibilityFeature.settings) { const currently = vscode.workspace.getConfiguration(iseSetting.path).get(iseSetting.name); assert.notEqual(currently, iseSetting.value); } @@ -26,11 +24,10 @@ suite("ISECompatibility feature", () => { await vscode.commands.executeCommand("PowerShell.EnableISEMode"); await vscode.workspace.getConfiguration("workbench").update("colorTheme", "Dark+", true); await vscode.commands.executeCommand("PowerShell.DisableISEMode"); - for (const iseSetting of ISECompatibility.settings) { + for (const iseSetting of ISECompatibilityFeature.settings) { const currently = vscode.workspace.getConfiguration(iseSetting.path).get(iseSetting.name); assert.notEqual(currently, iseSetting.value); } assert.equal(vscode.workspace.getConfiguration("workbench").get("colorTheme"), "Dark+"); }); }); -ISECompatibility.dispose(); From d5156efadbff2e646d038db3511c5e5539cd2642 Mon Sep 17 00:00:00 2001 From: Tyler Leonhardt Date: Thu, 12 Dec 2019 13:39:41 -0800 Subject: [PATCH 11/19] skip tests on linux --- vscode-powershell.build.ps1 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/vscode-powershell.build.ps1 b/vscode-powershell.build.ps1 index 75c0e45012..bab5a96781 100644 --- a/vscode-powershell.build.ps1 +++ b/vscode-powershell.build.ps1 @@ -101,6 +101,10 @@ task BuildAll BuildEditorServices, Build #region Test tasks task Test Build, { + if ($env:TF_BUILD -and $global:IsLinux) { + Write-Warning "Skipping extension tests in Linux CI because vscode does not support it." + return + } Write-Host "`n### Running extension tests" -ForegroundColor Green exec { & npm run test } } From a2c0038cada5088ef9550638f01387aec438580f Mon Sep 17 00:00:00 2001 From: Tyler Leonhardt Date: Thu, 12 Dec 2019 13:55:42 -0800 Subject: [PATCH 12/19] additional checks --- test/features/ISECompatibility.test.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/features/ISECompatibility.test.ts b/test/features/ISECompatibility.test.ts index b33d01dc66..aa2e32b4a3 100644 --- a/test/features/ISECompatibility.test.ts +++ b/test/features/ISECompatibility.test.ts @@ -14,6 +14,10 @@ suite("ISECompatibility feature", () => { } }); test("It unsets ISE Settings", async () => { + // Change state to something that DisableISEMode will change + await vscode.workspace.getConfiguration("workbench").update("colorTheme", "PowerShell ISE", true); + assert.equal(vscode.workspace.getConfiguration("workbench").get("colorTheme"), "PowerShell ISE"); + await vscode.commands.executeCommand("PowerShell.DisableISEMode"); for (const iseSetting of ISECompatibilityFeature.settings) { const currently = vscode.workspace.getConfiguration(iseSetting.path).get(iseSetting.name); @@ -22,6 +26,8 @@ suite("ISECompatibility feature", () => { }); test("It leaves Theme after being changed after enabling ISE Mode", async () => { await vscode.commands.executeCommand("PowerShell.EnableISEMode"); + assert.equal(vscode.workspace.getConfiguration("workbench").get("colorTheme"), "PowerShell ISE"); + await vscode.workspace.getConfiguration("workbench").update("colorTheme", "Dark+", true); await vscode.commands.executeCommand("PowerShell.DisableISEMode"); for (const iseSetting of ISECompatibilityFeature.settings) { From f225602628a42a356a019d73cc519055be61d738 Mon Sep 17 00:00:00 2001 From: Tyler Leonhardt Date: Thu, 12 Dec 2019 14:33:34 -0800 Subject: [PATCH 13/19] move to new lib to update timeout --- package-lock.json | 481 ++++---------------------------------------- package.json | 7 +- src/debugAdapter.ts | 12 +- test/index.ts | 21 -- test/runTests.ts | 30 +++ test/testRunner.ts | 49 +++++ 6 files changed, 136 insertions(+), 464 deletions(-) delete mode 100644 test/index.ts create mode 100644 test/runTests.ts create mode 100644 test/testRunner.ts diff --git a/package-lock.json b/package-lock.json index a21e536a44..4c63845d90 100644 --- a/package-lock.json +++ b/package-lock.json @@ -76,6 +76,29 @@ "integrity": "sha512-+iTbntw2IZPb/anVDbypzfQa+ay64MW0Zo8aJ8gZPWMMK6/OubMVb6lUPMagqjOPnmtauXnFCACVl3O7ogjeqQ==", "dev": true }, + "@types/events": { + "version": "3.0.0", + "resolved": "https://botbuilder.myget.org/F/botframework-cli/npm/@types/events/-/@types/events-3.0.0.tgz", + "integrity": "sha1-KGLz9Yqaf3w+eNefEw3U1xwlwqc=", + "dev": true + }, + "@types/glob": { + "version": "7.1.1", + "resolved": "https://botbuilder.myget.org/F/botframework-cli/npm/@types/glob/-/@types/glob-7.1.1.tgz", + "integrity": "sha1-qlmhxuP7xCHgfM0xqUTDDrpSFXU=", + "dev": true, + "requires": { + "@types/events": "*", + "@types/minimatch": "*", + "@types/node": "*" + } + }, + "@types/minimatch": { + "version": "3.0.3", + "resolved": "https://botbuilder.myget.org/F/botframework-cli/npm/@types/minimatch/-/@types/minimatch-3.0.3.tgz", + "integrity": "sha1-PcoOPzOyAPx9ETnAzZbBJoyt/Z0=", + "dev": true + }, "@types/mocha": { "version": "5.2.7", "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-5.2.7.tgz", @@ -124,6 +147,12 @@ "integrity": "sha512-EZQUP3hSZQyTQRfiLqelC9NMWd1kqLcmQE0dMiklxBkgi84T+cHOhnKpgk4NnOWpGX863yE6+IaGnOXUNFqDnQ==", "dev": true }, + "@types/vscode": { + "version": "1.34.0", + "resolved": "https://botbuilder.myget.org/F/botframework-cli/npm/@types/vscode/-/@types/vscode-1.34.0.tgz", + "integrity": "sha1-Wr3YtUi+CMj+P/98PjstUy4yV0E=", + "dev": true + }, "acorn": { "version": "5.7.3", "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.7.3.tgz", @@ -149,8 +178,8 @@ }, "agent-base": { "version": "4.3.0", - "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-4.3.0.tgz", - "integrity": "sha512-salcGninV0nPrwpGNn4VTXBb1SOuXQBiqbrNXoeizJsHrsL6ERFM2Ne3JUSBWRE6aeNJI2ROP/WEEIDUiDe3cg==", + "resolved": "https://botbuilder.myget.org/F/botframework-cli/npm/agent-base/-/agent-base-4.3.0.tgz", + "integrity": "sha1-gWXwHENgCbzK0LHRIvBe13Dvxu4=", "dev": true, "requires": { "es6-promisify": "^5.0.0" @@ -218,21 +247,6 @@ "integrity": "sha1-z+nYwmYoudxa7MYqn12PHzUsEZU=", "dev": true }, - "asn1": { - "version": "0.2.4", - "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz", - "integrity": "sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==", - "dev": true, - "requires": { - "safer-buffer": "~2.1.0" - } - }, - "assert-plus": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", - "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", - "dev": true - }, "async-hook-jl": { "version": "1.7.6", "resolved": "https://registry.npmjs.org/async-hook-jl/-/async-hook-jl-1.7.6.tgz", @@ -257,24 +271,6 @@ } } }, - "asynckit": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", - "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=", - "dev": true - }, - "aws-sign2": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", - "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=", - "dev": true - }, - "aws4": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.8.0.tgz", - "integrity": "sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ==", - "dev": true - }, "azure-devops-node-api": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/azure-devops-node-api/-/azure-devops-node-api-7.2.0.tgz", @@ -340,15 +336,6 @@ "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", "dev": true }, - "bcrypt-pbkdf": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", - "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=", - "dev": true, - "requires": { - "tweetnacl": "^0.14.3" - } - }, "boolbase": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz", @@ -404,12 +391,6 @@ "integrity": "sha1-r6uWJikQp/M8GaV3WCXGnzTjUMo=", "dev": true }, - "caseless": { - "version": "0.12.0", - "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", - "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=", - "dev": true - }, "chalk": { "version": "2.4.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", @@ -517,15 +498,6 @@ "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", "dev": true }, - "combined-stream": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", - "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", - "dev": true, - "requires": { - "delayed-stream": "~1.0.0" - } - }, "commander": { "version": "2.15.1", "resolved": "https://registry.npmjs.org/commander/-/commander-2.15.1.tgz", @@ -600,15 +572,6 @@ "integrity": "sha512-a+EPoD+uZiNfh+5fxw2nO9QwFa6nJe2Or35fGY6Ipw1R3R4AGz1d1TEZrCegvw2YTmZ0jXirGYlzxxpYSHwpEg==", "dev": true }, - "dashdash": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", - "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", - "dev": true, - "requires": { - "assert-plus": "^1.0.0" - } - }, "debug": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", @@ -624,12 +587,6 @@ "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=", "dev": true }, - "delayed-stream": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", - "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=", - "dev": true - }, "denodeify": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/denodeify/-/denodeify-1.2.1.tgz", @@ -712,16 +669,6 @@ "domelementtype": "1" } }, - "ecc-jsbn": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", - "integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=", - "dev": true, - "requires": { - "jsbn": "~0.1.0", - "safer-buffer": "^2.1.0" - } - }, "emitter-listener": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/emitter-listener/-/emitter-listener-1.1.2.tgz", @@ -738,13 +685,13 @@ }, "es6-promise": { "version": "4.2.8", - "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.8.tgz", - "integrity": "sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==", + "resolved": "https://botbuilder.myget.org/F/botframework-cli/npm/es6-promise/-/es6-promise-4.2.8.tgz", + "integrity": "sha1-TrIVlMlyvEBVPSduUQU5FD21Pgo=", "dev": true }, "es6-promisify": { "version": "5.0.0", - "resolved": "https://registry.npmjs.org/es6-promisify/-/es6-promisify-5.0.0.tgz", + "resolved": "https://botbuilder.myget.org/F/botframework-cli/npm/es6-promisify/-/es6-promisify-5.0.0.tgz", "integrity": "sha1-UQnWLz5W6pZ8S2NQWu8IKRyKUgM=", "dev": true, "requires": { @@ -873,12 +820,6 @@ "integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=", "dev": true }, - "extend": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", - "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==", - "dev": true - }, "external-editor": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-2.2.0.tgz", @@ -890,12 +831,6 @@ "tmp": "^0.0.33" } }, - "extsprintf": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", - "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=", - "dev": true - }, "fast-deep-equal": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz", @@ -954,23 +889,6 @@ "write": "^0.2.1" } }, - "forever-agent": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", - "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=", - "dev": true - }, - "form-data": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz", - "integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==", - "dev": true, - "requires": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.6", - "mime-types": "^2.1.12" - } - }, "fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", @@ -983,15 +901,6 @@ "integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=", "dev": true }, - "getpass": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", - "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", - "dev": true, - "requires": { - "assert-plus": "^1.0.0" - } - }, "glob": { "version": "7.1.2", "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", @@ -1024,48 +933,6 @@ "integrity": "sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA==", "dev": true }, - "har-schema": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", - "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=", - "dev": true - }, - "har-validator": { - "version": "5.1.3", - "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.3.tgz", - "integrity": "sha512-sNvOCzEQNr/qrvJgc3UG/kD4QtlHycrzwS+6mfTrrSq97BvaYcPZZI1ZSqGSPR73Cxn4LKTD4PttRwfU7jWq5g==", - "dev": true, - "requires": { - "ajv": "^6.5.5", - "har-schema": "^2.0.0" - }, - "dependencies": { - "ajv": { - "version": "6.10.2", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.10.2.tgz", - "integrity": "sha512-TXtUUEYHuaTEbLZWIKUr5pmBuhDLy+8KYtPYdcV8qC+pOZL+NKqYwvWSRrVXHn+ZmRRAu8vJTAznH7Oag6RVRw==", - "dev": true, - "requires": { - "fast-deep-equal": "^2.0.1", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.4.1", - "uri-js": "^4.2.2" - } - }, - "fast-deep-equal": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz", - "integrity": "sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk=", - "dev": true - }, - "json-schema-traverse": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", - "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", - "dev": true - } - } - }, "has-ansi": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", @@ -1124,29 +991,18 @@ }, "http-proxy-agent": { "version": "2.1.0", - "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-2.1.0.tgz", - "integrity": "sha512-qwHbBLV7WviBl0rQsOzH6o5lwyOIvwp/BdFnvVxXORldu5TmjFfjzBcWUWS5kWAZhmv+JtiDhSuQCp4sBfbIgg==", + "resolved": "https://botbuilder.myget.org/F/botframework-cli/npm/http-proxy-agent/-/http-proxy-agent-2.1.0.tgz", + "integrity": "sha1-5IIb7vWyFCogJr1zkm/lN2McVAU=", "dev": true, "requires": { "agent-base": "4", "debug": "3.1.0" } }, - "http-signature": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", - "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", - "dev": true, - "requires": { - "assert-plus": "^1.0.0", - "jsprim": "^1.2.2", - "sshpk": "^1.7.0" - } - }, "https-proxy-agent": { "version": "2.2.4", - "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-2.2.4.tgz", - "integrity": "sha512-OmvfoQ53WLjtA9HeYP9RNrWMJzzAz1JGaSFr1nijg0PVR1JaD/xbJq1mdEIIlxGpXp9eSe/O2LgU9DJmTPd0Eg==", + "resolved": "https://botbuilder.myget.org/F/botframework-cli/npm/https-proxy-agent/-/https-proxy-agent-2.2.4.tgz", + "integrity": "sha1-TuenN6vZJniik9mzShr00NCMeHs=", "dev": true, "requires": { "agent-base": "^4.3.0", @@ -1236,12 +1092,6 @@ "integrity": "sha512-qgDYXFSR5WvEfuS5dMj6oTMEbrrSaM0CrFk2Yiq/gXnBvD9pMa2jGXxyhGLfvhZpuMZe18CJpFxAt3CRs42NMg==", "dev": true }, - "is-typedarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", - "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=", - "dev": true - }, "isarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", @@ -1254,12 +1104,6 @@ "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", "dev": true }, - "isstream": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", - "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=", - "dev": true - }, "js-tokens": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz", @@ -1276,18 +1120,6 @@ "esprima": "^4.0.0" } }, - "jsbn": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", - "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=", - "dev": true - }, - "json-schema": { - "version": "0.2.3", - "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", - "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=", - "dev": true - }, "json-schema-traverse": { "version": "0.3.1", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz", @@ -1300,24 +1132,6 @@ "integrity": "sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=", "dev": true }, - "json-stringify-safe": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", - "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=", - "dev": true - }, - "jsprim": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", - "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", - "dev": true, - "requires": { - "assert-plus": "1.0.0", - "extsprintf": "1.3.0", - "json-schema": "0.2.3", - "verror": "1.10.0" - } - }, "just-extend": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/just-extend/-/just-extend-4.0.2.tgz", @@ -1401,21 +1215,6 @@ "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==", "dev": true }, - "mime-db": { - "version": "1.40.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.40.0.tgz", - "integrity": "sha512-jYdeOMPy9vnxEqFRRo6ZvTZ8d9oPb+k18PKoYNYUe2stVEBPPwsln/qWzdbmaIvnhZ9v2P+CuecK+fpUfsV2mA==", - "dev": true - }, - "mime-types": { - "version": "2.1.24", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.24.tgz", - "integrity": "sha512-WaFHS3MCl5fapm3oLxU4eYDw77IQM2ACcxQ9RIxfaC3ooc6PFuBMGZZsYpvoXS5D5QTWPieo1jjLdAm3TBP3cQ==", - "dev": true, - "requires": { - "mime-db": "1.40.0" - } - }, "mimic-fn": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.2.0.tgz", @@ -1550,12 +1349,6 @@ "boolbase": "~1.0.0" } }, - "oauth-sign": { - "version": "0.9.0", - "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", - "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==", - "dev": true - }, "object-assign": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", @@ -1689,12 +1482,6 @@ "integrity": "sha1-elfrVQpng/kRUzH89GY9XI4AelA=", "dev": true }, - "performance-now": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", - "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=", - "dev": true - }, "pluralize": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/pluralize/-/pluralize-7.0.0.tgz", @@ -1725,30 +1512,6 @@ "integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=", "dev": true }, - "psl": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/psl/-/psl-1.3.0.tgz", - "integrity": "sha512-avHdspHO+9rQTLbv1RO+MPYeP/SzsCoxofjVnHanETfQhTJrmB0HlDoW+EiN/R+C0BZ+gERab9NY0lPN2TxNag==", - "dev": true - }, - "punycode": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", - "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", - "dev": true - }, - "qs": { - "version": "6.5.2", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", - "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==", - "dev": true - }, - "querystringify": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.1.1.tgz", - "integrity": "sha512-w7fLxIRCRT7U8Qu53jQnJyPkYZIaR4n5151KMfcJlO/A9397Wxb1amJvROTK6TOnp7PfoAmg/qXiNHI+08jRfA==", - "dev": true - }, "read": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/read/-/read-1.0.7.tgz", @@ -1779,34 +1542,6 @@ "integrity": "sha512-LOPw8FpgdQF9etWMaAfG/WRthIdXJGYp4mJ2Jgn/2lpkbod9jPn0t9UqN7AxBOKNfzRbYyVfgc7Vk4t/MpnXgw==", "dev": true }, - "request": { - "version": "2.88.0", - "resolved": "https://registry.npmjs.org/request/-/request-2.88.0.tgz", - "integrity": "sha512-NAqBSrijGLZdM0WZNsInLJpkJokL72XYjUpnB0iwsRgxh7dB6COrHnTBNwN0E+lHDAJzu7kLAkDeY08z2/A0hg==", - "dev": true, - "requires": { - "aws-sign2": "~0.7.0", - "aws4": "^1.8.0", - "caseless": "~0.12.0", - "combined-stream": "~1.0.6", - "extend": "~3.0.2", - "forever-agent": "~0.6.1", - "form-data": "~2.3.2", - "har-validator": "~5.1.0", - "http-signature": "~1.2.0", - "is-typedarray": "~1.0.0", - "isstream": "~0.1.2", - "json-stringify-safe": "~5.0.1", - "mime-types": "~2.1.19", - "oauth-sign": "~0.9.0", - "performance-now": "^2.1.0", - "qs": "~6.5.2", - "safe-buffer": "^5.1.2", - "tough-cookie": "~2.4.3", - "tunnel-agent": "^0.6.0", - "uuid": "^3.3.2" - } - }, "require-uncached": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/require-uncached/-/require-uncached-1.0.3.tgz", @@ -1817,12 +1552,6 @@ "resolve-from": "^1.0.0" } }, - "requires-port": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", - "integrity": "sha1-kl0mAdOaxIXgkc8NpcbmlNw9yv8=", - "dev": true - }, "resolve": { "version": "1.12.0", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.12.0.tgz", @@ -1984,45 +1713,12 @@ "is-fullwidth-code-point": "^2.0.0" } }, - "source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true - }, - "source-map-support": { - "version": "0.5.13", - "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.13.tgz", - "integrity": "sha512-SHSKFHadjVA5oR4PPqhtAVdcBWwRYVd6g6cAXnIbRiIwc2EhPrTuKUBdSLvlEKyIP3GCf89fltvcZiP9MMFA1w==", - "dev": true, - "requires": { - "buffer-from": "^1.0.0", - "source-map": "^0.6.0" - } - }, "sprintf-js": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", "dev": true }, - "sshpk": { - "version": "1.16.1", - "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.16.1.tgz", - "integrity": "sha512-HXXqVUq7+pcKeLqqZj6mHFUMvXtOJt1uoUx09pFW6011inTMxqI8BA8PM95myrIyyKwdnzjdFjLiE6KBPVtJIg==", - "dev": true, - "requires": { - "asn1": "~0.2.3", - "assert-plus": "^1.0.0", - "bcrypt-pbkdf": "^1.0.0", - "dashdash": "^1.12.0", - "ecc-jsbn": "~0.1.1", - "getpass": "^0.1.1", - "jsbn": "~0.1.0", - "safer-buffer": "^2.0.2", - "tweetnacl": "~0.14.0" - } - }, "stack-chain": { "version": "1.3.7", "resolved": "https://registry.npmjs.org/stack-chain/-/stack-chain-1.3.7.tgz", @@ -2106,24 +1802,6 @@ "os-tmpdir": "~1.0.2" } }, - "tough-cookie": { - "version": "2.4.3", - "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.4.3.tgz", - "integrity": "sha512-Q5srk/4vDM54WJsJio3XNn6K2sCG+CQ8G5Wz6bZhRZoAe/+TxjWB/GlFAnYEbkYVlON9FMk/fE3h2RLpPXo4lQ==", - "dev": true, - "requires": { - "psl": "^1.1.24", - "punycode": "^1.4.1" - }, - "dependencies": { - "punycode": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", - "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=", - "dev": true - } - } - }, "tslib": { "version": "1.10.0", "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.10.0.tgz", @@ -2180,21 +1858,6 @@ "integrity": "sha1-LTeFoVjBdMmhbcLARuxfxfF0IhM=", "dev": true }, - "tunnel-agent": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", - "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", - "dev": true, - "requires": { - "safe-buffer": "^5.0.1" - } - }, - "tweetnacl": { - "version": "0.14.5", - "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", - "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=", - "dev": true - }, "type-check": { "version": "0.3.2", "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz", @@ -2244,54 +1907,18 @@ "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=", "dev": true }, - "uri-js": { - "version": "4.2.2", - "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.2.2.tgz", - "integrity": "sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ==", - "dev": true, - "requires": { - "punycode": "^2.1.0" - } - }, "url-join": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/url-join/-/url-join-1.1.0.tgz", "integrity": "sha1-dBxsL0WWxIMNZxhGCSDQySIC3Hg=", "dev": true }, - "url-parse": { - "version": "1.4.7", - "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.4.7.tgz", - "integrity": "sha512-d3uaVyzDB9tQoSXFvuSUNFibTd9zxd2bkVrDRvF5TmvWWQwqE4lgYJ5m+x1DbecWkw+LK4RNl2CU1hHuOKPVlg==", - "dev": true, - "requires": { - "querystringify": "^2.1.1", - "requires-port": "^1.0.0" - } - }, "util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", "dev": true }, - "uuid": { - "version": "3.3.2", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz", - "integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==", - "dev": true - }, - "verror": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", - "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", - "dev": true, - "requires": { - "assert-plus": "^1.0.0", - "core-util-is": "1.0.2", - "extsprintf": "^1.2.0" - } - }, "vsce": { "version": "1.64.0", "resolved": "https://registry.npmjs.org/vsce/-/vsce-1.64.0.tgz", @@ -2337,29 +1964,6 @@ } } }, - "vscode": { - "version": "1.1.36", - "resolved": "https://registry.npmjs.org/vscode/-/vscode-1.1.36.tgz", - "integrity": "sha512-cGFh9jmGLcTapCpPCKvn8aG/j9zVQ+0x5hzYJq5h5YyUXVGa1iamOaB2M2PZXoumQPES4qeAP1FwkI0b6tL4bQ==", - "dev": true, - "requires": { - "glob": "^7.1.2", - "mocha": "^5.2.0", - "request": "^2.88.0", - "semver": "^5.4.1", - "source-map-support": "^0.5.0", - "url-parse": "^1.4.4", - "vscode-test": "^0.4.1" - }, - "dependencies": { - "semver": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.0.tgz", - "integrity": "sha512-Ya52jSX2u7QKghxeoFGpLwCtGlt7j0oY9DYb5apt9nPlJ42ID+ulTXESnt/qAQcoSERyZ5sl3LDIOw0nAn/5DA==", - "dev": true - } - } - }, "vscode-extension-telemetry": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/vscode-extension-telemetry/-/vscode-extension-telemetry-0.1.2.tgz", @@ -2404,13 +2008,14 @@ "integrity": "sha512-lTmS6AlAlMHOvPQemVwo3CezxBp0sNB95KNPkqp3Nxd5VFEnuG1ByM0zlRWos0zjO3ZWtkvhal0COgiV1xIA4A==" }, "vscode-test": { - "version": "0.4.3", - "resolved": "https://registry.npmjs.org/vscode-test/-/vscode-test-0.4.3.tgz", - "integrity": "sha512-EkMGqBSefZH2MgW65nY05rdRSko15uvzq4VAPM5jVmwYuFQKE7eikKXNJDRxL+OITXHB6pI+a3XqqD32Y3KC5w==", + "version": "1.3.0", + "resolved": "https://botbuilder.myget.org/F/botframework-cli/npm/vscode-test/-/vscode-test-1.3.0.tgz", + "integrity": "sha1-MxCrOF2biHtMguj1K+EDDnz5ST0=", "dev": true, "requires": { "http-proxy-agent": "^2.1.0", - "https-proxy-agent": "^2.2.1" + "https-proxy-agent": "^2.2.4", + "rimraf": "^2.6.3" } }, "which": { diff --git a/package.json b/package.json index ce5d9694c0..6ea77cc306 100644 --- a/package.json +++ b/package.json @@ -49,6 +49,7 @@ "vscode-languageclient": "~5.2.1" }, "devDependencies": { + "@types/glob": "^7.1.1", "@types/mocha": "~5.2.7", "@types/mock-fs": "~4.10.0", "@types/node": "~10.11.0", @@ -56,6 +57,7 @@ "@types/rewire": "~2.5.28", "@types/semver": "~6.2.0", "@types/sinon": "~7.5.1", + "@types/vscode": "1.34.0", "mocha": "~5.2.0", "mocha-junit-reporter": "~1.23.1", "mocha-multi-reporters": "~1.1.7", @@ -65,7 +67,7 @@ "tslint": "~5.20.1", "typescript": "~3.5.3", "vsce": "~1.64.0", - "vscode": "~1.1.36" + "vscode-test": "~1.3.0" }, "extensionDependencies": [ "vscode.powershell" @@ -73,8 +75,7 @@ "scripts": { "compile": "tsc -v && tsc -p ./ && tslint -p ./", "compile-watch": "tsc -watch -p ./", - "postinstall": "node ./node_modules/vscode/bin/install", - "test": "node ./node_modules/vscode/bin/test" + "test": "node ./out/test/runTests.js" }, "contributes": { "breakpoints": [ diff --git a/src/debugAdapter.ts b/src/debugAdapter.ts index 1e7d0e6a41..f301627212 100644 --- a/src/debugAdapter.ts +++ b/src/debugAdapter.ts @@ -58,7 +58,11 @@ function startDebugging() { // Route any output from the socket through stdout debugServiceSocket.on( "data", - (data: Buffer) => process.stdout.write(data)); + (data: Buffer) => { + debugAdapterLogWriter.write("\n\nRECEIVED: \n\n"); + debugAdapterLogWriter.write(data); + process.stdout.write(data); + }); // Wait for the connection to complete debugServiceSocket.on( @@ -70,7 +74,11 @@ function startDebugging() { // When data comes on stdin, route it through the socket process.stdin.on( "data", - (data: Buffer) => debugServiceSocket.write(data)); + (data: Buffer) => { + debugAdapterLogWriter.write("\n\nSENT: \n\n"); + debugAdapterLogWriter.write(data); + debugServiceSocket.write(data); + }); // Resume the stdin stream process.stdin.resume(); diff --git a/test/index.ts b/test/index.ts deleted file mode 100644 index a42d35d3bb..0000000000 --- a/test/index.ts +++ /dev/null @@ -1,21 +0,0 @@ -/*--------------------------------------------------------- -* Copyright (C) Microsoft Corporation. All rights reserved. -*--------------------------------------------------------*/ -// tslint:disable no-var-requires -import * as path from "path"; -import testRunner = require("vscode/lib/testrunner"); - -// See https://github.com/mochajs/mocha/wiki/Using-mocha-programmatically#set-options for options -testRunner.configure({ - ui: "tdd", // the TDD UI is being used in extension.test.ts (suite, test, etc.) - useColors: true, // colored output from test results - reporter: "mocha-multi-reporters", - reporterOptions: { - reporterEnabled: "spec, mocha-junit-reporter", - mochaJunitReporterReporterOptions: { - mochaFile: path.join(__dirname, "..", "..", "test-results.xml"), - }, - }, -}); - -module.exports = testRunner; diff --git a/test/runTests.ts b/test/runTests.ts new file mode 100644 index 0000000000..d8dcef5be8 --- /dev/null +++ b/test/runTests.ts @@ -0,0 +1,30 @@ +/*--------------------------------------------------------- + * Copyright (C) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------*/ + +import * as path from "path"; + +import { runTests } from "vscode-test"; + +async function main() { + try { + // The folder containing the Extension Manifest package.json + // Passed to `--extensionDevelopmentPath` + const extensionDevelopmentPath = path.resolve(__dirname, "../../"); + + // The path to the extension test runner script + // Passed to --extensionTestsPath + const extensionTestsPath = path.resolve(__dirname, "./testRunner"); + + // Download VS Code, unzip it and run the integration test + await runTests({ extensionDevelopmentPath, extensionTestsPath }); + } catch (err) { + // tslint:disable-next-line:no-console + console.error(err); + // tslint:disable-next-line:no-console + console.error("Failed to run tests"); + process.exit(1); + } +} + +main(); diff --git a/test/testRunner.ts b/test/testRunner.ts new file mode 100644 index 0000000000..f062959a45 --- /dev/null +++ b/test/testRunner.ts @@ -0,0 +1,49 @@ +/*--------------------------------------------------------- + * Copyright (C) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------*/ + +import * as glob from "glob"; +import * as Mocha from "mocha"; +import * as path from "path"; + +export function run(): Promise { + // Create the mocha test + const mocha = new Mocha({ + ui: "tdd", // the TDD UI is being used in extension.test.ts (suite, test, etc.) + useColors: true, // colored output from test results + reporter: "mocha-multi-reporters", + timeout: 5000, + reporterOptions: { + reporterEnabled: "spec, mocha-junit-reporter", + mochaJunitReporterReporterOptions: { + mochaFile: path.join(__dirname, "..", "..", "test-results.xml"), + }, + }, + }); + + const testsRoot = path.resolve(__dirname, ".."); + + return new Promise((c, e) => { + glob("**/**.test.js", { cwd: testsRoot }, (err: any, files: any[]) => { + if (err) { + return e(err); + } + + // Add files to the test suite + files.forEach((f) => mocha.addFile(path.resolve(testsRoot, f))); + + try { + // Run the mocha test + mocha.run((failures) => { + if (failures > 0) { + e(new Error(`${failures} tests failed.`)); + } else { + c(); + } + }); + } catch (err) { + e(err); + } + }); + }); +} From 40639be44be8f394b7b97bbc99f83176a5dc86c7 Mon Sep 17 00:00:00 2001 From: Tyler Leonhardt Date: Thu, 12 Dec 2019 14:56:05 -0800 Subject: [PATCH 14/19] color check --- test/testRunner.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/testRunner.ts b/test/testRunner.ts index f062959a45..fec33426db 100644 --- a/test/testRunner.ts +++ b/test/testRunner.ts @@ -10,7 +10,7 @@ export function run(): Promise { // Create the mocha test const mocha = new Mocha({ ui: "tdd", // the TDD UI is being used in extension.test.ts (suite, test, etc.) - useColors: true, // colored output from test results + useColors: !process.env.TF_BUILD, // colored output from test results reporter: "mocha-multi-reporters", timeout: 5000, reporterOptions: { From ef7abc1591ec8a384010bd6673f7b6d6cd00894c Mon Sep 17 00:00:00 2001 From: Tyler Leonhardt Date: Thu, 12 Dec 2019 15:06:02 -0800 Subject: [PATCH 15/19] launch args --- test/runTests.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/runTests.ts b/test/runTests.ts index d8dcef5be8..34d5f724bd 100644 --- a/test/runTests.ts +++ b/test/runTests.ts @@ -16,8 +16,8 @@ async function main() { // Passed to --extensionTestsPath const extensionTestsPath = path.resolve(__dirname, "./testRunner"); - // Download VS Code, unzip it and run the integration test - await runTests({ extensionDevelopmentPath, extensionTestsPath }); + // Download VS Code, unzip it and run the integration test from the local directory. + await runTests({ extensionDevelopmentPath, extensionTestsPath, launchArgs: ["."] }); } catch (err) { // tslint:disable-next-line:no-console console.error(err); From 81d6275c053f0959c2fd2962ddcc5b80b6a93659 Mon Sep 17 00:00:00 2001 From: Tyler Leonhardt Date: Thu, 12 Dec 2019 15:15:40 -0800 Subject: [PATCH 16/19] revert change that shouldn't have been in --- src/debugAdapter.ts | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/debugAdapter.ts b/src/debugAdapter.ts index f301627212..1e7d0e6a41 100644 --- a/src/debugAdapter.ts +++ b/src/debugAdapter.ts @@ -58,11 +58,7 @@ function startDebugging() { // Route any output from the socket through stdout debugServiceSocket.on( "data", - (data: Buffer) => { - debugAdapterLogWriter.write("\n\nRECEIVED: \n\n"); - debugAdapterLogWriter.write(data); - process.stdout.write(data); - }); + (data: Buffer) => process.stdout.write(data)); // Wait for the connection to complete debugServiceSocket.on( @@ -74,11 +70,7 @@ function startDebugging() { // When data comes on stdin, route it through the socket process.stdin.on( "data", - (data: Buffer) => { - debugAdapterLogWriter.write("\n\nSENT: \n\n"); - debugAdapterLogWriter.write(data); - debugServiceSocket.write(data); - }); + (data: Buffer) => debugServiceSocket.write(data)); // Resume the stdin stream process.stdin.resume(); From 60cc299354bde527e917704adac0adc4008b51a6 Mon Sep 17 00:00:00 2001 From: Tyler Leonhardt Date: Thu, 12 Dec 2019 15:20:37 -0800 Subject: [PATCH 17/19] try to run on linux again --- vscode-powershell.build.ps1 | 4 ---- 1 file changed, 4 deletions(-) diff --git a/vscode-powershell.build.ps1 b/vscode-powershell.build.ps1 index bab5a96781..75c0e45012 100644 --- a/vscode-powershell.build.ps1 +++ b/vscode-powershell.build.ps1 @@ -101,10 +101,6 @@ task BuildAll BuildEditorServices, Build #region Test tasks task Test Build, { - if ($env:TF_BUILD -and $global:IsLinux) { - Write-Warning "Skipping extension tests in Linux CI because vscode does not support it." - return - } Write-Host "`n### Running extension tests" -ForegroundColor Green exec { & npm run test } } From 3823e384cb8e19be110de52682dde62ac576eaa1 Mon Sep 17 00:00:00 2001 From: Tyler Leonhardt Date: Thu, 12 Dec 2019 15:59:15 -0800 Subject: [PATCH 18/19] change changelog and no ci on linux --- CHANGELOG.md | 12 +++++++----- vscode-powershell.build.ps1 | 4 ++++ 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1064ffb840..72e3406633 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,12 +4,14 @@ ### Wednesday, December 11, 2019 #### [vscode-PowerShell](https://github.com/PowerShell/vscode-PowerShell) +- ✨ 📺 [vscode-PowerShell #2335](https://github.com/PowerShell/vscode-powershell/pull/2335) - + Add editor command `PowerShell: Enable/Disable ISE Mode` for ISE emulation in VS Code. - ⚡️ 🛫 [vscode-PowerShell #2348](https://github.com/PowerShell/vscode-PowerShell/pull/2348) - Start EditorServices without start script. - ✨ 📟 [vscode-PowerShell #2316](https://github.com/PowerShell/vscode-PowerShell/pull/2316) - - Handle clearTerminal message by using vscode clear command. + Add `powershell.integratedConsole.forceClearScrollbackBuffer` setting to enable `Clear-Host` to clear scrollback buffer. - 🐛 📺 [vscode-PowerShell #2325](https://github.com/PowerShell/vscode-PowerShell/pull/2325) - - Fix update powershell feature on windows. + Fix update PowerShell feature on windows. - 🔧 📁 🐛 [vscode-powershell #2099](https://github.com/PowerShell/vscode-PowerShell/pull/2304) - Use `powerShellDefaultVersion` everywhere and stop using `powerShellExePath`. - 🐛 📺 [vscode-PowerShell #2294](https://github.com/PowerShell/vscode-PowerShell/pull/2294) - @@ -22,11 +24,11 @@ - 🛫 🐛 ⚡️ [vscode-powershell #2292](https://github.com/PowerShell/PowerShellEditorServices/pull/1118) - Isolate PSES dependencies from PowerShell on load + make PSES a pure binary module. - ✨ 📟 [PowerShellEditorServices #1108](https://github.com/PowerShell/PowerShellEditorServices/pull/1108) - - Clear the terminal via the LSP. + Clear the terminal via the LSP message `editor/clearTerminal`. - 🔍 🐛 [vscode-powershell #2319](https://github.com/PowerShell/PowerShellEditorServices/pull/1117) - Run one invocation per SetBreakpoints request. (Thanks @SeeminglyScience!) - 🐛 [PowerShellEditorServices #1114](https://github.com/PowerShell/PowerShellEditorServices/pull/1114) - - Fix Import-EditorCommand -Module. (Thanks @sk82jack!) + Fix `Import-EditorCommand -Module`. (Thanks @sk82jack!) - 🐛 🔍 [PowerShellEditorServices #1112](https://github.com/PowerShell/PowerShellEditorServices/pull/1112) - Fix breakpoint setting deadlock. - 🔗 🐛 [vscode-powershell #2306](https://github.com/PowerShell/PowerShellEditorServices/pull/1110) - @@ -40,7 +42,7 @@ - 👮‍ 🐛 [vscode-powershell #2288](https://github.com/PowerShell/PowerShellEditorServices/pull/1094) - Use RootUri.LocalPath for workspace path. - 🐛 👮‍ [PowerShellEditorServices #1101](https://github.com/PowerShell/PowerShellEditorServices/pull/1101) - - Add PSAvoidAssignmentToAutomaticVariable to the default set of PSSA rules. (Thanks @bergmeister!) + Add `PSAvoidAssignmentToAutomaticVariable` to the default set of PSSA rules. (Thanks @bergmeister!) - 👮‍ 🔗 🐛 [vscode-powershell #2290](https://github.com/PowerShell/PowerShellEditorServices/pull/1098) - Fix diagnostics not showing in untitled files and now also show CodeLens. - 🔍 🐛 [vscode-powershell #1850](https://github.com/PowerShell/PowerShellEditorServices/pull/1097) - diff --git a/vscode-powershell.build.ps1 b/vscode-powershell.build.ps1 index 75c0e45012..bab5a96781 100644 --- a/vscode-powershell.build.ps1 +++ b/vscode-powershell.build.ps1 @@ -101,6 +101,10 @@ task BuildAll BuildEditorServices, Build #region Test tasks task Test Build, { + if ($env:TF_BUILD -and $global:IsLinux) { + Write-Warning "Skipping extension tests in Linux CI because vscode does not support it." + return + } Write-Host "`n### Running extension tests" -ForegroundColor Green exec { & npm run test } } From e62e09780aa05c4bd0fe8b9914a830bcc8895f09 Mon Sep 17 00:00:00 2001 From: Tyler Leonhardt Date: Thu, 12 Dec 2019 16:25:43 -0800 Subject: [PATCH 19/19] command explorer --- package.json | 2 +- src/features/ISECompatibility.ts | 9 +++++++++ src/settings.ts | 11 +++++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 6ea77cc306..0931fb3fb9 100644 --- a/package.json +++ b/package.json @@ -87,7 +87,7 @@ "activitybar": [ { "id": "PowerShellCommandExplorer", - "title": "PowerShell Command Explorer", + "title": "(Preview) PowerShell Command Explorer", "icon": "media/pwsh.svg" } ] diff --git a/src/features/ISECompatibility.ts b/src/features/ISECompatibility.ts index d681420d06..6bdf3f1edf 100644 --- a/src/features/ISECompatibility.ts +++ b/src/features/ISECompatibility.ts @@ -4,6 +4,7 @@ import * as vscode from "vscode"; import { LanguageClient } from "vscode-languageclient"; import { IFeature } from "../feature"; +import * as Settings from "../settings"; interface ISetting { path: string; @@ -48,6 +49,14 @@ export class ISECompatibilityFeature implements IFeature { for (const iseSetting of ISECompatibilityFeature.settings) { await vscode.workspace.getConfiguration(iseSetting.path).update(iseSetting.name, iseSetting.value, true); } + + // Show the PowerShell Command Explorer + await vscode.commands.executeCommand("workbench.view.extension.PowerShellCommandExplorer"); + + if (!Settings.load().sideBar.CommandExplorerVisibility) { + // Hide the explorer if the setting says so. + await vscode.commands.executeCommand("workbench.action.toggleSidebarVisibility"); + } } private async DisableISEMode() { diff --git a/src/settings.ts b/src/settings.ts index 397a0a9328..d57a9cedf7 100644 --- a/src/settings.ts +++ b/src/settings.ts @@ -93,6 +93,7 @@ export interface ISettings { codeFormatting?: ICodeFormattingSettings; integratedConsole?: IIntegratedConsoleSettings; bugReporting?: IBugReportingSettings; + sideBar?: ISideBarSettings; } export interface IIntegratedConsoleSettings { @@ -102,6 +103,10 @@ export interface IIntegratedConsoleSettings { forceClearScrollbackBuffer?: boolean; } +export interface ISideBarSettings { + CommandExplorerVisibility?: boolean; +} + export function load(): ISettings { const configuration: vscode.WorkspaceConfiguration = vscode.workspace.getConfiguration( @@ -158,6 +163,10 @@ export function load(): ISettings { forceClearScrollbackBuffer: false, }; + const defaultSideBarSettings: ISideBarSettings = { + CommandExplorerVisibility: true, + }; + return { startAutomatically: configuration.get("startAutomatically", true), @@ -191,6 +200,8 @@ export function load(): ISettings { configuration.get("integratedConsole", defaultIntegratedConsoleSettings), bugReporting: configuration.get("bugReporting", defaultBugReportingSettings), + sideBar: + configuration.get("sideBar", defaultSideBarSettings), }; }