-
Notifications
You must be signed in to change notification settings - Fork 510
Change "Get Online Help" menu item label: remove Online. #1516
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -60,7 +60,7 @@ | |
"contributes": { | ||
"keybindings": [ | ||
{ | ||
"command": "PowerShell.OnlineHelp", | ||
"command": "PowerShell.ShowHelp", | ||
"key": "ctrl+f1", | ||
"when": "editorTextFocus && editorLangId == 'powershell'" | ||
}, | ||
|
@@ -88,7 +88,16 @@ | |
}, | ||
{ | ||
"command": "PowerShell.OnlineHelp", | ||
"title": "Get Online Help for Command", | ||
"title": "Get Online Help for Command(Deprecated)", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd put a space before the opening parenthesis here |
||
"category": "PowerShell" | ||
}, | ||
{ | ||
"command": "PowerShell.ShowHelp", | ||
"title": "Get Help for Command", | ||
"category": "PowerShell" | ||
},{ | ||
"command": "PowerShell.ShowOnlineHelp", | ||
"title": "Dummy command. Shouldn't be released...", | ||
"category": "PowerShell" | ||
}, | ||
{ | ||
|
@@ -166,7 +175,7 @@ | |
}, | ||
{ | ||
"when": "editorLangId == powershell", | ||
"command": "PowerShell.OnlineHelp", | ||
"command": "PowerShell.ShowHelp", | ||
"group": "2_powershell" | ||
} | ||
] | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
/*--------------------------------------------------------- | ||
* Copyright (C) Microsoft Corporation. All rights reserved. | ||
*--------------------------------------------------------*/ | ||
|
||
import vscode = require("vscode"); | ||
import { LanguageClient, NotificationType, RequestType } from "vscode-languageclient"; | ||
import { IFeature } from "../feature"; | ||
|
||
export const ShowOnlineHelpRequestType = | ||
new RequestType<string, void, void, void>("powerShell/showOnlineHelp"); | ||
// I think we can take out the ShowOnlineHelpRequestType... I don't think we actually send it... | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. re-word this comment to to:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nitpick: put the comment above the line. |
||
export const ShowHelpRequestType = | ||
new RequestType<string, void, void, void>("powerShell/showHelp"); | ||
export class ShowHelpFeature implements IFeature { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nitpick: an empty line between the |
||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nitpick: no newline here :) |
||
private command: vscode.Disposable; | ||
private deprecatedCommand: vscode.Disposable; | ||
// TODO: Remove Dummy command before merge. | ||
// Dummy command is used to test out the write-warning in PSES | ||
// when you send powerShell/showOnlineHelp instead of powerShell/showHelp. | ||
private dummyCommand: vscode.Disposable; | ||
private languageClient: LanguageClient; | ||
|
||
constructor() { | ||
// TODO: Remove this before merge. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what's this There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, for that commit I wanted to add a way to send the message to PSES, the TODOs are a reminder to remove them before merging the pull request. I mostly wanted it there in case someone wanted to test it to see what it's behavior would be. |
||
this.dummyCommand = vscode.commands.registerCommand("PowerShell.ShowOnlineHelp", () => { | ||
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.command = vscode.commands.registerCommand("PowerShell.ShowHelp", () => { | ||
if (this.languageClient === undefined) { | ||
// TODO: Log error message | ||
return; | ||
} | ||
|
||
const editor = vscode.window.activeTextEditor; | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nitpick: remove the newline here |
||
const selection = editor.selection; | ||
const doc = editor.document; | ||
const cwr = doc.getWordRangeAtPosition(selection.active); | ||
const text = doc.getText(cwr); | ||
|
||
this.languageClient.sendRequest(ShowHelpRequestType, text); | ||
}); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would put a newline here |
||
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(); | ||
// TODO: Remove this dummyCommand too... | ||
// Don't forget the one in package.json | ||
this.dummyCommand.dispose(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove this too :) |
||
} | ||
|
||
public setLanguageClient(languageclient: LanguageClient) { | ||
this.languageClient = languageclient; | ||
} | ||
} |
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume changing the title would be a breaking or otherwise undesirable change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wasn't wanting to change the internal messages in case I missed one. Unless someone is using the command palette to run PowerShell.OnlineHelp directly, then this shouldn't be a breaking change...
That being said, I used search and replace across the workspace (PSES and vscode-powershell) to find and replace all of the instances that referred to OnlineHelp.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like the command should be called
PowerShell.ShowHelp
,ShowOnlineHelp.ts
renamed toShowHelp.ts
, etc. The breaking change I think would come from changing the LSP message that PSES expects. In that case, couldn't we create handle a new messagepowerShell/showHelp
while also handling the original messagepowerShell/showOnlineHelp
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rkeithhill I think we were going off of the idea that vscode is likely the only editor that takes advantage of this message at this time so the change was lower risk since we control both.
That said, I'll stand by you if you feel like we should do the is right way and handle the breaking change correctly (by not having a breaking change 😄 )
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rkeithhill Yes that seems like the right behaviour. PSES should support a deprecated
powerShell/showOnlineHelp
message as an alias ofpowerShell/showHelp
I thinkThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So if I'm reading this correctly, @rkeithhill is suggesting I change all of the things I already changed (and stripped out of commit history because we said not to), and then on the PSES side of things have the same handler accept both
powerShell/showOnlineHelp
andpowerShell/showHelp
?If that's the way we want to go, I'm game for doing it. But this time around I'm going to wait for the thumbs up 😜
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about we leave the "command" name as-is for 1.x - leave it at
PowerShell.OnlineHelp
. In theory, it could be used by others via the VSCode API that allows you invoke a command by name. But I think everything else (ShowOnlineHelp.ts filename, etc) should be changed to reflect the new semantics of the command.Then in v2, let's rename the command to
PowerShell.ShowHelp
and document it as a breaking change.Yes. And in v2 we could remove the
powerShell/showOnlineHelp
message and document the breaking change there.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've modified both sides to note the deprecation of showOnlineHelp. Currently in vscode-powershell is a command that actually sends this message to PSES so that I could test the warning on PSES's side.
I think with the way the code is now, we should be able to mark it as deprecated, and when ready to remove as breaking change it's just a matter of removing it. From experience: I prefer this type of warning before removal because a lot of people don't read the change notes (unfortunately) and then freak out even if it was noted as a breaking change.