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

Add vscode.window.activeFolder #15991

Closed
leotm opened this issue Nov 23, 2016 · 13 comments
Closed

Add vscode.window.activeFolder #15991

leotm opened this issue Nov 23, 2016 · 13 comments
Assignees
Labels
api feature-request Request for new features or functionality *out-of-scope Posted issue is not in scope of VS Code

Comments

@leotm
Copy link

leotm commented Nov 23, 2016

To open git-bash.exe at the active folder (like Git and GitHub Desktop).

Works 👌 for activeTextEditor

VS Code Marketplace: McCarter.start-git-bash
Repo: vscode-start-git-bash by @Robert923

#3553 and #2067 are similar to this specific request, but not quite.

@bpasero
Copy link
Member

bpasero commented Nov 24, 2016

Isn't that workspace.rootPath?

@jrieken
Copy link
Member

jrieken commented Nov 24, 2016

My understand is that it's the selected folder in the explorer. @leotm Please clarify

@leotm
Copy link
Author

leotm commented Nov 24, 2016

@bpasero nope.
@jrieken indeedy.

@fgodoy
Copy link

fgodoy commented Jun 28, 2017

Hi guys, any news when this feature will be available? Any other way to get current selected folder?

Thanks.

@ole1986
Copy link

ole1986 commented Nov 9, 2017

I woudl prefer to have vscode.activeWorkspaceFolder - Especially with the new vscode update 1.18 allowing to add multiple folders in workspace

@jrieken
Copy link
Member

jrieken commented Nov 9, 2017

Any other way to get current selected folder?

Kind of... You can register commands for the explorer context menu. When being selected the resource/uri of the item in question is being passed as argument. It's not really the explorer-tree-selection but contextual and well-integrated with our commands.

@MicroCheapFx
Copy link

Few hints if someone want to do it (or note for me later) :

  • \vscode\src\vs\vscode.d.ts <= Declarations
  • \vscode\src\vs\workbench\api\node\extHost.api.impl.ts <= Definitions

This API would be REALLY helpful...

@seesharper
Copy link

seesharper commented Mar 2, 2018

Is it possible to ONLY have a context menu item without it ever showing up in the command palette?

UPDATE:

            "commandPalette": [{
                "command": "somecommand",
                "when": "1 == 2"
            }]

@poalrom
Copy link

poalrom commented Jul 2, 2018

How can I get selected folder if command runs using keybind? Function's params will be null

@HenrikHolmIT
Copy link

I need this feature now. Has it ever been implemented or is there another way to get the selected items in the explorer view?

I need to search for specific files but only in the currently selected folder.

@jrieken jrieken added the *out-of-scope Posted issue is not in scope of VS Code label Oct 21, 2019
@vscodebot
Copy link

vscodebot bot commented Oct 21, 2019

We closed this issue because we don't plan to address it in the foreseeable future. You can find more detailed information about our decision-making process here. If you disagree and feel that this issue is crucial: We are happy to listen and to reconsider.

If you wonder what we are up to, please see our roadmap and issue reporting guidelines.

Thanks for your understanding and happy coding!

@vscodebot vscodebot bot closed this as completed Oct 21, 2019
@HenrikHolmIT
Copy link

This seems like such an easy low hanging fruit to harvest.

The extension we're developing has to do stuff to files located in the currently selected folder. Currently we're trying to guess that folder by looking at the file currently being edited. That's not a particular safe way of doing it but currently the only way.

It would be much more safe to have it handled by VS Code generally.

I'd like very much for you to reconsider opening this case again. To me sounds like a really easy thing to implement but I have no idea how the internals of vscode module is made.

@rndware
Copy link

rndware commented Dec 1, 2020

Any other way to get current selected folder?

Kind of... You can register commands for the explorer context menu. When being selected the resource/uri of the item in question is being passed as argument. It's not really the explorer-tree-selection but contextual and well-integrated with our commands.

Yeah but the resource/uri of the item in question is not passed if you're running the extension though a keyboard shortcut.

So lets say you're on the explorer view and you press enter on a folder. Next you use a keyboard shortcut to run an extension you've made, it won't pass that URI as a param.

Which means you're forced to run the extension via a mouse click... which I try to avoid if at all possible :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api feature-request Request for new features or functionality *out-of-scope Posted issue is not in scope of VS Code
Projects
None yet
Development

No branches or pull requests

10 participants