-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Can't call inherent commands through app.commands.execute in extension #10337
Comments
Thank you for opening your first issue in this project! Engagement like this is essential for open source projects! 🤗 |
Your code seems good and indeed this is the recommended way of using existing commands. One thing that might be missing is specifying that your import { JupyterFrontEnd, JupyterFrontEndPlugin} from '@jupyterlab/application';
import { ITerminalTracker } from '@jupyterlab/terminal';
const extension: JupyterFrontEndPlugin = {
id: 'launcher_terminal:plugin',
autoStart: true,
requires: [ITerminalTracker],
activate: (app: JupyterFrontEnd) => {
console.log('JupyterLab extension launcher_terminal is activated!');
app.commands.execute('terminal:create-new');
}
}; And you would also want to add the terminal dependencies to your
Does it help? |
@krassowski Thanks for your help! It works, to some extent. I have some further questions if I may ask:
Yet this terminal runs in the background and seems it cannot be called to the foreground, as the images are shown below. I hoped it will achieve the effect just like opening up a terminal from the original launcher's panel, but it looks different from what expected. |
There is an example on how to add the terminal to the main widget area after it was opened in the extension points article; for convenience I will copy-paste how to do so here (but it might change in the future, so for any time-traveler - it is best to check the docs): app.commands
.execute('terminal:create-new')
.then((terminal: WidgetModuleType.Terminal) => {
app.shell.add(terminal, 'right');
}); I found it by using "search" -> "in this repository" function on GitHub (using |
I saw that the function of opening up a new terminal is registered into the commands registry by the name of 'terminal:create-new' in the @jupyter/terminal-extension, and I think it's a recommended way to call it rather than write an open-up function myself.
Yet when I write some code like below and build it:
the browser console prints it wasn't registered:
Seems I didn't call the commands in a correct way. Is there any way to do the job? I didn't import @jupyter/terminal-extension, since the only member that can be imported is addCommands(). Should I import it anyway? If so, how could I do it in the right way?
The text was updated successfully, but these errors were encountered: