-
Notifications
You must be signed in to change notification settings - Fork 500
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
Change "Get Online Help" menu item label: remove Online. #1516
Conversation
We now look for help locally if it's not availble online. Perhaps to do: remove references to Online from internal commands?
@@ -88,7 +88,7 @@ | |||
}, | |||
{ | |||
"command": "PowerShell.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.
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 to ShowHelp.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 message powerShell/showHelp
while also handling the original message powerShell/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 of powerShell/showHelp
I think
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.
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
and powerShell/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.
then on the PSES side of things have the same handler accept both powerShell/showOnlineHelp and powerShell/showHelp?
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.
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.
LGTM 🎉 assuming this comes out before 2.0, this should be apart of 1.9 since it has a breaking change.
I left a comment in the PSES PR (PowerShell/PowerShellEditorServices#721 (comment)) about the breaking change, but this looks good |
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.
LGTM!
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.
Still looks good 👍
Add a command for PowerShell.ShowHelp and mark OnlineHelp as deprecated. Display warning when OnlineHelp is called and then execute ShowHelp.
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.
just a little clean up :) but looks good!
src/features/ShowHelp.ts
Outdated
|
||
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 comment
The reason will be displayed to describe this comment to others. Learn more.
re-word this comment to to:
TODO: remove ShowOnlineHelpRequest in v2
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.
nitpick: put the comment above the line.
src/features/ShowHelp.ts
Outdated
// I think we can take out the ShowOnlineHelpRequestType... I don't think we actually send it... | ||
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 comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick: an empty line between the class
and const
src/features/ShowHelp.ts
Outdated
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 comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick: no newline here :)
src/features/ShowHelp.ts
Outdated
private languageClient: LanguageClient; | ||
|
||
constructor() { | ||
// TODO: Remove this before merge. |
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.
what's this TODO
for? To delete the registerCommand?
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.
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.
src/features/ShowHelp.ts
Outdated
} | ||
|
||
const editor = vscode.window.activeTextEditor; | ||
|
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.
nitpick: remove the newline here
src/features/ShowHelp.ts
Outdated
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 comment
The reason will be displayed to describe this comment to others. Learn more.
remove this too :)
Dummy command was used for testing PSES.
@corbob I'm still keen to get this in. If you make those two whitespace edits, we can lock this PR, get the PSES one in and merge this one :) |
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); | ||
}); |
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 would put a newline here
package.json
Outdated
@@ -88,7 +88,12 @@ | |||
}, | |||
{ | |||
"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 comment
The reason will be displayed to describe this comment to others. Learn more.
I'd put a space before the opening parenthesis here
src/features/ShowHelp.ts
Outdated
@@ -6,34 +6,42 @@ import vscode = require("vscode"); | |||
import { LanguageClient, NotificationType, RequestType } from "vscode-languageclient"; | |||
import { IFeature } from "../feature"; | |||
|
|||
// TODO: remove ShowOnlineHelpRequest in v2 |
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.
Do actually need to keep this type around if we only use the new message? We need to keep it in PSES, but maybe not here?
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.
Agreed. AFAICT the ShowOnlineHelpRequestType is not used anymore in this file.
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.
As soon as the few little nits @rjmholt has pointed out are addressed, this PR LGTM.
Stylistic cleanup.
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.
Let's do itttttttt 🚢
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.
Awesome work!
PR Summary
Due to PowerShell/PowerShellEditorServices#721 we are now looking for help locally if it's not available online. This renames the menu option to be "Get Help" instead of "Get Online Help"
Point of discussion: Should Online be removed from the internal messages/function names?
PR Checklist