-
Notifications
You must be signed in to change notification settings - Fork 28.3k
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
Allow a workspace to show individual files from other folders #45177
Comments
I seem to be able to add files to the 'workspace' by just using file > open. However, they don't show in the workspace side bar, so can't do things like rename when doing versioning numbers. Also 'gitlens' doesn't seem to track them either. |
Or, to put this in different words: |
I've had the same issue this week where I've altered the structure of my solution so that i only have single package.json and tsconfig.json in the root of my solution, where previously there were multiple of both package.json and tsconfig.json located inside of a corresponding 'App' folder, this meant in my workspace i could add each 'App' folder and vscode would be happy - no errors. Now that I've changed the structure to have a single package.json and tsconfig.json which handles each app the workspace does not include the files due to them now being located in the root which leads to ts errors in my files. The only workaround i have currently is to include my entire solution which isn't very desirable. Having the ability to add individual files to the workspace means i could retain a workspace that only has my desired files in but means i could include the necessary files to not have errors. |
|
Yes please. Due to the setup of the repository I'm working in, a particular project might have its own subfolder but also has to have a package file at root-level. Would be great to have the package as part of the workspace. |
And i would say even more. Due to the project specific that i'm working on, i have several c# projects in the several folders that included into one visual studio solution. And there are hundreds of xml files in this folders that can't be made as part of solution. |
I am closing this "as designed". This is not a scenario we will support anytime soon. Please also see https://github.com/Microsoft/vscode/wiki/Issue-Grooming#out-of-scope-feature-requests |
It's ridiculous that you aren't doing this. Not doing it defeats most of the purpose of having workspaces. |
@bpasero I have to wonder if the bar isn't being set a bit high. There's an under-diiscussion label for bugs. Maybe the same is required for feature request. @Others since contributing to this thread have wondered at times if it is actually desirable:
|
Looking at the criteria in https://github.com/Microsoft/vscode/wiki/Issue-Grooming#out-of-scope-feature-requests, I'm a little confused why this was closed.
This doesn't really seem to be a criterion on its own. It's very dependent on (2) and (3).
If allowing some loose files or folders at the same level as project folders has a particular high cost, it would be helpful to get a brief explanation why that is the case. The project folders themselves would seem much more complicated to implement, given all the special UI treatment they get. I would also argue that allowing a .vscode folder for the whole workspace, rather than embedding settings and launch configuration into the code-workspace file and ignoring certain settings set at the project-level that conflict (like zoom), you would end up with a much cleaner, "fully baked" system.
This post has 28 upvotes in the last seven months and this comment will be the 10th. Would the team consider giving this one more look? EDIT: better make that 125 votes and counting, as of 11 MAY 2020. |
30th Upvote. I was very glad to start using workspaces, instead of having my entire root folder in VS Code which has word documents and crap. I was able to just have the main folders I code in (Web, API, and DB for this main project I'm on). I was surprised to find I couldn't add a couple other files to the workspace that would be nice to show up right next to the main folders. Specifically Readmes would be nice and also I like to put the API .sln there so I can quickly go to view it in explorer and open it in VS (I avoid going in there). Anyway, this seems like it would obviously be on the roadmap to go along with Workspaces as they are. If there's a ton of other backlog more important I'd get a delay but to close this seems wrong. If a workspace files feature is so far down on the list that it will never get done, then workspace folders should be right there with it and shouldn't have been done. I'm not following the logic that implementing with folders was important enough to do and just stop there... |
Thanks for suggesting Symlinks, I ended up going this route as well for a workaround and it's not too bad, basically achieves what I was trying. I added a "Links" folder to my workspace which just has a list of Symlinks to files I wanted to include in the workspace. |
There does seem to be interest for this feature. |
@MrGoDuck @TuxVinyards Yeah, that would work and offers plenty of flexibility - I would absolutely be in favor of that. PS - My hard links are breaking (not sure which app is overwriting files but it happens - I hope it's not VS Code). So I had to get rid of my "Links" folder. I am back to just searching for the files I'm looking for when I'd ultimately like hard links in the root, included in the workspace. Ex of the ideal: API A bit unrelated but it seems like VS Code might be the one breaking my hard links...! I had the two links in a "Links" folder included in the workspace and it was working perfectly for a session and then broke. I didn't open the files in any other app. |
@MrGoDuck Sounds like the start of an algorithm. What are you like at Typescript? Might work adding lines to the .jsn. manually .. Not tried the above. @MrRobboto my symlinks method is still working for me. Maybe VS Code doesn't play nicely with links? I have only 'real' files in the working folder. The outside files as links works but does have limitations. Maybe an OS issue? |
I found it hard to believe I could not add files to my workspace. Please reconsider this feature request. |
I too found it ridiculous that this was not a feature. |
Yes. Please add the ability to add individual files to the workspace. |
+1 |
Please add the ability to add individual files to the workspace by some pattern (e.g. *.txt).
Thank you.
Best regards,
Ivan Grechko
On Wed, Nov 28, 2018 at 11:25 PM +0300, "safield" <notifications@github.com> wrote:
+1
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
+1 MS PLZ I have a walk around:
|
@EstevezCarlos |
From your reply, I understand the main problem is explaining to users how the "files" workspace would work. |
I think a good metaphor for this problem is git and its sparse-checkout feature. A git repo has a root, but when you sparsely checkout the tree, you have a filtered view of that tree on disk. The sparse checkout list is a list of file path patterns that essentially filter the view. Applying this metaphor to vscode, the top level schema of multiple-roots can be maintained as-is; your multi-root workspace is still a set of root directories. But now you would have the ability to filter which files are visible to (and within) vscode for each of those directories. If you want individual files, you add the root directory containing it, then specify a filter. If there was an "add individual file" feature (which isn't technically required), it would be translated into this process. |
I think most issues start like that but almost all changes have an impact on UX. We cannot just ignore the UX problem when we fix a "functional" issue. I think I made the UX challenge clear in my comment, so I will not repeat it. But maybe I add a point to it: workspace files can be crafted by someone that understands the concepts but then used by many that do not. We try to make workspace files as simple as possible to reduce the friction.
👏 , I think we are getting somewhere constructive. I think #869 will help here a lot and I agree it is needed for this purpose.
Can you give me an example of a "rudimentary" editor to look at? Maybe there is another solution possible that does not involve making changes to workspace files?
Maybe, but then on the other hand I think a workspace file can be used for this in combination with #869, so we would not have to bring in another concept? You can even change the name of the workspace folder in the
Yes, we support that but limited to folders only for the sake of simplicity. |
I agree about the importance of UX, but I think this problem is very solvable without compromising UX. Basically, what we want is a multi-item workspace (where an item is either a folder or a file). Details:
*Before completing this (potentially confusing/destructive) operation, an explanatory dialog would appear (with the option to "never show this again"). This already exists for dragging files around within a root folder. What about your concerns?
|
I agree that UX is very important and one of the biggest strengths of VSC, imho. However, your statements sound like you don't consider any functional changes that might entangle modifications/challenges for the UI categorically. Of curse, any functional change must be communicated clearly to the user to be useful. That said, deliberately not supporting files is a "feature" that needs to be communicated to users as well. But as this thread and the other one you pointed out (#869) show, communication in this regard is clearly lacking. Everyone understands the concept of files and folders, but nobody seems to understand, why VSC does not intent to support files the same way as folders, causing a sort of "friction". Perhaps there are reasonable arguments for this decision, but so far they have not been communicated clearly (for 7 years!). As mentioned earlier, Notepad++ supports this feature as a simple editor. QtCreator is a more sophisticated example, supporting this as well. The approaches they take are rather cumbersome, imho, and I definitively prefer the JSON-based method of VSC. Perhaps you should have a look at SublimeText. In any case, a solution to this issue will most certainly involve changes to workspace files, simply because it is about the contents of workspaces. |
@tschoepping it is probably not a secret that multi root workspace files were inspired by Sublime Text Projects and thanks for pointing out to revisit their documentation. From https://www.sublimetext.com/docs/projects.html I see no evidence that I can add files to a project. From my testing I am not able to add loose files either. However what I find cool is support for configuring what to include/exclude in any of the roots. So given a project config of this: {
"folders":
[
{
"path": "/Users/bpasero/Desktop/test-ts",
"file_include_patterns": ["package.json"],
"folder_exclude_patterns": ["**"]
},
{
"path": "/Users/bpasero/Development/Microsoft/vscode"
}
]
} The result will be: I find this a good approach and it goes into the direction of what I had mentioned in #869 What is missing in VS Code to support this is:
[1] since glob patterns are evaluated relative to the root folder, we need to come up with some syntax to let a glob pattern target one of the root folders, for example:
|
FWIW I built a personal extension. Haven't posted it b/c of its limited scope, but the basic idea is this: The original plan was to create a panel whose file list would be populated
I got as far as the "Files" array, it worked, and discovered the others weren't even needed, at least not immediately, so to date haven't gone back and elaborated the extension. Haven't used the built-in Workspace panel since. In the end it would seem there's probably no need to even distinguish between "Folders" and "Files" or even a "Regex" arrays. They could all be listed in one array, and a bit of coding could figure it out. |
This comment was marked as duplicate.
This comment was marked as duplicate.
Thanks, @tschoepping, for the stack overflow answer. I have used it to do this walk arround : So I add the "folders" I want and the folder with everything too (the last "folder") Then I ignore everything except the ones I want. In this case "package.json" but It will be in another "workspace folder" (the one I named Project folder) |
I use projects with just a few files all the time - it is often required to make changes in a group of functionally related files that live in completely different places. Another common use is top level code (perl/python/bash etc.) that uses a relative library dir, but itself lives amongst a bunch of other executables. I am a recent convert to vs code after decades of using bbedit - for an example of how individual files can work easily and powerfully in a workspace, take a look at bbedit's implementation (they call them projects) - it is excellent and shows that it can be done without any UX confusion. I greatly prefer this approach over using hard or soft links as they always seem to bite me on the bum eventually... |
I would really appreciate it if you were to release this. |
I use this approach and I think it's not workaround. I think this is the correct way. This way, there's a choice whether user wants to use Multi Root Workspaces or not without headache. @bpasero, CMMIW but I think this approach should be on documentation. |
To me, it seems like a temporary workaround. The list of "files.exclude" could get very long and this setting applies to every folder so you could inadvertently exclude a "file" (or folder) somewhere else in your project. |
I agree, the whole reason for wanting to include only particular files is because of the swathe of other files in a folder I'd otherwise include. |
This looks like another workaround to me. |
Unbelievable that this isn't addressed yet |
Actually shocking that this isn't implemented yet. Seems so simple |
+1 would be great to see |
+1 - (Can't believe this has been open for 6 years O.o) I have a single folder "python" that I use to mount into a Docker container. The folder includes multiple files (the entire reason I need this feature):
and then I have multiple sub-directories that each have their own However, those launch configurations don't show up unless the folders are added as a multi-root workspace... Then the dillema is I can't see the files in the root "python" folder when I do that. (I currently have them inside of a single |
What kind of confusion would adding a feature that people have been asking for for years entail? Workaround: No confusion at all, but the extra effort should not be necessary. I should be able to add something like this to my.code-workspace: "folders": [ ], Could anyone explain why the vscode development community has been reluctant to add this feature? |
Update from @bpasero: this issue was renamed based on the discussion at the end (see #45177 (comment) and above)
Original below:
Steps to Reproduce:
N/A
Does this issue occur when all extensions are disabled?: Yes
Currently, .code-workspace only contains
folders
field which allows to add folders into workspace. I prefer a way to add single files into workspace for the entire project, such as README or something else.The text was updated successfully, but these errors were encountered: