Skip to main content

activityBarAPI

MS Code Extension API


MS Code Extension API / core/extensionAPI/modules/window/activityBarAPI

core/extensionAPI/modules/window/activityBarAPI

Functions

createActivityBarAPI()

createActivityBarAPI(extId): object

Defined in: core/extensionAPI/modules/window/activityBarAPI.ts:12

Factory function to create the Activity Bar API. Enables extensions to contribute icons to the primary side container (Activity Bar). *

Parameters

extId

string

The unique identifier of the extension.

Returns

createActivityBarItem

createActivityBarItem: (options) => object

Adds a new item/icon to the Activity Bar. Items registered here typically represent primary views (like Explorer, Search, or Git). *

Parameters
options

Configuration for the activity bar item.

icon

string

The icon name or path to display.

id

string

Local identifier for the item.

onClick?

() => void

Optional callback triggered when the icon is clicked. *

title

string

Tooltip and accessible name for the icon.

Returns

A disposable object to remove the item from the Activity Bar.

dispose

dispose: () => void

Unregisters the item and refreshes the Activity Bar UI.

Returns

void

Example
const myView = mscode.window.createActivityBarItem({
id: 'my-plugin-view',
title: 'Plugin Manager',
icon: 'package',
onClick: () => console.log('View opened')
});
*
onDidChangeActivityBarItems

onDidChangeActivityBarItems: (handler) => object

Fired when the list of Activity Bar items changes (e.g., when an item is added or removed). *

Parameters
handler

(items) => void

Callback function receiving the updated array of ActivityBarItem objects.

Returns

object

An object with a dispose method to unsubscribe from the event.

dispose

dispose: () => void

Returns

void