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

Adding "Create new temporary project..." button to Start Page #5

Merged
merged 20 commits into from
Sep 24, 2018

Conversation

Neme12
Copy link
Collaborator

@Neme12 Neme12 commented Jul 20, 2018

Adds "Create new temporary project..." below "Create new project..." to the start page in VS 2017.

Screenshot:
image

@jcansdale Is this something you'd be interested in?

@jcansdale
Copy link
Owner

@Neme12,

Is this something you'd be interested in?

Definitely, yes. 😄

I haven't had a chance you look at this properly yet.

Just thought I'd mention that GitHub for Visual Studio includes a start page extension (that was written before I started). I'm not sure how this or your PR works yet. Here's a link:
https://github.com/github/VisualStudio/tree/master/src/GitHub.StartPage

@Neme12
Copy link
Collaborator Author

Neme12 commented Jul 22, 2018

Just thought I'd mention that GitHub for Visual Studio includes a start page extension (that was written before I started).

Thanks. Is this the button that the extension is providing?
image
Without understanding it in detail, it looks like that extension is using an actual VS API that there is for extending this checkout list, whereas what I'm doing here is actually digging into the UI and modifying it. It's possible there is a much better way, but I doubt there's any sort of API specifically for "insert your own version of Create new project".

I'm not sure how this or your PR works yet

Well... it's basically hacks on top of hacks 😄 I don't know how to improve it more at this point, so I'll try to add some comments explaining the code. There's probably many areas that can be improved, so I would welcome any feedback

Copy link
Owner

@jcansdale jcansdale left a comment

Choose a reason for hiding this comment

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

Thanks fore the PR.

It would be nice if we could find a way to only make the package load when the StartPage is visible. See inline comment for suggestion.

TemporaryProjects/NewTempProjectCommandPackage.cs Outdated Show resolved Hide resolved
TemporaryProjects/StartPageExtender.cs Outdated Show resolved Hide resolved
@jcansdale
Copy link
Owner

Thanks. Is this the button that the extension is providing?

Yes, that's the one.

Well... it's basically hacks on top of hacks 😄 I don't know how to improve it more at this point, so I'll try to add some comments explaining the code. There's probably many areas that can be improved, so I would welcome any feedback

I'm cool with hacks if we program defensively. 😄 The PR icon at the right hand side of the status bar is very similar to this.

Neme12 and others added 2 commits July 23, 2018 19:52
TemporaryProjects.Vsix builds the .vsix, TemporaryProjects.14.0 the
`File > New` extension and TemporaryProjects.15.0 the StartPage
extension.
@jcansdale
Copy link
Owner

@Neme12,

I've now split it into TemporaryProjects.14.0 for Visual Studio 2015+ compatible packages and TemporaryProjects.15.0 for Visual Studio 2018 compatible packages.

Hopefully we will now be able to use ProvideCodeContainerProviderAttribute in the TemporaryProjects.15.0 project to have it only load when StartPage is visible.

It's still a bit rough around the edges, so feel free to fix anything that looks wrong. 😉

It appears we can use the StartPage PersistenceSlot as a UIContext.
Copy link
Owner

@jcansdale jcansdale left a comment

Choose a reason for hiding this comment

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

We can get rid of the dynamic/reflection hack now! :-) I wasn't sure whether to cast to ToolWindowPane or WindowPane. I'll leave this up to you.

TemporaryProjects.15.0/StartPageExtender.cs Outdated Show resolved Hide resolved
Copy link
Owner

@jcansdale jcansdale left a comment

Choose a reason for hiding this comment

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

This will now only load when the StartPage tool window becomes visible, which is exactly what we want!

TemporaryProjects.15.0/StartPageExtenderPackage.cs Outdated Show resolved Hide resolved
Move all GUIDs to TemporaryProjects.vsct.
Having two assemblies was unnecessarily complicated.
@jcansdale
Copy link
Owner

@Neme12,

I was hoping that I'd be able to neatly split the extension into Visual Studio 2015 and Visual Studio 2017 compatible packages.

Alas, there doesn't appear to be a way to specify which version of Visual Studio a package is compatible with. Since having two package assemblies was complicating things withing gaining anything, I've combined the packages back into a single Visual Studio 2015+2017 compatible assembly.

I like having the VSIX project separate from package project, so I've left it split into two projects.

Does that make sense? Do you think we're good to merge?

@jcansdale jcansdale changed the title [WIP] Adding "Create new temporary project..." button to Start Page Adding "Create new temporary project..." button to Start Page Jul 25, 2018
Copy link
Owner

@jcansdale jcansdale left a comment

Choose a reason for hiding this comment

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

I think this is just about ready to merge.

What do you think?

@Neme12
Copy link
Collaborator Author

Neme12 commented Jul 25, 2018

Can you please wait until I'm able to look at this before merging (I hope that will be tomorrow). Thanks.

@Neme12
Copy link
Collaborator Author

Neme12 commented Jul 30, 2018

