Skip to content
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 to "Scope to this" in explorer #41860

Open
darkoromanov opened this issue Jan 19, 2018 · 28 comments
Open

Allow to "Scope to this" in explorer #41860

darkoromanov opened this issue Jan 19, 2018 · 28 comments
Assignees
Labels
feature-request Request for new features or functionality file-explorer Explorer widget issues
Milestone

Comments

@darkoromanov
Copy link

darkoromanov commented Jan 19, 2018

I'd like to have the "scope" feature in the tree view to "isolate" a directory in order to have a "cleaner" view. For example, if my project root directory has 2 main sub-directories: "public" and "admin":

  main-dir

      \___ admin

      \___ public

and I want to work only to the "public" directory I'd right-click the "public" directory in the tree view and choose "Scope to this" and then the tree view would show only the "public" directory.

@jrieken
Copy link
Member

jrieken commented Jan 19, 2018

I believe with filters you can do that...

@bpasero
Copy link
Member

bpasero commented Jan 19, 2018

No, with filters you could only exclude (= hide). I think this is a fair feature request.

@bpasero bpasero changed the title Feature request: scope in tree view (like VS) Allow to "Scope to this" in explorer Jan 19, 2018
@bpasero bpasero added feature-request Request for new features or functionality file-explorer Explorer widget issues labels Jan 19, 2018
@bpasero bpasero removed their assignment Jan 19, 2018
@chrisdias
Copy link
Member

In the meantime, this extension will let you right click on a folder and quickly open a new instance scoped to that folder:

https://marketplace.visualstudio.com/items?itemName=chrisdias.vscode-opennewinstance

@zumpiez
Copy link

zumpiez commented Mar 10, 2018

Some other issues that I think are asking for the same thing:
#17696
#31368

Hopefully if this is closed, there will be some additional discussion rather than a bot swooping in 😄

@eiva
Copy link

eiva commented Mar 12, 2018

After adding workspaces and the ability to specify common project configuration into workspace config "scope to this" become my "most wanted" feature: having dozens of projects in the workspace make navigation not really easy, and opening specific project in a new instance of VSCode is not fun as most of configs will not be loaded.

@CombeeMike
Copy link

CombeeMike commented Jun 6, 2018

We'd also appreciate such a feature very much for the following environment:

We have one large workspace which holds many small projects. Most projects only contain 1 - 3 JS files/modules.

Obviously working on 1 project, the file explorer is very "cluttered" with irrelevant stuff.

Creating a dedicated workspace per project is no option since it would mean too much administration overhead since they all share a common set of settings like VSCode workspace settings, "top level" typings, jsconfig.json, .editorconfig, .gitignore etc.

This was referenced Jul 23, 2018
@isidorn isidorn removed their assignment Jul 25, 2018
@isidorn isidorn added this to the Backlog milestone Jul 25, 2018
@tiborgg
Copy link

tiborgg commented Sep 28, 2018

This feature would be greatly appreciated, given that as far as I can tell, monorepo project structures have gained some traction (recently switched to it myself), and most of the time you're working within a particular package, but occasionally you need to go to another package (shared, common, etc) or configure something for the entire project.

@chrisuehlinger
Copy link

Just wanted to give a use case I have for this: I currently have a mono-repo with two Node.js apps and two React apps. Nowadays, a lot of people (myself and my React generator included) mark JSX files with *.js extensions. For the sake of formatting and so on, I'd like to have the following settings scoped to the folders for my React apps:

"files.associations": {
  "*.js": "javascriptreact"
}

@ryancole
Copy link

ryancole commented Oct 4, 2018

This is huge for Unreal Engine projects, in which there are a bunch of other folders and you're only interested in the source code folder.

@johnhamm
Copy link

Any status on this feature?

@nurbles
Copy link

nurbles commented Jan 17, 2019

[Currently using VS Code Version: 1.31-0-insider on Ubuntu 18]

Rather than at a directory level, I am interested in a grouping function within a single folder by different types of files. For example, with a configuration something like this (instead of or in addition to files.exclude):

"files.groups": {
  "source": {
    "**/*.c": true,
    "**/*.h": true
  },
  "scripts": {
    "**/!(*.*)": true,
    "**/*.code-workspace": false,
  },
  "settings": {
    "**/*.json": true,
    "**/*.code-workspace": true,
    "**/.vscode/*": true
  }
}

(NOTE The "**/!(*.*)": true entry in scripts was supposed to match any file without a dot in the name.)

Then the explorer sidebar could show three sub-groups, "source", "scripts", and "settings" that may be expanded to see the matching files. This could even allow some files to appear in multiple groups and others to never appear. If there is already an extension that provides this, please point it out because I was unable to locate it.

@LC43
Copy link

LC43 commented Feb 4, 2019

this is one of the missing featured i loved back in the days when i used to program with Aptana Studio.

i work mostly with wp, so i tend to work with multiple plugins and theme. It would help immensely being able to "scope in" and out a directory.

