-
Notifications
You must be signed in to change notification settings - Fork 330
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add git to command palette #1243
Add git to command palette #1243
Conversation
Thanks for submitting your first pull request! You are awesome! 🤗 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are on the right path.
In addition to the comments in the code, I must mention that the clone command is defined in a separate plugin; see https://github.com/jupyterlab/jupyterlab-git/blob/master/src/cloneCommand.ts#L20
src/index.ts
Outdated
// Add commands to the pallette | ||
const command = CommandIDs.gitClone; | ||
|
||
commands.addCommand(command, { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will add a new command. But in this specific case we want to add to the palette existing commands. So if you want to test something, you will need to create a dummy command identifier as this one will clash with the existing command).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Understood, thanks for explaining!
src/index.ts
Outdated
}); | ||
// Add the command to the command palette | ||
const category = 'Git Example'; | ||
palette.addItem({ command, category }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is good. You should do this after line 192 in which addCommands
is executed (registering most of this extension commands).
@fcollonval Hi, I adjusted the changes that you requested. Looks like the PR is failing an Integration Test (UI Test). Here's the generated log:
I would be glad to have your thoughts on this... |
Hi @fcollonval sorry to bother you again. Could you provide some insights on this? I am stuck here and any feedback will be much appreciated. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @tsabbir96
Don't worry about the integration tests failing. They are not related to your work.
I only have small comments and this will be ready to go.
src/index.ts
Outdated
@@ -185,6 +193,23 @@ async function activate( | |||
gitPlugin.title.icon = gitIcon; | |||
gitPlugin.title.caption = 'Git'; | |||
|
|||
// Add the commands to the command palette | |||
const category = 'Git Operations'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's internationalize that string:
const category = 'Git Operations'; | |
const category = trans.__('Git Operations'); |
src/index.ts
Outdated
CommandIDs.gitOpenGitignore, | ||
CommandIDs.gitShowDiff, | ||
CommandIDs.gitInit, | ||
CommandIDs.gitClone, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You must not add this one here as it is defined in another plugin.
CommandIDs.gitClone, |
Instead you should add the same logic in the clone plugin there:
jupyterlab-git/src/cloneCommand.ts
Line 20 in dda8e82
export const gitCloneCommandPlugin: JupyterFrontEndPlugin<void> = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You must not add this one here as it is defined in another plugin.
Instead you should add the same logic in the clone plugin there:
jupyterlab-git/src/cloneCommand.ts
Line 20 in dda8e82
export const gitCloneCommandPlugin: JupyterFrontEndPlugin<void> = {
@fcollonval Hi, thanks for the feedback. Could you kindly elaborate a bit for me on what you meant by "Instead you should add the same logic in the clone plugin there". Thank you once again.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gitCloneCommandPlugin
is an extension plugin as the plugin
you modified there:
Line 44 in fba3e2f
const plugin: JupyterFrontEndPlugin<IGitExtension> = { |
So you should also add the ICommandPalette
token as requirement and then call,
palette.addItem({ command: CommandIDs.gitClone, category: trans.__('Git Operations') })
dc2cc2d
to
bb406b7
Compare
46a0707
to
ab6b108
Compare
An attempt to develop the feature requested at #1238