I like having the VSIX project separate from package project, so I've left it split into two projects.

I don't think I fully understand the reason for this. Is the purpose so that the source code can be contained in a regular project as opposed to a VSIX project? But it appears that TemporaryProjects.14.0 is still an extensibility project (although it doesn't create a VSIX), not a regular class library. Would it be possible to make it a regular class library? Can you please help me understand this?

It's also possible I don't understand what a "package project" is. Does that have a meaning or do you simply refer to it as the "package project" because it contains the actual "AsyncPackage"s? Thanks

@Neme12
Copy link
Collaborator Author

Neme12 commented Jul 30, 2018

But more importantly, I'm not able to build this right now. I'm getting this error when building TemporaryProjects.Vsix:

The "GenerateFileManifest" task could not be loaded from the assembly C:\Program Files (x86)\Microsoft Visual Studio\Preview\Community\MSBuild\Microsoft\VisualStudio\v15.0\VSSDK\Microsoft.VisualStudio.Sdk.BuildTasks.dll. Confirm that the declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask. TemporaryProjects.Vsix

and 2 warnings:

Targets version (1.0.597.65351) and build task version (1.0.458.27355) do not match. Restarting Visual Studio could help fix this issue.
Targets version (15.8.3237.65351) and build task version (15.7.109.27355) do not match. Restarting Visual Studio could help fix this issue.

Restarting doesn't help of course, neither does cleaning and restoring packages. Is there something wrong with my setup? Do you have any ideas? I'm using 15.8 Preview 5

@Neme12
Copy link
Collaborator Author

Neme12 commented Jul 30, 2018

I'm able to fix the build error and both warnings locally by adding the Microsoft.VSSDK.BuildTools package to TemporaryProjects.Vsix

@Neme12
Copy link
Collaborator Author

Neme12 commented Jul 30, 2018

I discovered a bug. If I open the start page in one tab and another unrelated tab, switch to the other tab and then back to the start page, the button is gone. It seems the content of the start page is recreated every time its tab is activated.

edit: Fixed in 493bfcd

@Neme12
Copy link
Collaborator Author

Neme12 commented Jul 30, 2018

@jcansdale Ok, I think this is ready. Sorry for the delay.

There's more bugs. This needs more investigation. For example:

  • change focus to another tool window and then back to start page - button is duplicated
  • undock start page - button is gone, redock - button is still gone

@jcansdale
Copy link
Owner

I don't think I fully understand the reason for this. Is the purpose so that the source code can be contained in a regular project as opposed to a VSIX project? But it appears that TemporaryProjects.14.0 is still an extensibility project (although it doesn't create a VSIX), not a regular class library. Would it be possible to make it a regular class library? Can you please help me understand this?

Every time the TemporaryProjects.Vsix project is built, it creates and installs the .vsix (which can take a while). If the project containing the packages is separate, we can test it without the delay from generating installing the .vsix. It is still an extensibility project, but it's only generating a .pkgdef from the packages.

Thanks for the fixes. It looks like you've made some worthwhile changes. 👍

@Neme12
Copy link
Collaborator Author

Neme12 commented Sep 23, 2018

@jcansdale I've made a change that makes it so that the button is displayed correctly when switching tabs and focus but undocking still isn't working properly, so this is a compromise. I tried many approaches (as described in the comment) and couldn't get this to work consistently. Do you think it's acceptable to ship this?

@jcansdale
Copy link
Owner

jcansdale commented Sep 23, 2018

@Neme12 I'm going to reset my recent commits and force push. Could you reset your branch?

I've extracted my non-"Create new temporary project..." related changes into a separate PR and merged to master. See abde624

Do you think it makes sense to squash this PR? 😄

@Neme12
Copy link
Collaborator Author

Neme12 commented Sep 23, 2018

@jcansdale Feel free to force push and squash this if you want

@jcansdale
Copy link
Owner

@Neme12 I've changed the display name of the extension, you might need to manually uninstall the previous version from your experimental instance!

Make StartPageExtender.Initialize testable using TestDriven.Net's `Test
With > In-Proc (VS SDK)` command.
Find Visual Studio version using Process.GetCurrentProcess(). This
allows us to abort before doing any async in Visual Studio 2015.
@jcansdale
Copy link
Owner

@Neme12 Let me know if you're happy with the latest commit and I'll squash + merge.

Add comments because it wasn't obvious why calling
UnadviseWindowFrameEvents might be necessary.
Copy link
Owner

@jcansdale jcansdale left a comment

Choose a reason for hiding this comment

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

LGTM!

I'd like to get automated deployment to the marketplace working now (#7). It is proving to be a little tricky. Let me know if you have any suggestions...

TemporaryProjects.14.0/StartPageExtender.cs Show resolved Hide resolved
@jcansdale jcansdale merged commit 7de2b12 into jcansdale:master Sep 24, 2018
@Neme12
Copy link
Collaborator Author

Neme12 commented Sep 24, 2018

Thanks!

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.

2 participants