Skip to content

Commit

Permalink
added control of which context menus the "Add to * favorites" command…
Browse files Browse the repository at this point in the history
…s will appear in via settings

`favorites.includeInDocumentBodyContextMenu` : boolean (default `false`)
- if set to `true`, the two "Add to * favorites" commands will be included in the editor context menu that appears when right-clicking the body of an open document.

`favorites.includeInEditorTabContextMenu` : boolean (default `true`)
- if set to `true`, the two "Add to * favorites" commands will be included in the context menu for the tab of a specific file (e.g. the menu that appears when right-clicking the tab of an open document).
  • Loading branch information
CommanderPho committed Sep 15, 2022
1 parent 8b55c00 commit 593d59f
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 4 deletions.
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,12 @@ Open Visual Studio Code press CTRL+p and type or copy and paste:
`favorites.useTrash`: boolean (default `false`)
- if set to `true`, extension will try to use system trash when resource (file or directory is deleted)

`favorites.includeInDocumentBodyContextMenu` : boolean (default `false`)
- if set to `true`, the two "Add to * favorites" commands will be included in the editor context menu that appears when right-clicking the body of an open document.

`favorites.includeInEditorTabContextMenu` : boolean (default `true`)
- if set to `true`, the two "Add to * favorites" commands will be included in the context menu for the tab of a specific file (e.g. the menu that appears when right-clicking the tab of an open document).

## Keyboard browsing

You can browse favorites using **keyboard only** by executing command `Favorites: Browse` command from palette. Assign keyboard shortcut if needed.
Expand All @@ -89,9 +95,9 @@ You can browse favorites using **keyboard only** by executing command `Favorites
## Usage

#### Adding to favorites
Right-click item in File explorer and select `Add to favorites`.
Right-click item in File explorer, an open file tab, or the background of an open editor and select `Add to favorites`.
#### Adding to favorites group or subgroup
Right-click item in File explorer and select `Add to favorites group`, then select group from list.
Right-click item in File explorer, an open file tab, or the background of an open editor and select `Add to favorites group`, then select group from list.
#### Removing from favorites
Right-click item in Favorites view and select `Remove from favorites`
#### Create favorites group
Expand Down
16 changes: 14 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,16 @@
],
"default": "ASC",
"description": "Specify an order for all favorites"
},
"favorites.includeInDocumentBodyContextMenu": {
"type": "boolean",
"default": false,
"description": "Display the 'Favorites: Add to * favorites' commands in the editor context menu"
},
"favorites.includeInEditorTabContextMenu": {
"type": "boolean",
"default": true,
"description": "Display the 'Favorites: Add to * favorites' commands in the context menu for the tab of a specific file"
}
}
},
Expand Down Expand Up @@ -148,22 +158,24 @@
],
"editor/title/context": [
{
"when": "config.favorites.includeInEditorTabContextMenu",
"command": "favorites.addToFavorites",
"group": "favorites"
},
{
"when": "config.favorites.includeInEditorTabContextMenu",
"command": "favorites.addToFavoritesGroup",
"group": "favorites"
}
],
"editor/context": [
{
"when": "resourceScheme == file",
"when": "config.favorites.includeInDocumentBodyContextMenu && resourceScheme == file",
"command": "favorites.addFileToFavorites",
"group": "favorites"
},
{
"when": "resourceScheme == file",
"when": "config.favorites.includeInDocumentBodyContextMenu && resourceScheme == file",
"command": "favorites.addFileToFavoritesGroup",
"group": "favorites"
}
Expand Down
2 changes: 2 additions & 0 deletions src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ export interface WorkspaceConfiguration {
storageRegistry: string[];
groupsFirst: boolean;
sortDirection: "ASC" | "DESC";
includeInDocumentBodyContextMenu: boolean;
includeInEditorTabContextMenu: boolean;
}

export interface StoredResource {
Expand Down

0 comments on commit 593d59f

Please sign in to comment.