usual structure is:

main dir

  • themes

    • themeA
  • plugins

    • pluginA
    • pluginB
    • ...

like it was mentioned before, having a workspace for each dir wouldn't help, as it would lose the git directory, the linting files etc

@johnhamm
Copy link

johnhamm commented Mar 7, 2019

In the meantime, this extension will let you right click on a folder and quickly open a new instance scoped to that folder:

https://marketplace.visualstudio.com/items?itemName=chrisdias.vscode-opennewinstance

The issue I had with solving it this way is that all relative includes can no longer be found in vscode IDE.

import { MyService } from 'core/services/myservice.service

Since the current base directory has now changed, you get red squiggly lines and errors on all imports formatted as above.

Really looking for a status on this feature, or if there are any new extensions being built that take advantage of vscode's new tree API that could possibly implement this?

@LucaGabi
Copy link

I would also be happy with something as "perspectives" in Eclipse IDE and a fast switch shortcut what do you think ?

@LucaGabi
Copy link

Please also read this:

#95182

@mika76
Copy link

mika76 commented Apr 15, 2020

All the ticket #95182 needs is 20 upvotes (18 more) and it will go into backlog! Please go and vote...

@daniel-keen
Copy link

Yes please

@omeraksu
Copy link

omeraksu commented Dec 1, 2020

++

@rhalaly
Copy link

rhalaly commented Jun 17, 2021

I was tired of waiting, I hope that this extension will help you meanwhile until the VSCode team will implement it

@JacksonKearl
Copy link
Contributor

Similar to #67988

@prateek
Copy link

prateek commented Mar 18, 2023

I was about to create a feature request for something quite similar, but I'm going to add my notes here because it seems to be where all other similar/closed issues point to.

I propose we should solve a slight generalization of the original ask: The ability to define groups of (include+exclude) search filters in the Search (⌘⇧F) view. VSCode currently supports the specification of a (include+exclude) but I find I'm often changing these to toggle searches between scopes such as:

  1. Only the *.go source code (without tests) in my workspace (ignore vendor/etc)
  2. Same as 1. but include tests.
  3. Same as 2, but focus only on tests this time.
  4. Search all *.go files including vendor/etc
  5. Search all config files (.yaml/.star/etc) files
  6. Search all files not in vendor/etc
  7. Search all text files (.md/.markdown/*.txt) not in vendor/etc

I'd like the option to define/maintain such groupings, and reference them in the Search view. For an example implementation of what I'm asking for -- look at https://www.jetbrains.com/help/idea/settings-scopes.html.

The closest workaround I've found thus far is https://github.com/sfccdevops/explorer-exclude-vscode-extension. Please let me know if I can provide any further information.

edit: I stumbled up on #73524 from @roblourens's comment. Is that the missing piece holding this back?

@kobenauf
Copy link

kobenauf commented Oct 9, 2024

I was coming here to request essentially the same idea. I was going to request that if the Explorer has a workspace open, that I can select one or multiple folders in that workspace, right click, and choose Focus This. That would leave the others visible but grayed out, and open files from other folders would be closed, and searches would be restricted to the focused folders. I'm not sure if graying out the excluded folders is the best approach... maybe moving them to a new section at the top called Hidden Folders.

@rhalaly
Copy link

rhalaly commented Oct 9, 2024

I was tired to waiting for official VSCode support so I made an extension to support "Scope to this" in the explorer:

https://marketplace.visualstudio.com/items?itemName=rhalaly.scope-to-this

@lonix1
Copy link

lonix1 commented Oct 14, 2024

That is a nice extension, but users be warned: it manipulates file.exclude in settings.json. Extensions which change that setting will break your customisations. If you haven't customised it, then that extension is quite useful.

A built-in way is preferable.

@rhalaly
Copy link

rhalaly commented Oct 14, 2024

@lonix1 I mentioned it directly in the README. So no surprizes here. Please note that the extension will not override your customizations if you manually change file.exclude in settings.json. If that happened please open an issue ticket on my github

@lonix1
Copy link

lonix1 commented Oct 14, 2024

True, but I mentioned it because when someone creates an extension for a missing vscode feature, they tend to close the feature request. In this particular case, the extension is good, but it doesn't suit everybody. So as I said, we still need a built-in way.

@rhalaly
Copy link

rhalaly commented Oct 14, 2024

@lonix1 agree with that. That extension is a work-around until the feature will be built-in in VSCode. It has known issues due to lake of support for that feature in VSCode core. file.exclude is not the right way to do that.

@ravindUwU
Copy link

A few thoughts for when this is implemented 🤔,

  • When scoped, the "Go to File..." (Ctrl+P) menu should probably only list files within the scope (equivalent files.exclude-ing everything out of scope).

  • When scoped, new terminals (Ctrl+`) should probably be opened to the scoped folder.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request Request for new features or functionality file-explorer Explorer widget issues
Projects
None yet
Development

No branches or pull requests