Skip to content
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

Merged
merged 4 commits into from
Sep 21, 2018
Merged

Change "Get Online Help" menu item label: remove Online. #1516

merged 4 commits into from
Sep 21, 2018

Conversation

corbob
Copy link
Contributor

@corbob corbob commented Sep 3, 2018

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

  • PR has a meaningful title
  • Summarized changes
  • This PR is ready to merge and is not work in progress

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",
Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Contributor

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?

Copy link
Member

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 😄 )

Copy link
Contributor

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

Copy link
Contributor Author

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 😜

Copy link
Contributor

@rkeithhill rkeithhill Sep 11, 2018

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.

Copy link
Contributor Author

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.

Copy link
Member

@TylerLeonhardt TylerLeonhardt left a 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.

@rjmholt
Copy link
Contributor

rjmholt commented Sep 6, 2018

I left a comment in the PSES PR (PowerShell/PowerShellEditorServices#721 (comment)) about the breaking change, but this looks good

Copy link
Contributor

@rjmholt rjmholt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Copy link
Member

@TylerLeonhardt TylerLeonhardt left a 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.
Copy link
Member

@TylerLeonhardt TylerLeonhardt left a 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!


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...
Copy link
Member

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

Copy link
Member

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.

// 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 {
Copy link
Member

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

export const ShowHelpRequestType =
new RequestType<string, void, void, void>("powerShell/showHelp");
export class ShowHelpFeature implements IFeature {

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: no newline here :)

private languageClient: LanguageClient;

constructor() {
// TODO: Remove this before merge.
Copy link
Member

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?

Copy link
Contributor Author

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.

}

const editor = vscode.window.activeTextEditor;

Copy link
Member

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

this.deprecatedCommand.dispose();
// TODO: Remove this dummyCommand too...
// Don't forget the one in package.json
this.dummyCommand.dispose();
Copy link
Member

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.
@rjmholt
Copy link
Contributor

rjmholt commented Sep 20, 2018

@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);
});
Copy link
Contributor

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)",
Copy link
Contributor

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

@@ -6,34 +6,42 @@ import vscode = require("vscode");
import { LanguageClient, NotificationType, RequestType } from "vscode-languageclient";
import { IFeature } from "../feature";

// TODO: remove ShowOnlineHelpRequest in v2
Copy link
Contributor

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?

Copy link
Contributor

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.

Copy link
Contributor

@rkeithhill rkeithhill left a 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.

Copy link
Member

@TylerLeonhardt TylerLeonhardt left a 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 🚢

Copy link
Contributor

@rjmholt rjmholt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome work!

@rjmholt rjmholt merged commit ab40a53 into PowerShell:master Sep 21, 2018
@corbob corbob deleted the Really-fix-884 branch January 17, 2019 04:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants