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

Pt run history plugin 19349 #19569

Merged
merged 18 commits into from
Aug 23, 2022

Conversation

jefflord
Copy link
Contributor

@jefflord jefflord commented Jul 21, 2022

Summary of the Pull Request

Create a system to access and use history in PT Run (for now just the history of selected items)

PR Checklist

Detailed Description of the Pull Request / Additional comments

Testing to see how well this can work as a plugin.

Validation Steps Performed

@jefflord jefflord marked this pull request as ready for review August 7, 2022 14:31
@htcfreek
Copy link
Collaborator

htcfreek commented Aug 8, 2022

@jefflord
Can you please request a review from me.

@jefflord
Copy link
Contributor Author

jefflord commented Aug 8, 2022

Can you please request a review from me.

Is there a formal way to do this? Or just "hey @htcfreek please review this!"

@htcfreek
Copy link
Collaborator

htcfreek commented Aug 8, 2022

Can you please request a review from me.

Is there a formal way to do this? Or just "hey @htcfreek please review this!"

There is a menu on the github website on the right side of the pr description.

@jefflord
Copy link
Contributor Author

jefflord commented Aug 8, 2022

I am sorry, I still don't get all the github stuff. I am used to DevOps...

There are no reviewers in the list to request a review from:
image

I think the owners of the repo have to assign reviews first? Please tell me what I am missing. Thanks.

@htcfreek
Copy link
Collaborator

htcfreek commented Aug 8, 2022

I am sorry, I still don't get all the github stuff. I am used to DevOps...

There are no reviewers in the list to request a review from:
image

I think the owners of the repo have to assign reviews first? Please tell me what I am missing. Thanks.

I think you don't have permission.

@jefflord
Copy link
Contributor Author

jefflord commented Aug 8, 2022

I think you don't have permission.

Right, this is the mystery. I can just "at" someone that I know is working the PT Run area to see if they can help? @jaimecbernardo, can you help out?

@jaimecbernardo
Copy link
Collaborator

Sorry. Adding some reviewers in here

@jaimecbernardo jaimecbernardo requested a review from htcfreek August 8, 2022 14:52
@jaimecbernardo jaimecbernardo added the Needs-Review This Pull Request awaits the review of a maintainer. label Aug 8, 2022
Copy link
Collaborator

@htcfreek htcfreek left a comment

Choose a reason for hiding this comment

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

@jefflord
Something is wrong. The output dir (...\plugins\history) for "Debug x64" is empty on my machine. I can't build the plugin. Building the plugin directly compiles the Powertys.Run binaries into the plugin folder.

@jefflord
Copy link
Contributor Author

jefflord commented Aug 9, 2022

@htcfreek

This is the first plugin I have created and so maybe someone else could help trouble shoot a build issue.

Though, I can say if the output dir is empty it must not be building, right?

Try to get more information by changing the build settings in VS:
image

Can you try doing a full clean and full rebuild on the entire solution?

I will review the "new-plugin-checklist.md" and up you when there is new code to test, I might have missed something.

To the other reviewers: @stefansjfw and @jaimecbernardo,
I saw the "new-plugin-checklist.md" a bit late, crap... Should I rename the plugin to "Community.PowerToys.Run.Plugin.History" (it's current Microsoft.PowerToys.Run.Plugin.History)

@htcfreek
Copy link
Collaborator

htcfreek commented Aug 9, 2022

Though, I can say if the output dir is empty it must not be building, right?

Not sure. Based on log the project is build and the dll is generated. Maybe something with the build output path?!

Can you try doing a full clean and full rebuild on the entire solution?

Good idea. Will try later or tomorrow. Maybe it's because I select Launcher for debugging. (But in general this should work too.)

To the other reviewers: @stefansjfw and @jaimecbernardo,
I saw the "new-plugin-checklist.md" a bit late, crap... Should I rename the plugin to "Community.PowerToys.Run.Plugin.History" (it's current Microsoft.PowerToys.Run.Plugin.History)

For me this feels like a core feature. So Microsoft should be okay.

Copy link
Collaborator

@htcfreek htcfreek left a comment

Choose a reason for hiding this comment

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

First of all I was able to build it in a full and clean debug build of the whole solution. And the functionality of the plugin is great. This will be a big improvement.

There are a few things we should fix/improve:

  1. See the code review.
  2. The history entries for shell plugin needs a restart of PT Run to be available.
  3. We need a more clear delete button image. The current one conflicts with WW plugin. The new image should contain the history symbol and a delete symbol. (Btw. WW plugin uses delete icon for kill process and remove icon for close window.)
    image
  4. The tool tip of the delete button shouldn't contain the title as this can be to long. Please keep it short and simple.

Regarding the build process:

I saw that you referenced the PowerLauncher project as include in your plugin project. Maybe this is the cause of all the problems:

  • Plugin won't build/is ignored, if I build PowerLauncher project for direct debugging.
  • On full solution build we have a second PowerLauncher.exe and other project files in the plugin folder were it shouldn't be.
    @stefansjfw or @jaimecbernardo can you help here?

Additional idea:

A nice thing could be if we show the history on opening PT Run if ShowLastQuery option is off and/or the search input is empty. This can be an optional setting.

@jefflord
Copy link
Contributor Author

@htcfreek wow, fantastic review. I will be digging in soon!

Thank you!

@htcfreek
Copy link
Collaborator

@jefflord
I didn't test all plugins for occurrence in history. Only a few one. I think this is something you can do by yourself.

@jefflord
Copy link
Contributor Author

jefflord commented Aug 11, 2022

@htcfreek

This is a bummer, I cannot build anymore. I did update VS to 17.3.

As an example issue, getting just an updated branch main, I cannot build "ApplicationUpdate".

Error (active)	E0135	namespace "nonstd" has no member "make_unexpected"
ApplicationUpdate	...\src\common\updating\updating.cpp	75	

Error	C2039	'make_unexpected': is not a member of 'nonstd'	
ApplicationUpdate	...\src\common\updating\updating.cpp	75	

Error	C3861	'make_unexpected': identifier not found	
ApplicationUpdate	...\src\common\updating\updating.cpp	75	

Any clue on this?

UPDATE: Reverted back to VS 17.2.7 and the build is OK again. hmmmmmm

@jefflord
Copy link
Contributor Author

@htcfreek thanks again for the awesome review.

I made all the code changes suggested. With regard to the other comments:

The history entries for shell plugin needs a restart of PT Run to be available.

Fixed and should work better for other plugins.

We need a more clear delete button image

How's this:
image

I think we can only pick from these? https://docs.microsoft.com/en-us/windows/apps/design/style/segoe-ui-symbol-font

The tool tip of the delete button shouldn't contain the title as this can be to long. Please keep it short and simple.

True, done

I saw that you referenced the PowerLauncher...

Yes, because I need access to PluginManager.AllPlugins and PluginManager.API. I really hated doing this. I know this seems like a bad call since it's almost circular reference, and I see that it could be weird for the build process regarding build order. But what can be done?

  1. Move PluginManager out of PowerLauncher then add a reference to that in PowerLauncher and and History...
  2. Get real sneaky and use reflection to access what we need in PluginManager?
  3. ???

What I will/did change this reference to NOT copy local, so we don't get a copy of the PowerLauncher assembly in the History output folder.

@jefflord jefflord requested a review from htcfreek August 11, 2022 03:25
@jefflord
Copy link
Contributor Author

@htcfreek

I think these take care of all the rest, some you have seen.

doc/devdocs/modules/launcher/plugins/history.md
#19917
https://github.com/jefflord/PowerToys/tree/patch-1

.pipelines/ESRPSigning_core.json
#19919
https://github.com/jefflord/PowerToys/tree/patch-2

docs/hub/powertoys/run.md
MicrosoftDocs/windows-dev-docs#3998
https://github.com/jefflord/windows-uwp/tree/patch-1

This new-plugin process is "a bit" involved, but I guess it does not happen a lot and so that's OK.

Please let me know what I missed (I know you will).

@htcfreek
Copy link
Collaborator

@jefflord
You can request the final review from @jaimecbernardo and @stefansjfw to get this finally approved. I think it's ready. 👍🏻🚀

@jefflord
Copy link
Contributor Author

@htcfreek Soooo much thanks, wish me luck!

@jefflord
Copy link
Contributor Author

@jaimecbernardo and @stefansjfw, please review at your convenience.

Thanks

@htcfreek
Copy link
Collaborator

@htcfreek Soooo much thanks, wish me luck!

You don't need luck because you did a very great job. 😉

@jefflord
Copy link
Contributor Author

@stefansjfw, the extra PRs are closed. I think everything we need is in this single PR now. Thanks.

PowerToys.sln Outdated Show resolved Hide resolved
installer/PowerToysSetup/Product.wxs Outdated Show resolved Hide resolved
installer/PowerToysSetup/Product.wxs Outdated Show resolved Hide resolved
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\PowerLauncher\PowerLauncher.csproj">
Copy link
Collaborator

Choose a reason for hiding this comment

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

I saw there is a discussion about this already. just want to note this to see if there is a way to go around it

</AdditionalFiles>
</ItemGroup>
<ItemGroup>
<PackageReference Include="StyleCop.Analyzers">
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is now included by default in all csprojects. You should rebase to the latest main.

<ItemGroup>
<PackageReference Include="JetBrains.Annotations" Version="2021.3.0" />
<PackageReference Include="Mages" Version="2.0.1" />
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="6.0.0">
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is now included by default in all csprojects

@stefansjfw
Copy link
Collaborator

I did a brief first review. Let's rebase on top of master and remove packages that are now included by default

@stefansjfw
Copy link
Collaborator

Overall, I like this plugin. It works pretty well. Nice work! I'm puzzled about this dependency, but I understand that there is no simpler way to do this. Talking about future work now... Maybe extracting Plugin manager would be the way to go. Not sure atm.

@jefflord
Copy link
Contributor Author

@stefansjfw thanks, I think it's a neat plugin that poses a weird dependency question, but I think it's worth the effort.

I did a brief first review. Let's rebase on top of master and remove packages that are now included by default

Well, I don't know for sure what that means. I assume the goal is to get a version of the PR based on a newer version of main. Bit of git newb here. Help?

I can update my main (sync my fork), then rebase this branch onto my main, and address conflicts. But then I have only updated my main. If this is what you mean, how to I go on from there with the updated main branch in my repo?

I can also merge an updated main into my branch at jefflord:PTRun-History-Plugin-19349.

Thanks in advance

@stefansjfw
Copy link
Collaborator

@stefansjfw thanks, I think it's a neat plugin that poses a weird dependency question, but I think it's worth the effort.

I did a brief first review. Let's rebase on top of master and remove packages that are now included by default

Well, I don't know for sure what that means. I assume the goal is to get a version of the PR based on a newer version of main. Bit of git newb here. Help?

I can update my main (sync my fork), then rebase this branch onto my main, and address conflicts. But then I have only updated my main. If this is what you mean, how to I go on from there with the updated main branch in my repo?

I can also merge an updated main into my branch at jefflord:PTRun-History-Plugin-19349.

Thanks in advance

git remote -vv should show you all remotes you've added for PowerToys project locally. If there is no microsoft/PowerToys remote there you can add it with
git remote add msft https://github.com/microsoft/PowerToys.git

Then, just to make sure you have the latest code do:
git pull --all

And then git merge msft/main should merge the latest msft/main locally with your PTRun-History-Plugin-19349 branch. Some minor conflicts will be there but should be easy to resolve.

@jefflord
Copy link
Contributor Author

@stefansjfw OK, I was confused by the "rebase " suggestion here (#19569 (comment)).

I just need to "merge an updated main into my branch at jefflord:PTRun-History-Plugin-19349."

I usually do this by updating my/main with with msft/main via github "sync fork", but I like this option of directly adding msft as a remote to my local repo.

Also, I am SOOO glad you asked for this to be done because there was a merge conflict and it was in a place of code I wrote for another PR (#19215) that was recently (7 days ago) already merged into main!

@jefflord jefflord requested review from stefansjfw and removed request for jaimecbernardo August 18, 2022 12:15
@jefflord
Copy link
Contributor Author

@jaimecbernardo FYI: I didn't mean to remove any reviewer(s) from this. This happened inadvertently.

image

@htcfreek
Copy link
Collaborator

@jaimecbernardo
Wat is needed to get this in for this month's release?

@stefansjfw
Copy link
Collaborator

@jaimecbernardo Wat is needed to get this in for this month's release?

FYI, I'm fine with the code in general. The only thing to be discussed further here is the already mentioned dependency. I guess it can go in for now as it is and later we can figure out whether there is a better way to do this.

@jefflord
Copy link
Contributor Author

@jaimecbernardo Wat is needed to get this in for this month's release?

FYI, I'm fine with the code in general. The only thing to be discussed further here is the already mentioned dependency. I guess it can go in for now as it is and later we can figure out whether there is a better way to do this.

Sweet, I agree, ship now and make changes as needed. There might be bug/enhancements that cause us to refactor sooner than later but we won't know until we ship it.

@jaimecbernardo
Copy link
Collaborator

Sorry for the delay and thanks for the ping.
This is awesome! It seems to work so seamlessly!
Thanks a lot for this contribution! 😃

Copy link
Collaborator

@jaimecbernardo jaimecbernardo left a comment

Choose a reason for hiding this comment

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

LGTM! Thank you for the contribution! Regarding the dependency cycle, a new issue can be created after this PR is merged to refactor what's needed to a lib dependency.

@jaimecbernardo jaimecbernardo merged commit 4c796c0 into microsoft:main Aug 23, 2022
@jefflord
Copy link
Contributor Author

Fantastic thanks a bunch to @jaimecbernardo and a special thanks to @htcfreek!

@jefflord
Copy link
Contributor Author

@stefansjfw, @jaimecbernardo, @htcfreek

Shower thoughts:

Re: The "issue" where this plugin takes a dependency on PowerLauncher. I think all four of us were a little put off by this at first.

But it just dawned on me. In a "true" plugin model, it's absolutely normal for the plugin to take a dependency on the plugin-host. And it's actually more rare for the plugin-host to take a dependency on the plugins.

But maybe for PT Run, plugins are just the name for what's really "modules", since external plugins are not supported anyway, right?

TLDR:
In any case, in light of this further consideration I don't feel the need to do anything about this plugins dependency situation unless changing it actually provides some real benefit discovered in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs-Review This Pull Request awaits the review of a maintainer.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants