Skip to content
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

Allow to select the path in debugger source component #16246

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/debugger/src/panels/sources/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export class Sources extends PanelWithToolbar {
})
);
const sourcePath = ReactWidget.create(
<SourcePathComponent model={model} />
<SourcePathComponent model={model} trans={trans} />
);

this.toolbar.addItem('sourcePath', sourcePath);
Expand Down
12 changes: 10 additions & 2 deletions packages/debugger/src/panels/sources/sourcepath.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Distributed under the terms of the Modified BSD License.

import { UseSignal } from '@jupyterlab/ui-components';
import { TranslationBundle } from '@jupyterlab/translation';
import React from 'react';
import { IDebugger } from '../../tokens';

Expand All @@ -12,15 +13,22 @@ import { IDebugger } from '../../tokens';
* @param props.model The model for the sources.
*/
export const SourcePathComponent = ({
model
model,
trans
}: {
model: IDebugger.Model.ISources;
trans: TranslationBundle;
}): JSX.Element => {
return (
<UseSignal signal={model.currentSourceChanged} initialSender={model}>
{(model): JSX.Element => (
<span
onClick={(): void => model?.open()}
onClick={(event): void => {
if (event.ctrlKey) {
model?.open();
}
}}
title={trans.__('Ctrl + click to open in the Main Area')}
className="jp-DebuggerSources-header-path"
>
{model?.currentSource?.path ?? ''}
Expand Down
1 change: 1 addition & 0 deletions packages/debugger/style/sources.css
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,5 @@
white-space: nowrap;
font-size: var(--jp-ui-font-size0);
color: var(--jp-ui-font-color1);
user-select: text;
}