-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Add dotnet add file
#11513
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add dotnet add file
#11513
Conversation
|
🛎️ |
|
Sorry I missed the notification. |
|
@KathleenDollard what do you think about this PR |
|
Thank you for the contribution! My concerns:
|
|
I like the idea, but want to understand the impact and work out the full syntax. This might be better done in an issue, if you open one and reference it I'll move further comments there. (Separating the idea from this specific PR). @Krzysztof-Cieslak could you mock up the help (use @Krzysztof-Cieslak, @cartermp and other F# folks could you comment on the value of this in F#
Everyone:
|
Sure, as I've mentioned above - actually interesting things are:
But I've implemented just simplest thing to see how difficult it would be, and just use it as a starter for discussion. It would be probably not worth to add only what is currently in this PR.
What are tests? 🙃 (again, it's just proof of concept, we can work on that later if you decide you want this feature in) |
I think it will be useful to the subset of C# developers that disable globbing. We should probably make |
|
Expanding on what @terrajobst said, I'm imagining this might be even more useful/impfactful if it was a cmd for manipulating items in the project file, with full MSBuild semantics, so you could for example do:
In an ideal world, this would be an MSBuild operation so it could evaluate the current state and apply the intent of the commands in the most efficient way possible, or provide warnings and errors immediately if it would result in a build error, e.g. when trying to include items that are already included and suggest doing an update instead. |
|
I would find this useful even in it's current state. I remove or rename a file about 1% of the time I create new files. Moving up and down could be useful - perhaps at the time of adding you select an existing file you want it to live above or below (and this could also be a move file command) but for now just dotnet add would be a nice start. Regarding confusing C# devs, notwithstanding Immos point, perhaps we could make this only work with fsproj files and return a suitable error message. MSBuild sounds like a bigger piece of work though 😉 |
|
For F#, adding a file should add it to the top of the scope. This can get trickier and tricker if you consider the intersection of all of these:
It ended up being an enormous amount of code to support everything in VS. Luckily, this isn't VS. Adding a single file to the top of the current scope that matches the directory you're in would be more than enough. |
I personally won't comment about this functionality from C# point of view, this repo is the first C# project I've opened in a few years :-)
This is the current state of help in this PR: Optimally it would include also include something like the following options:
I agree with @cartermp - from F# point of view, the default should be at the top of the current scope
Potentially yes, I guess. There also exists
Yes, I think
Neither of other
As far as I understand this codebase it's not a case for |
|
I don't think |
|
any thoughts? |
|
Closing due to no recent activity. Feel free to open an issue or new PR to continue the design discussion. |
This is more a proof of concept and a start of discussion rather than complete implementation. So... as in title - it extends current
dotnet CLIwithdotnet add file.This feature is probably mostly useful for F# developers - in C# users can use globbing, but in F# order of files in project matters - so we specify every
.fsfile separately in the project file. Having this feature will be also great for better editor integration - VSCode (with Ionide) is used by a huge part of the F# community and we provide "solution explorer" view in the editor but we need good commands to add files and/or move the up-down (again the order of files matters) - we currently provide that functionality using a custom utility (https://github.com/ionide/Forge) but... well, let's just say it's not my best work ever.So there's a couple of things to discuss here:
--aboveand--belowoptions that would allow specifying a location of the file (it's a common scenario to say "I want to add helpers.fs above my_test.fs")CC: @cartermp
P.S. the changes include all generated translation files, please let me know if they shouldn't be included in PR - there's no contribution guide in the repo that would specify such details ;-)
P.S.2
Even tho, it's proof of concept it actually works ✨