Closed LeoColomb closed 10 years ago
All the project types are implemented differently and some don't support nested files using the standard APIs in VS. It's pretty frustrating for extension authors because each extension has to be tested on ALL project types. Unfortunately I don't have the bandwidth to do all that testing.
I don't have the PHP extension installed, so I can't debug the issue. If you can debug it then please let me know what the problem is or feel free to send a PR. Thanks.
Hi Mads,
The issue is not just with PHP Tools, but also with Python and NodeJs.
There are two problems:
Issue 1. i.Kind == VSConstants.ItemTypeGuid.PhysicalFile_string
Kind is however in our project system (and PTVS, NTVS) guid.ToString("B") returning lower-case guid string. VSConstants.ItemTypeGuid.PhysicalFile_string is upper-case
Issue 2. Nesting existing item with parent.ProjectItems.AddFromFile(path); is not working on these project systems when path is already existing in the hierarchy. But as it behaves like this in C# Proj.sys. we should probably behave the same way. I'll try to do something with this one.
Thanks!
I've changed the i.kind to use GUID comparisons instead. That works for NTVS projects. However, as you mentioned, AddFromFile()
does nothing. I don't want to special case NTVS by deleting the file and then recreating it with the right nesting. That would lose file history etc. Is there another way to do it in NTVS projects?
We need to do some work on our project system to be able to support this. As bad as things are for extension authors, it's also pretty horrible to be a tiny team trying to replicate everything that the huge teams have built up over years of development.
Is this feature using the same dependent files support that WinForms and WPF use? We have most of the support there for that, though apparently not the DTE function, but it can be done through the project file. I'm not sure we support nesting more than one file in this way though. Basically, it's quite a low priority for us, as both Python and Node.js rely on the view of the project matching the file system, so nesting files like this is not a common request.
PHP may be different and we'll always consider contributions (as you know, @Miloslav :) ), but we probably won't be able to get to it ourselves any time soon.
@madskristensen
Unfortunately I'm currently not aware of other method. However I'll take a look
@Zooba
Yes, it's the same. SharedProject system does support nesting, even more than one level. Just this method of adding a node which is already in the hierarchy through DTE doesn't work with us (adding a new node works correctly). Everything comes down to the insane function ProjectNode.AddItemWithSpecificInternal . I'll take a look at that to see if it can be somehow easily altered to support that, but as you know that method is scary :-)
Hi @madskristensen, I recently want to use this extension but get an error. For some types of project (here PHP created with PHP Tools for Visual Studio by Devsense) the feature implemented by this extension simply doesn't work.
More specifically, when it's inside a subfolder, the Un-nest option is available but raise the error "This action isn't valid with the current config" on click.
Visual Studio 2013.2 Project file extension is
.phpproj
.