SimpsonGSD / P4EditVS

Simple, lightweight Visual Studio plugin to run various Perforce commands on files, such as checkout and revert. Includes optional auto-checkout feature.
https://marketplace.visualstudio.com/items?itemName=ScottSimpson.p4editvs
MIT License
32 stars 8 forks source link

Checking out C# form .cs file doesn't check out .Designer.cs and .resx #29

Open tom-seddon opened 2 years ago

tom-seddon commented 2 years ago

If you go to check out something whose kind is GUID_ItemType_PhysicalFile, how about if P4EditVS checked out everything in its ProjectItems array (and recursively)? Looks like that would fix this case.

Maybe extend this for folders too? Feels like it'd perhaps end up too easy to check out too much.

tom-seddon commented 2 years ago

Actually, it does work if you right click on the file in the Solution Explorer and do P4EditVS > Checkout from the context menu.

if you go to Extensions > P4EditVS > Checkout, on the other hand, it checks out just the current file. And that's the command I usually run, as I've got a keyboard shortcut for it.

Feels like it'd be nice to fix this.

SimpsonGSD commented 2 years ago

OnBeforeQueryStatus probably needs the same code that's in OnBeforeQueryStatusCtxt, see // Some files have multiple files such as C# forms have a .cs and .resx files so pick these up here.

Let me know if you decide to look into fixing it.

tom-seddon commented 2 years ago

I will see if I can fit it in today.

tom-seddon commented 2 years ago

I didn't fit it in today :( - will try to get this done this week.

Looks like ActiveDocument has a ProjectItem property, which fingers crossed actually does what you'd expect, so with any luck it can use that info when available.

tom-seddon commented 2 years ago

Got started on this and I realised that the same mechanism is used for all commands, including those which don't really work well with multiple files.

My current thinking is that the addin should sort-of do what you want, which is probably along these lines:

"Operate on specific file" means like dte.ActiveDocument.FullName or ProjectItem.FileNames[0].

"Operate on all project items" means all the files mentioned in the ProjectItem's FileNames array, and again for the ProjectItem's immediate children. (Or maybe we should do that fully recursively. Dunno.)

I'll get back to this in a day or two.

tom-seddon commented 2 years ago

Got a bit bogged down trying to actually make this change, but it remains on my to-do list. I don't do all that much C#+Perforce stuff generally, but it happens often enough that it won't get forgotten.