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

Feature/multiple sessions tab view #6373

Merged
merged 22 commits into from
Feb 19, 2025

Conversation

dhruvisompura
Copy link
Contributor

@dhruvisompura dhruvisompura commented Feb 15, 2025

Description

Addresses #6160

This change introduces the new console tab list view in the console pane behind the positron.mulitpleConsoleSessions feature flag. The console tab list follows the tab list pattern for accessibility: https://www.w3.org/WAI/ARIA/apg/patterns/tabs/examples/tabs-automatic/

This issue does not address #6199 which is related since the console tab list can be resized. The console tab list resizing behavior can definitely use some improvement but can be tackled as polish.

Release Notes

New Features

  • N/A

Bug Fixes

  • N/A

QA Notes

Please see testing notes under #6160

Screenshots

Resize Console Pane

Screen.Recording.2025-02-18.at.8.31.34.PM.mov

Switch Sessions

Screen.Recording.2025-02-14.at.4.21.01.PM.mov

Copy link

github-actions bot commented Feb 15, 2025

E2E Tests 🚀
This PR will run tests tagged with: @:critical

readme  valid tags

width: 100%;
}

.positron-console .console-tab-list {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The flex properties should only be applied when the feature flag is on. This css class is conditionally applied if the feature flag is on.

</div>
}
</ActionBarRegion>
{!multiSessionsEnabled &&
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We no longer need to show this menu button since the console tab list does the same thing.

@@ -46,6 +61,37 @@ export const ConsoleCore = (props: ConsoleCoreProps) => {
return () => disposables.dispose();
});

// Console Width Effect
useEffect(() => {
Copy link
Contributor Author

@dhruvisompura dhruvisompura Feb 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This useEffect's only purpose is to set the initial width for the console pane/console tab list as well as handle resizing the console pane/console tab list when the parent container width changes.

The tricky bit of additional work that needs to be handled here is gracefully resizing the console pane and console tab list when the overall width of the container changes because a user increased the width of the secondary side bar (where the variables/plots panes live).

I had some gnarlier logic in this useEffect to try and resolve that but couldn't get it working in all scenarios. I'm keeping this useEffect simple for now and am tracking this as polish work in the epic that can be revisited after the core functionality is in.

@softwarenerd This may be a great task to pair on as follow up since you've dealt with these issues before!

readonly positronConsoleInstance: IPositronConsoleInstance;
}

export const ConsoleInstanceState = ({ positronConsoleInstance }: ConsoleInstanceStateProps) => {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This component just renders the icon that maps to the state the session is in. Instead of relying on the session's runtime state value, I am using the state value from the console instance we create. The console instance's state is almost a 1-to-1 map and is probably more relevant to the user than just the session state.

I can imagine if the console is busy and blocks interaction for some reason, we may want to indicate that with this icon.

That being said, if this seems wrong and we think that we should be showing the runtime session state, I can change this pretty easily!

Comment on lines 70 to 73
<img
className='icon'
src={`data:image/svg+xml;base64,${positronConsoleInstance.session.runtimeMetadata.base64EncodedIconSvg}`}
/>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The mockup has us rendering a grayscale version of the icon but I didn't feel inclined to make an icon mapping to languages when we have access to the runtime language icon.

@dhruvisompura dhruvisompura force-pushed the feature/multiple-sessions-tab-view branch from 2663aef to 91933a8 Compare February 15, 2025 01:16
@midleman
Copy link
Contributor

I've started adding a test to cover much of this new functionality. However, I've run into a couple issues:

  • The feature flag doesn't appear on web (this is reproducible in CI as well)
  • I’m having intermittent issues with Playwright when trying to click on the session tab in the list. It seems like the tab’s hitbox is overlapping with the Debug Console button, causing the inconsistent behavior. In the attached screenshot, you can see a misalignment. Playwright, by default, clicks the center of the locator - marked by the red dot in the image - but the center point is off, which could explain why the click fails. It seems likely that the overlapping hitboxes are causing Playwright to register the wrong element during the interaction.
  • I was hoping to add a test case around toggling the runtime in variables pane and ensure proper behavior in console, however, surprise, surprise, it's a native menu! So this could only be tested on web.

Screenshot 2025-02-17 at 6 04 38 AM
Screenshot 2025-02-15 at 5 32 17 AM
Screenshot 2025-02-18 at 5 54 08 AM

hcDark: '#2eb77c',
hcLight: '#2eb77c'
}, localize('positronConsole.stateIconIdle', "Positron console idle state icon color."));

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a little worried about hard-coded colors when it comes to strange themes that a user might use.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I completely agree! We will probably need to change these colors and do something more reasonable but for now I figured this would be okay. I have added a note in my clean up list on the epic to revisit this.

I am open to changing this but I couldn't find any existing vs code vars to lean on 😢

Copy link
Contributor

@samclark2015 samclark2015 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks good! Tested and works flawlessly with my changes to the interpreter dropdown.


// Initialize the width for the console pane and console tab list if it hasn't been
if (consoleWidth === 0) {
setConsoleTabListWidth(MAXIMUM_CONSOLE_TAB_LIST_WIDTH)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tab pane feels too wide, and the console too squished. Is 2/5 too much for smaller displays? Maybe we need a width breakpoint - e.g. 2/5 when width > 1024, and 1/5 otherwise?
Screenshot 2025-02-19 at 8 58 44 AM

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am using 2/5ths as the default to match the look and feel of the Terminal tab list!

We could make the default tab list size smaller by default, maybe 1/5 if we feel strongly about it?

I'm not inclined to add breakpoints to Positron since all of the panes and sidebars can be resized by the user - the value of adding breakpoints is pretty low with resizing as an option.

I think @softwarenerd mentioned that we could store the window size and pane/sidebar sizes the user has set so that Positron loads up with those layout configurations. That would be the way to go, but we haven't added that yet.

@dhruvisompura dhruvisompura merged commit 2002887 into main Feb 19, 2025
9 checks passed
@dhruvisompura dhruvisompura deleted the feature/multiple-sessions-tab-view branch February 19, 2025 18:58
@github-actions github-actions bot locked and limited conversation to collaborators Feb 19, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants