contextValue

external var contextValue: String?(source)

Context value of the timeline item. This can be used to contribute specific actions to the item. For example, a timeline item is given a context value as commit. When contributing actions to timeline/item/context using menus extension point, you can specify context value for key timelineItem in when expression like timelineItem == commit.

    "contributes": {
"menus": {
"timeline/item/context": [
{
"command": "extension.copyCommitId",
"when": "timelineItem == commit && !listMultiSelection"
}
]
}
}

This will show the extension.copyCommitId action only for items where contextValue is commit, and only when a single item is selected.

Commands contributed to timeline/item/context are run with the following arguments:

  1. The TimelineItem the command was run on.

  2. The Uri of the file or folder whose timeline is shown, or undefined for the workspace timeline.

  3. The id that the provider of the item was registered with, see workspace.registerTimelineProvider.

  4. If the item is part of a multi-selection, all selected items from the same provider, including the first argument. Otherwise undefined.

Commands contributed by other extensions receive read-only copies of the items, with all properties except command. The extension that provided the items receives the original objects.

Online Documentation