GithubHelp home page GithubHelp logo

estruyf / vscode-extension-panel Goto Github PK

View Code? Open in Web Editor NEW
4.0 3.0 2.0 225 KB

An extension that provides an activity panel that other extensions can use to add their actions. When you want to visualize your command or extension actions, this extension provides a quick and easy way to do this. Instead of writing your view panel, you register your extension for panel usage with the required configuration.

Home Page: https://marketplace.visualstudio.com/items?itemName=eliostruyf.vscode-extension-panel

License: MIT License

CSS 12.09% TypeScript 64.49% JavaScript 23.42%

vscode-extension-panel's Introduction

VSCode Extensions Panel

An extension that provides an activity panel that other extensions can use to add their actions. When you want to visualize your command or extension actions, this extension provides a quick and easy way to do this. Instead of writing your view panel, you register your extension for panel usage with the required configuration.

sample

Usage

Extension dependency

First, you can take a dependency on this extension. It isn't a requirement, but when you do, you make sure this extension will get installed when your extension gets installed.

In your package.json add the following content:

{
  ...
  "extensionDependencies": [
    "eliostruyf.vscode-extension-panel"
  ],
}

Info: You can continue without this configuration. When the user doesn't have this extension installed, it will simply skip the visualization of your actions in a view panel.

Register your actions

The extension panel will look for a specific command in your extension and executes it. To define your actions, you will need to create the following command registration in your extension's code:

context.subscriptions.push(vscode.commands.registerCommand('<publisher>.<your-extension-name>.panel.registration', () => {
		return {
			id: '<your-extension-name>',
			title: 'Extension actions',
			description: 'Actions for testing purposes only.',
			actions: [{
				title: 'Action 1',
				command: 'vscode-extension-panel.panel.test',
				data: true,
				type: "checkbox"
			}, {
				title: 'Action 2',
				command: 'vscode-extension-panel.panel.test',
				data: 'Just extra text',
				type: "button"
			}]
		};
	})
);

Important: Update the <publisher> and <your-extension-name> values with the publisher and extension name of your extension.

Info: Whenever a file gets opened, the panel will call this command and allows you to dynamically define which actions you want to show per file, type, ... Example: An example integraton of this Extension Panel by another extension can be found in the Writing Style Guide. Find the code for this here: extension.ts - Lines 80-103.

Registration object

The registration object need to contain the following properties:

{
	id: '<your-extension-name>',
	title: '<your title>',
	description: '<your description>',
	actions: []
}
Actions

Actions contain the following properties:

{
	title: '<action title>',
	command: '<your command to execute>', // This is the command ID defined in your extension you want to execute
	data: '' | {} | [] | true/false, // This is an optional property. When using a "checkbox", you need to pass `true` or `false`. When using a button, this can be `any` type of data you want to pass. On a button click, the data will be passed to your command execution.
	type: "button" | "checkbox"
}

Feedback / issues / ideas

Please submit feedback/issues/ideas by creating an issue in the project repository: issue list.

Used by

Feel free to do a PR to add your extension to the list:

vscode-extension-panel's People

Contributors

estruyf avatar

Stargazers

Tommy Puglia avatar Edson S. avatar Klaus Ferreira avatar Software Nerd avatar

Watchers

James Cloos avatar  avatar  avatar

Forkers

huynp fairhopeweb

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.