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

Implement conditional visibility for custom views #29436

Closed
sandy081 opened this issue Jun 26, 2017 · 4 comments
Closed

Implement conditional visibility for custom views #29436

sandy081 opened this issue Jun 26, 2017 · 4 comments
Assignees
Labels
api tree-views Extension tree view issues verification-needed Verification of issue is requested verified Verification succeeded
Milestone

Comments

@sandy081
Copy link
Member

Ability to define a condition when a custom view can be visible or not

@vscodebot vscodebot bot added the api label Jun 26, 2017
@sandy081 sandy081 self-assigned this Jun 26, 2017
@sandy081 sandy081 added the tree-views Extension tree view issues label Jun 26, 2017
@sandy081 sandy081 added this to the June 2017 milestone Jun 26, 2017
@sandy081
Copy link
Member Author

Implemented as part of #27823

@sandy081 sandy081 added the verification-needed Verification of issue is requested label Jun 26, 2017
@sandy081
Copy link
Member Author

To verify:

  • Contribute a custom view using extension point views
  • Implement and register a tree data provider to this contributed view using the API.

Or you can use our samples here - https://github.com/Microsoft/vscode-extension-samples/tree/master/tree-view-sample

Verify that views are shown / hidden based on the when context value you provide while contributing the view.

@weinand weinand added the verified Verification succeeded label Jun 28, 2017
@weinand
Copy link
Contributor

weinand commented Jun 28, 2017

@sandy081 I verified with my Loaded Scripts Explorer and it works great!

"views": {
	"explorer": [
		{
			"id": "extension.node-debug.loadedScriptsExplorer",
			"name": "Loaded Scripts",
			"when": "inDebugMode && debugType == 'node'"
		}
	]
},

@orta
Copy link
Contributor

orta commented Oct 2, 2017

If like me you're trying to figure out how to make your viewport only show up if when your extension has declared something loaded, the key is using the "setContext" command: vscode.commands.executeCommand("setContext", "is-running-storybooks-vscode", true) which you can then use inside a "when":

    "views": {
      "explorer": [
        {
          "id": "storybook",
          "name": "Storybook",
          "when": "is-running-storybooks-vscode"
        }
      ]
    }

( Figure it out by reading this example )

@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 17, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
api tree-views Extension tree view issues verification-needed Verification of issue is requested verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

3 participants