Skip to content

Conversation

isabelizimm
Copy link
Contributor

@isabelizimm isabelizimm commented Aug 4, 2025

UI updates to the "Convert to Code" button!

  • syntax highlighting for incoming code
  • added a header for context on the dropdown of syntaxes
  • changed "OK" button to "Copy Code" where code is copied to clipboard and then modal is disposed

Release Notes

New Features

Bug Fixes

  • N/A

QA Notes

with the "dataExplorer.convertToCode": true setting

import pandas as pd

x = pd.DataFrame({"X":[1,2,3,4,5,6,7]})

%view x

and then click on the Convert to Code button. See syntax highlighting.

Copy link

github-actions bot commented Aug 4, 2025

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

readme  valid tags

@isabelizimm isabelizimm marked this pull request as ready for review August 5, 2025 16:07
Copy link
Contributor

@dhruvisompura dhruvisompura left a comment

Choose a reason for hiding this comment

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

Left some comments around the styling of the modal. I also think there's another small css bug. Let me know if you need some help looking into it!

Comment on lines 12 to 16
.code-syntax-heading {
margin-block-start: 0;
margin-block-end: 8px;
margin: 0 0 0 0;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think you want to set margin and margin-block here together. The margin-block properties will set the margin (margin-top, margin-bottom, margin-left, and margin-right) values for you based off the writing mode/text orientation.

You are also resetting the margin bottom value from 8px to 0px with margin: 0 0 0 0; which I don't think you want. You can notice in the screenshot above that there is no margin between the dropdown header and syntax dropdown.

If you want to use margin instead of margin-block, the equivalent would be:

.code-syntax-heading {
	margin-top: 0;
	margin-bottom: 8px;
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ah, that makes sense! updated to only have margin top and bottom 👍

Comment on lines 6 to 10
.convert-to-code-editor {
height: 200px;
width: 100%;
border: 1px solid var(--vscode-positronModalDialog-border);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I noticed that the text in the code editor doesn't have any padding which makes it squished up against the border. I wonder if we could get some padding around the text?

image

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Screenshot 2025-08-05 at 5 08 07 PM

Okay, I added a bit of padding! Unfortunately, now it looks like whole inner square of the CodeEditorWidget was moved 😭

Copy link
Contributor

Choose a reason for hiding this comment

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

ah ya, that makes sense since the text content is nested deeper in the CodeEditorWidget. We probably need to find the div the text is contained in and add the padding there.

>
<VerticalStack>
<ContentArea>
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't know if this is reproducible for you, but I am able to scroll the entire contents of the modal by a few pixels to the left and right but there's no scrollbar showing up.

Screen.Recording.2025-08-05.at.1.39.48.PM.mov

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There is an invisible scrollbar in the CodeEditorWidget, but adjusting the width to be slightly smaller removed the wiggliness in the modal. There's definitely something weird going on with the sizing, it seems like the element is not actually the size of the border (see the padding comment/image)?

Copy link
Contributor

Choose a reason for hiding this comment

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

I'll see if I can poke around and figure out what is going and how we can fix these issues!

@isabelizimm
Copy link
Contributor Author

alright, this is the current state of the modal! we'll apply a "real" code formatter in a follow up. for now, this just wraps onto the next line.

screenshot_2025-08-06_at_12 26 50___pm_360

dhruvisompura
dhruvisompura previously approved these changes Aug 6, 2025
Copy link
Contributor

@dhruvisompura dhruvisompura left a comment

Choose a reason for hiding this comment

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

Looks great! I had one question but not a blocker for merging. 🚀

@isabelizimm isabelizimm merged commit d8894e1 into main Aug 6, 2025
10 checks passed
@isabelizimm isabelizimm deleted the convert-ui-update branch August 6, 2025 21:12
@github-actions github-actions bot locked and limited conversation to collaborators Aug 6, 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.

2 participants