mrward/monodevelop-dnx-addin

Ignoring some more files?

fogzot opened this issue · 6 comments

This is related to #15 - real projects, especially web ones, have tons of files that will never be opened in the IDE, like everything found in node_modules or bower_components: what about ignoring them too? Should this be a configuration option? And if we have VCS what about ignoring all ignored files, e.g., ones that match .gitignore?

Also, some directories should really be presented as dependencies but this is probably the work of a different MD/XS addin. Is the "Dependencies" folder available to other addins using an extension poiunt or should every one implement its own?

Issue #15 was more to do with watching changes for files. Excluding directories from the file watcher if they exist inside the project's directory would mean you would have to create a file watcher for each directory inside the project's directory. I suspect we do not want to do that. I can see that node_modules could contain lots of files. The file watcher problem is only on Mono. On Windows it is fine. If this is a big problem we could also look at not using a file watcher and just using the IDE to indicate a file has changed. It would mean that changes made outside of the IDE, such as adding a new file to a directory, would not be detected, but maybe that is OK. Although the IDE does not update currently if a new file is added directly into a directory.

It sounds like this particular issue is more to do with what files to show in the Solution window.

[ ] Excluding directories in Solution window
[ ] Excluding files ignored by version control in Solution window
[ ] Extending the dependencies folder

Excluding directories

The project.json file has an exclude section:

"exclude": [
    "node_modules",
    "bower_components"
  ]

Perhaps this can be used. Although I have seen wwwroot in this exclude section.

Excluding files ignored by version control

The DNX addin would need to depend on the version control addin and presumably there is a way to see if a file is ignored. The DNX addin would ideally not be aware of Git or Subversion.

Extending the dependencies folder

Making the dependencies folder extensible by other addins in a simple way makes sense. I have not thought that far ahead yet. I think for some of the dependencies, such as bower, support for them may just be added into the DNX addin for now.

With MonoDevelop I put all the NuGet dependencies under the Dependencies folder. In Visual Studio they use the References folder for NuGet dependencies, but use the Dependencies folder for Bower and Node. The main reason was that the References node could not easily be replaced in MonoDevelop but also because the project.json has all the NuGet packages inside a dependencies section.

I think that the exclude section in project.json is about excluding directories that don't contain sources to be compiled. I have seen wwwroot and other directories that one would like to have in the solution pad in it, so using it for that is probably a bad idea. Hiding the files ignored by the version control addin is probably a good idea given that they are usually artifacts or generated files, rarely edited by the user.

tobz commented

Just throwing in my two cents here: this really hurts trying to do any sort of develop with npm usage. Having node_modules present in the solution directory totally breaks the DNX stuff, as far as dependencies, when opening said solution. The whole too many open files thing.

It'd be great if we could add manual configurability, or standardize on project.json's exclude parameter. Even if it's not perfect, it would provide the simplest 90% solution, it seems like.

The only working approach for me right now is to move my entire solution into a directory below all of my node/webpack/etc stuff so that the DNX code doesn't "see" node_modules and get choked up watching the files. It's not the worst, but like... there's gotta be a better way. The pain is real. :P

tobz commented

Also, FWIW, I'm not opposed to working on a PR for something like this, but it would be nice to hash out an agreed upon approach here in the origin issue, so to speak.

@tobz - The issue here is about what to show in the solution window not how the files are monitored. There was a change made to monitor only the source directories and not the entire solution directory however this will not help node_modules since that directory is inside the project's directory.

I think the only real solution to this is to not use a file watcher at all. Xamarin Studio can detect changes to files made outside of the IDE, at least if you switch away and then back to the IDE. This approach may miss new files added outside the IDE though but maybe that is something we can live with. I can take a look at doing this - possibly leaving the file watcher as an alternative approach but disabled by default

We're discussing very different things here, my fault. I opened #24 to discuss how to manage file watching while keeping here the discussion about what to show in the solution pad.