Add support for folder organization #116
Comments
Yes, this would be great to add. (Note you can use folders with the Visual F# Tools, you just have to edit the project file by hand, see http://stackoverflow.com/questions/5918534/why-cant-i-add-a-subfolder-in-a-f-project) |
+1 In my team, we do use folders too, but we manually edit the fsproj. |
As I know, it's implemented in Xamarin. Maybe we could use some code from there? |
I have it done: https://github.com/MarcinJuraszek/VisualFSharpPowerTools/commit/88123b37328e47c2f6bd757f693f5518efd6faaf but because F# is not my native language, I still need some time to read that code again, with fresh mind, and do some refactoring. I should be able to do PR tomorrow! |
Great. We're looking forward to the pull request. |
I reviewed your code, please take a look. |
Great news! One other note, generally pull requests flow much smoother if you keep your PR in a separate branch. Looking forward to seeing this get pulled in. |
OK, I have another version for folder organization. This one is reflection-based, and because of that there is no XML modifications and project does not have to be reloaded every time you do something. It's saved when you save the project file itself, use Save All or if you don't do that and try close the solution, you'll get a dialog about unsaved changes. What works:
What doesn't work:
My local commit: https://github.com/MarcinJuraszek/VisualFSharpPowerTools/commit/ec91326d1be22c54290d9ebd7b5bf7ec9bf5e35e |
eh, the more I dig into this the less convinced I am about the entire concept of folders. Either there are some really serious issues with how Solution Explorer handles folders in F# projects or I'm just missing something. e.g. seems like folder name must be unique in the entire project - work just fine, as long as the entire hierarchy does not contains two folders with the same name
works just fine but as soon as you change
or add another one called
|
I believe that's a poorly implemented check in the Visual F# Tools (not intrinsic to VS). We may just have to live with that limitation for now (folder support would still be immensely useful even with limitations like this) |
Just an idea, but in the same spirit as this suggestion http://visualstudio.uservoice.com/forums/121579-visual-studio/suggestions/4512873-vs-ide-should-support-file-patterns-in-project-fil. What if the approach was to rely on the filesystem entirely and call refresh on the project item to ensure the IDE represented the latest changes? So add folder would only add the folder to the filesystem and refresh the project. Same for rename. Make sense? Bad idea? |
@dsyme So maybe we should stick to stuff that works, e.g. New Folder on project level only + Move Folder Up / Move Folder Down. This way if someone will try to add nested structure using existing VS UI (as soon as there is at least one folder, you can add subfolders from UI) or modifying project file manually it will be up to VS if it works or not. We could also introduce additional validation to check if there is already a folder with given name in the entire project when user tried to add new one using F# Power Tools -> New Folder option. @CoreyKaylor I'm not sure how that could be implemented without reimplementing entire |
@MarcinJuraszek We could also introduce additional validation to check if there is already a folder with given name in the entire project when user tried to add new one using F# Power Tools -> New Folder option. Yes please! |
@MarcinJuraszek Thank you for the investigation. It's valuable to know what works and what doesn't wrt folder organization. I read your blog post; it's very helpful indeed. I also support a small set of features which work correctly. We shouldn't attempt to alter linear order of F# files or invent a new F# project system. Until F# project system gives more flexibility in folder handling (e.g. separating between compilation order and file order), even a simple support for folder organization is a good step forwards |
I've added project-wide validation to the dialog, removed Rename command and did some cleanup. Check the lasted checkin: https://github.com/MarcinJuraszek/VisualFSharpPowerTools/commit/9e69e6b76551afacfc0b359e1e933b0bf13271d4 |
Fantastic work! |
Yes, awesome to see this get pulled in! |
Seems like an obvious feature... Are people not really using VS for most of their work with F#? Is the tolerance for pain just high and most don't mind the workarounds involved to organize their projects? I know my tone is trollish in nature, but I'm legitimately curious to see how others are dealing with this.
The text was updated successfully, but these errors were encountered: