Skip to content

Commit

Permalink
Resolve extension name conflict: add all commands and view to one uni…
Browse files Browse the repository at this point in the history
…que namespace (#40)
  • Loading branch information
ksercs authored May 10, 2021
1 parent 0f4175b commit 5db64d1
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 25 deletions.
34 changes: 17 additions & 17 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"Other"
],
"activationEvents": [
"onView:main"
"onView:GitCherry.main"
],
"main": "./out/extension.js",
"contributes": {
Expand All @@ -55,47 +55,47 @@
"views": {
"GitCherry": [
{
"id": "main",
"id": "GitCherry.main",
"name": "main",
"icon": "resources/dark/cherry.svg"
}
]
},
"commands": [
{
"command": "pull_request",
"command": "GitCherry.pull_request",
"title": "Create pull requests",
"icon": {
"light": "resources/light/start.svg",
"dark": "resources/dark/start.svg"
}
},
{
"command": "refresh",
"command": "GitCherry.refresh",
"title": "Refresh",
"icon": {
"light": "resources/light/refresh.svg",
"dark": "resources/dark/refresh.svg"
}
},
{
"command": "continue",
"command": "GitCherry.continue",
"title": "Continue cherry-picking",
"icon": {
"light": "resources/light/continue.svg",
"dark": "resources/dark/continue.svg"
}
},
{
"command": "cherry_pick",
"command": "GitCherry.cherry_pick",
"title": "Cherry-pick",
"icon": {
"light": "resources/light/cherry.svg",
"dark": "resources/dark/cherry.svg"
}
},
{
"command": "abort_cherry_pick",
"command": "GitCherry.abort_cherry_pick",
"title": "Abort cherry-picking",
"icon": {
"light": "resources/light/abort.svg",
Expand All @@ -106,29 +106,29 @@
"menus": {
"view/title": [
{
"command": "pull_request",
"command": "GitCherry.pull_request",
"group": "navigation",
"when": "view == main"
"when": "view == GitCherry.main"
},
{
"command": "refresh",
"command": "GitCherry.refresh",
"group": "navigation",
"when": "view == main"
"when": "view == GitCherry.main"
},
{
"command": "continue",
"command": "GitCherry.continue",
"group": "navigation",
"when": "view == main && isMergeConflict == true"
"when": "view == GitCherry.main && isMergeConflict == true"
},
{
"command": "abort_cherry_pick",
"command": "GitCherry.abort_cherry_pick",
"group": "navigation",
"when": "view == main && isMergeConflict == true"
"when": "view == GitCherry.main && isMergeConflict == true"
},
{
"command": "cherry_pick",
"command": "GitCherry.cherry_pick",
"group": "navigation",
"when": "view == main && isMergeConflict == false"
"when": "view == GitCherry.main && isMergeConflict == false"
}
]
}
Expand Down
12 changes: 6 additions & 6 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ export async function activate () {
await Git.init();
await GithubClient.init();

window.registerTreeDataProvider('main', treeDataProvider);
commands.registerCommand('pull_request', () => Action.onPullRequest(treeDataProvider));
commands.registerCommand('cherry_pick', () => Action.onCherryPick(treeDataProvider));
commands.registerCommand('refresh', () => Action.onRefresh(treeDataProvider));
commands.registerCommand('continue', () => Action.onContinue());
commands.registerCommand('abort_cherry_pick', () => Action.onAbortCherryPick());
window.registerTreeDataProvider('GitCherry.main', treeDataProvider);
commands.registerCommand('GitCherry.pull_request', () => Action.onPullRequest(treeDataProvider));
commands.registerCommand('GitCherry.cherry_pick', () => Action.onCherryPick(treeDataProvider));
commands.registerCommand('GitCherry.refresh', () => Action.onRefresh(treeDataProvider));
commands.registerCommand('GitCherry.continue', () => Action.onContinue());
commands.registerCommand('GitCherry.abort_cherry_pick', () => Action.onAbortCherryPick());
}
4 changes: 2 additions & 2 deletions src/tree/dataProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default class TreeDataProvider implements vscode.TreeDataProvider<Extende
tree!: ExtendedTreeItem[];

constructor () {
commands.registerCommand('treeView.selectTreeItem', (element) => this.onItemClicked(element));
commands.registerCommand('GitCherry.treeView.selectTreeItem', (element) => this.onItemClicked(element));
}

getSelectedUpstreams (): string[] {
Expand All @@ -34,7 +34,7 @@ export default class TreeDataProvider implements vscode.TreeDataProvider<Extende
// eslint-disable-next-line no-undef
getTreeItem (element: ExtendedTreeItem): ExtendedTreeItem|Thenable<ExtendedTreeItem> {
element.setIcon();
element.command = { command: 'treeView.selectTreeItem', title: 'Select item', arguments: [element] };
element.command = { command: 'GitCherry.treeView.selectTreeItem', title: 'Select item', arguments: [element] };
return element;
}

Expand Down

0 comments on commit 5db64d1

Please sign in to comment.