Skip to content

Commit

Permalink
[git] Register favorite commands with new id. Added read-me #8400
Browse files Browse the repository at this point in the history
Signed-off-by: Dennis Hübner <[email protected]>
  • Loading branch information
dhuebner committed Apr 16, 2021
1 parent df0c56a commit 4f65f11
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 3 deletions.
5 changes: 5 additions & 0 deletions examples/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
-- Debug browser app

1. `yarn --cwd ./packages/git watch` (to watch TS changes in src -> compiles to JS into the lib folder)
2. `yarn --cwd ./examples/browser watch` (to watch for webpack. whenever the previous step modifies the packages in the lib folder, we regenerate the final bundle.js from the .js files for the app)
3. `yarn --cwd ./examples/browser start` to start the app.
4 changes: 2 additions & 2 deletions packages/core/src/browser/shell/tab-bar-toolbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -179,11 +179,11 @@ export class TabBarToolbar extends ReactWidget {
const paths: string[] = [];
for (let i = 0; i < split.length - 1; i += 2) {
paths.push(split[i], split[i + 1]);
// TODO order is missing, items sorting will be alphabetic
// TODO order is missing, items sorting will be alphabetic
toDisposeOnHide.push(this.menus.registerSubmenu([...menuPath, ...paths], split[i + 1]));
}
}
// TODO order is missing, items sorting will be alphabetic
// TODO order is missing, items sorting will be alphabetic
toDisposeOnHide.push(this.menus.registerMenuAction([...menuPath, ...item.group!.split('/')], {
label: item.tooltip,
commandId: item.id,
Expand Down
18 changes: 17 additions & 1 deletion packages/git/src/browser/git-contribution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ export namespace GIT_COMMANDS {
id: 'git.pull.default',
label: 'Git: Pull'
};
export const PULL_DEFAULT_FAVORITE = {
id: PULL_DEFAULT.id + '.favorite',
label: PULL_DEFAULT.label
};
export const PULL = {
id: 'git.pull',
label: 'Git: Pull from...'
Expand All @@ -69,6 +73,10 @@ export namespace GIT_COMMANDS {
id: 'git.push.default',
label: 'Git: Push'
};
export const PUSH_DEFAULT_FAVORITE = {
id: PUSH_DEFAULT.id + '.favorite',
label: PUSH_DEFAULT.label
};
export const PUSH = {
id: 'git.push',
label: 'Git: Push to...'
Expand Down Expand Up @@ -364,6 +372,10 @@ export class GitContribution implements CommandContribution, MenuContribution, T
execute: () => this.withProgress(() => this.quickOpenService.performDefaultGitAction(GitAction.PULL)),
isEnabled: () => !!this.repositoryTracker.selectedRepository
});
registry.registerCommand(GIT_COMMANDS.PULL_DEFAULT_FAVORITE, {
execute: () => registry.executeCommand(GIT_COMMANDS.PULL_DEFAULT.id),
isEnabled: () => !!this.repositoryTracker.selectedRepository
});
registry.registerCommand(GIT_COMMANDS.PULL, {
execute: () => this.withProgress(() => this.quickOpenService.pull()),
isEnabled: () => !!this.repositoryTracker.selectedRepository
Expand All @@ -372,6 +384,10 @@ export class GitContribution implements CommandContribution, MenuContribution, T
execute: () => this.withProgress(() => this.quickOpenService.performDefaultGitAction(GitAction.PUSH)),
isEnabled: () => !!this.repositoryTracker.selectedRepository
});
registry.registerCommand(GIT_COMMANDS.PUSH_DEFAULT_FAVORITE, {
execute: () => registry.executeCommand(GIT_COMMANDS.PUSH_DEFAULT.id),
isEnabled: () => !!this.repositoryTracker.selectedRepository
});
registry.registerCommand(GIT_COMMANDS.PUSH, {
execute: () => this.withProgress(() => this.quickOpenService.push()),
isEnabled: () => !!this.repositoryTracker.selectedRepository
Expand Down Expand Up @@ -595,7 +611,7 @@ export class GitContribution implements CommandContribution, MenuContribution, T
});

// Favorites menu group
[GIT_COMMANDS.PULL_DEFAULT, GIT_COMMANDS.PUSH_DEFAULT, GIT_COMMANDS.MERGE].forEach((command, index) =>
[GIT_COMMANDS.PULL_DEFAULT_FAVORITE, GIT_COMMANDS.PUSH_DEFAULT_FAVORITE, GIT_COMMANDS.MERGE].forEach((command, index) =>
registerItem({
id: command.id + '_fav',
command: command.id,
Expand Down

0 comments on commit 4f65f11

Please sign in to comment.