Skip to content

Conversation

abpiskunov
Copy link
Contributor

@abpiskunov abpiskunov commented Jan 6, 2017

  • support automation (VSLangProj.References) by switching to IProjectItemTree instead of IProjectTree. This is needed since CPS uses IProjectItemTree nodes with Reference flag to implement VSLangProj.References. (Note: this still would need some matching CPS changes to make sure we work OK for regular references (assemblies and projects) and packages (for packages CPS needs to listen for package xaml rules and add e new reference type). Note: i reuse a Folder xaml type for custom dependency nodes (implemented outside of managed project system), however we might want to create a separate BrowseObject xaml rule "GenericDependency" to be precise and add there standard set of properties.

  • organize dependency nodes flags: all generic (implemented by us nodes) will have CPS's Reference flags to allow CPS default commands behavior and our own Dependencies flags to allow to figure out if nodes are ours in the future. All custom nodes implemented outside of managed project system, will have only Dependencies flags to avoid CPS logic be executed for them - they are not References in old meaning of them.

  • fixes issue Dependencies sub nodes have objects for opening properties and View in object browser #398 and does not show View In ObjectBrowser for dependencies sub nodes. Properties is still showing up though
    fixes The delete button doesn't work for nuget package references or project references in the solution explorer #864 and Remove UI button missing in Right-click list on Dependencies->Projects #708 to support Remove menu command and delete key for all standard top level dependencies (custom ones like web bower, should implement their own delete command)

  • fixes "View In Object Browser" does not work for project references #403 to show View in Object Browser command for standard dependencies, however projects are not displayed in the Browser (still investigating why - could be CPS) and also need to hide this command for packages, (this is also pending).

    TODO:

  • projects are not displayed in the Browser (still investigating why - could be CPS) and also need to hide this command for packages, (this is also pending).

  • Properties is still showing up for Dependencies sub nodes. If it is controlled by some CPS command handler will override it, if by IVsUIHierarchy implementation would need CPS change.

  • see if we want to create a separate BrowseObject xaml rule "GenericDependency" for custom dependency nodes and add there standard set of properties.

@abpiskunov
Copy link
Contributor Author

abpiskunov commented Jan 6, 2017

@dotnet/project-system @srivatsn @davkean @333fred @jviau @BillHiebert #Resolved

var childSubTreeProvider = childrenSubTreeProviders == null
? subTreeProvider
: childrenSubTreeProviders[i];
var childSubTreeProvider = childrenSubTreeProviders?[i];
Copy link
Contributor

@jviau jviau Jan 6, 2017

Choose a reason for hiding this comment

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

Null coalesce to subTreeProvider? #Resolved

.FirstOrDefault();
if (node == null)
{
// node is not ours or does node xist anymore
Copy link
Contributor

@jviau jviau Jan 6, 2017

Choose a reason for hiding this comment

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

Spelling: node -> not, xist -> exist #Resolved


private string ExtractNameFromCaption(string caption)
{
var index = caption?.IndexOf(' ');
Copy link
Contributor

@jviau jviau Jan 6, 2017

Choose a reason for hiding this comment

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

Is space the right delimiter here for the caption? Does this mean no Dependency node can have a space in its name? #Resolved

.Add(Folder.FullPathProperty, string.Empty);

// For generic node types we do set correct, known item types, however for custom nodes
// provided by third party extensions we can not guaranty that item type will be known.
Copy link
Contributor

@jviau jviau Jan 6, 2017

Choose a reason for hiding this comment

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

spelling: guarnty -> guarantee #Resolved

return dependenciesNode;
}


Copy link
Contributor

@jviau jviau Jan 6, 2017

Choose a reason for hiding this comment

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

Remove extra newline here #Resolved

}
}

Copy link
Contributor

@jviau jviau Jan 6, 2017

Choose a reason for hiding this comment

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

Remove extra whitespace #Resolved

Caption = caption;
Icon = icon;
ExpandedIcon = expandedIcon ?? Icon;
Flags = flags.Add(ProjectTreeFlags.Common.NonFileSystemProjectItem.ToString());
Copy link
Contributor

@jviau jviau Jan 6, 2017

Choose a reason for hiding this comment

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

ToString() is not necessary with common flags. #Resolved

using Microsoft.VisualStudio.ProjectSystem.VS.Tree.Dependencies;
using Microsoft.VisualStudio.Shell.Interop;
using Moq;
using Microsoft.VisualStudio.Shell;
Copy link
Contributor

@jviau jviau Jan 6, 2017

Choose a reason for hiding this comment

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

sort usings. #Resolved

using Microsoft.VisualStudio.Shell.Interop;
using Microsoft.VisualStudio.Threading;
using Task = System.Threading.Tasks.Task;
using System.IO;
Copy link
Contributor

@jviau jviau Jan 6, 2017

Choose a reason for hiding this comment

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

Sort usings #Resolved


graphContext.OutputNodes.Add(newNode);

Copy link
Contributor

@jviau jviau Jan 6, 2017

Choose a reason for hiding this comment

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

Remove extra whitespace #Resolved

@abpiskunov
Copy link
Contributor Author

abpiskunov commented Jan 6, 2017

@jviau i followed up with all your comments. Good catch on "space" parsing, it was ugly and actually i found related issue which fixed in the new commit (searching for nodes in the tree was not right) #Resolved

return Mock.Of<IVsHierarchyItem>();
}

