Skip to content

Commit ab40a53

Browse files
corbobrjmholt
authored andcommitted
Change "Get Online Help" menu item label: remove Online. (#1516)
* Change Menu label: remove Online. * We now look for help locally if it's not availble online. * Rename the file to ShowHelp. * Add a command for PowerShell.ShowHelp and mark OnlineHelp as deprecated. * Display warning when OnlineHelp is called and then execute ShowHelp. * Remove showOnlineHelp requestType as it's not used.
1 parent 1f819e2 commit ab40a53

File tree

3 files changed

+21
-10
lines changed

3 files changed

+21
-10
lines changed

package.json

+8-3
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
"contributes": {
6161
"keybindings": [
6262
{
63-
"command": "PowerShell.OnlineHelp",
63+
"command": "PowerShell.ShowHelp",
6464
"key": "ctrl+f1",
6565
"when": "editorTextFocus && editorLangId == 'powershell'"
6666
},
@@ -88,7 +88,12 @@
8888
},
8989
{
9090
"command": "PowerShell.OnlineHelp",
91-
"title": "Get Online Help for Command",
91+
"title": "Get Online Help for Command (Deprecated)",
92+
"category": "PowerShell"
93+
},
94+
{
95+
"command": "PowerShell.ShowHelp",
96+
"title": "Get Help for Command",
9297
"category": "PowerShell"
9398
},
9499
{
@@ -166,7 +171,7 @@
166171
},
167172
{
168173
"when": "editorLangId == powershell",
169-
"command": "PowerShell.OnlineHelp",
174+
"command": "PowerShell.ShowHelp",
170175
"group": "2_powershell"
171176
}
172177
]

src/features/ShowOnlineHelp.ts renamed to src/features/ShowHelp.ts

+12-6
Original file line numberDiff line numberDiff line change
@@ -6,34 +6,40 @@ import vscode = require("vscode");
66
import { LanguageClient, NotificationType, RequestType } from "vscode-languageclient";
77
import { IFeature } from "../feature";
88

9-
export const ShowOnlineHelpRequestType =
10-
new RequestType<string, void, void, void>("powerShell/showOnlineHelp");
9+
export const ShowHelpRequestType =
10+
new RequestType<string, void, void, void>("powerShell/showHelp");
1111

1212
export class ShowHelpFeature implements IFeature {
13-
1413
private command: vscode.Disposable;
14+
private deprecatedCommand: vscode.Disposable;
1515
private languageClient: LanguageClient;
1616

1717
constructor() {
18-
this.command = vscode.commands.registerCommand("PowerShell.OnlineHelp", () => {
18+
this.command = vscode.commands.registerCommand("PowerShell.ShowHelp", () => {
1919
if (this.languageClient === undefined) {
2020
// TODO: Log error message
2121
return;
2222
}
2323

2424
const editor = vscode.window.activeTextEditor;
25-
2625
const selection = editor.selection;
2726
const doc = editor.document;
2827
const cwr = doc.getWordRangeAtPosition(selection.active);
2928
const text = doc.getText(cwr);
3029

31-
this.languageClient.sendRequest(ShowOnlineHelpRequestType, text);
30+
this.languageClient.sendRequest(ShowHelpRequestType, text);
31+
});
32+
33+
this.deprecatedCommand = vscode.commands.registerCommand("PowerShell.OnlineHelp", () => {
34+
const warnText = "PowerShell.OnlineHelp is being deprecated. Use PowerShell.ShowHelp instead.";
35+
vscode.window.showWarningMessage(warnText);
36+
vscode.commands.executeCommand("PowerShell.ShowHelp");
3237
});
3338
}
3439

3540
public dispose() {
3641
this.command.dispose();
42+
this.deprecatedCommand.dispose();
3743
}
3844

3945
public setLanguageClient(languageclient: LanguageClient) {

src/main.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import { OpenInISEFeature } from "./features/OpenInISE";
2727
import { PesterTestsFeature } from "./features/PesterTests";
2828
import { RemoteFilesFeature } from "./features/RemoteFiles";
2929
import { SelectPSSARulesFeature } from "./features/SelectPSSARules";
30-
import { ShowHelpFeature } from "./features/ShowOnlineHelp";
30+
import { ShowHelpFeature } from "./features/ShowHelp";
3131
import { Logger, LogLevel } from "./logging";
3232
import { SessionManager } from "./session";
3333
import Settings = require("./settings");

0 commit comments

Comments
 (0)