diff --git a/package.json b/package.json index c9ba7ae80d..61f20bacb0 100644 --- a/package.json +++ b/package.json @@ -60,7 +60,7 @@ "contributes": { "keybindings": [ { - "command": "PowerShell.OnlineHelp", + "command": "PowerShell.ShowHelp", "key": "ctrl+f1", "when": "editorTextFocus && editorLangId == 'powershell'" }, @@ -88,7 +88,12 @@ }, { "command": "PowerShell.OnlineHelp", - "title": "Get Online Help for Command", + "title": "Get Online Help for Command (Deprecated)", + "category": "PowerShell" + }, + { + "command": "PowerShell.ShowHelp", + "title": "Get Help for Command", "category": "PowerShell" }, { @@ -166,7 +171,7 @@ }, { "when": "editorLangId == powershell", - "command": "PowerShell.OnlineHelp", + "command": "PowerShell.ShowHelp", "group": "2_powershell" } ] diff --git a/src/features/ShowOnlineHelp.ts b/src/features/ShowHelp.ts similarity index 64% rename from src/features/ShowOnlineHelp.ts rename to src/features/ShowHelp.ts index 00dde83045..0c877740bc 100644 --- a/src/features/ShowOnlineHelp.ts +++ b/src/features/ShowHelp.ts @@ -6,34 +6,40 @@ import vscode = require("vscode"); import { LanguageClient, NotificationType, RequestType } from "vscode-languageclient"; import { IFeature } from "../feature"; -export const ShowOnlineHelpRequestType = - new RequestType("powerShell/showOnlineHelp"); +export const ShowHelpRequestType = + new RequestType("powerShell/showHelp"); export class ShowHelpFeature implements IFeature { - private command: vscode.Disposable; + private deprecatedCommand: vscode.Disposable; private languageClient: LanguageClient; constructor() { - this.command = vscode.commands.registerCommand("PowerShell.OnlineHelp", () => { + this.command = vscode.commands.registerCommand("PowerShell.ShowHelp", () => { if (this.languageClient === undefined) { // TODO: Log error message return; } const editor = vscode.window.activeTextEditor; - const selection = editor.selection; const doc = editor.document; const cwr = doc.getWordRangeAtPosition(selection.active); const text = doc.getText(cwr); - this.languageClient.sendRequest(ShowOnlineHelpRequestType, text); + this.languageClient.sendRequest(ShowHelpRequestType, text); + }); + + this.deprecatedCommand = vscode.commands.registerCommand("PowerShell.OnlineHelp", () => { + const warnText = "PowerShell.OnlineHelp is being deprecated. Use PowerShell.ShowHelp instead."; + vscode.window.showWarningMessage(warnText); + vscode.commands.executeCommand("PowerShell.ShowHelp"); }); } public dispose() { this.command.dispose(); + this.deprecatedCommand.dispose(); } public setLanguageClient(languageclient: LanguageClient) { diff --git a/src/main.ts b/src/main.ts index 08a541d2ad..8e13b80f52 100644 --- a/src/main.ts +++ b/src/main.ts @@ -27,7 +27,7 @@ import { OpenInISEFeature } from "./features/OpenInISE"; import { PesterTestsFeature } from "./features/PesterTests"; import { RemoteFilesFeature } from "./features/RemoteFiles"; import { SelectPSSARulesFeature } from "./features/SelectPSSARules"; -import { ShowHelpFeature } from "./features/ShowOnlineHelp"; +import { ShowHelpFeature } from "./features/ShowHelp"; import { Logger, LogLevel } from "./logging"; import { SessionManager } from "./session"; import Settings = require("./settings");