public static IVsHierarchyItem Implement(string text = null,
Copy link
Member

@333fred 333fred Jan 6, 2017

Choose a reason for hiding this comment

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

Could you say what method/getter you're implementing, in case we have to add new things in the future? #Resolved

{
var fullItemSpecPath = Path.GetFullPath(
Path.Combine(projectFolder,
nodeInfo.Id.ItemSpec?.ToLowerInvariant()));
Copy link
Member

@333fred 333fred Jan 6, 2017

Choose a reason for hiding this comment

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

Path.Combine throws if an argument is null. Test if ItemSpec is null before calling. #Resolved

var fullItemSpecPath = Path.GetFullPath(
Path.Combine(projectFolder,
nodeInfo.Id.ItemSpec?.ToLowerInvariant()));
if (!string.IsNullOrEmpty(fullItemSpecPath))
Copy link
Member

@333fred 333fred Jan 6, 2017

Choose a reason for hiding this comment

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

Could this ever not be satisfied? GetFullPath will throw if the path is illegal (such as an empty string), and will otherwise return a string that cannot be null or empty. #Resolved


graphContext.OutputNodes.Add(newNode);

Copy link
Member

@333fred 333fred Jan 6, 2017

Choose a reason for hiding this comment

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

Whitespace #Resolved

{
path = "file:///" + path.Trim('/');
}
//if (!path.StartsWith("file:///"))
Copy link
Member

@333fred 333fred Jan 6, 2017

Choose a reason for hiding this comment

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

Let's not leave commented code in the code base. If this needed to be commented out because of a bug, please file one. #Resolved

// For generic node types we do set correct, known item types, however for custom nodes
// provided by third party extensions we can not guarantee that item type will be known.
// Thus always set predefined itemType for all custom nodes.
// TODO: generate specific xaml rule for generic Dependency nodes
Copy link
Member

@333fred 333fred Jan 6, 2017

Choose a reason for hiding this comment

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

Link issue. #Resolved


// when itemSpec is not in valid absolute path format, property page does not show
// item name correctly. Use real Name for the node here instead of caption, since caption
// can have other info liek version in it.
Copy link
Member

@333fred 333fred Jan 6, 2017

Choose a reason for hiding this comment

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

Spelling on like #Resolved

/// Actual formal name of the node. In most cases it will be equal to Caption,
/// however in some cases caption would have name + version or something else.
/// So to allow tree provider store formal name we need this property too.
/// It is a hack now and we should make it public and move to IDependencyNode when
Copy link
Member

@333fred 333fred Jan 6, 2017

Choose a reason for hiding this comment

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

Please file a bug for this. #Resolved

Copy link
Member

@333fred 333fred Jan 6, 2017

Choose a reason for hiding this comment

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

Additionally, when will be a better time to do this that we can make breaking changes? I find it highly unlikely we'll be able to make major breaking changes after we ship 1.0, so we should make this public now if we can. #Resolved

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 agree. I opened a bug for RTW and if it is approved we coudl do that - it is not hard to implement, but logistics ... we need to synchronize insertions for core and web. It also can be done , just need an agreement :). Btw David Kean wanted also to rename some public Async methods , we could combine 2 changes.


In reply to: 95038283 [](ancestors = 95038283)

Anton Piskunov added 3 commits January 6, 2017 15:53
	- support automation (VSLangProj.References) by switching to IProjectItemTree instead of IProjectTree. This is needed since CPS uses IProjectItemTree nodes with Reference flag to implement VSLangProj.References. (Note: this still would need some matching CPS changes to make sure we work OK for regular references (assemblies and projects) and packages (for packages CPS needs to listen for package xaml rules and add e new reference type). Note: i reuse a Folder xaml type for custom dependency nodes (implemented outside of managed project system), however we might want to create a separate BrowseObject xaml rule "GenericDependency" to be precise and add there standard set of properties.
	- organize dependency nodes flags: all generic (implemented by us nodes) will have CPS's Reference flags to allow CPS default commands behavior and our own Dependencies flags to allow to figure out if nodes are ours in the future. All custom nodes implemented outside of managed project system, will have only Dependencies flags to avoid CPS logic be executed for them - they are not References in old meaning of them.
	- fixes issue #398 and does not show View In ObjectBrowser for dependencies sub nodes. Properties is still showing up though
	- fixes #864 and #708 to support Remove menu command and delete key for all standard top level dependencies (custom ones like web bower, should implement their own delete command)
	- fixes #403 to show View in Object Browser command for standard dependencies, however projects are not displayed in the Browser (still investigating why - could be CPS) and also need to hide this command for packages, (this is also pending).

	TODO:
	- projects are not displayed in the Browser (still investigating why - could be CPS) and also need to hide this command for packages, (this is also pending).
	- Properties is still showing up for Dependencies sub nodes. If it is controlled by some CPS command handler will override it, if by IVsUIHierarchy implementation would need CPS change.
	- see if we want to create a separate BrowseObject xaml rule "GenericDependency" for custom dependency nodes and add there standard set of properties.
	- make searching for tree node safer and make sure it works with all kinds of nodes properly
	- add a formal node name to DependencyNode to avoid weird string parsing when need to remove node's project item
Copy link
Member

@333fred 333fred left a comment

Choose a reason for hiding this comment

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

Aside from the missing bug link for the todo, looks good.

@abpiskunov abpiskunov merged commit ea525af into dotnet:master Jan 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants