Skip to content

Conversation

tuan-nguen
Copy link
Contributor

This is part of the work to remove the use of @vscode/webview-ui-toolkit. The new library @vscode-elements/elements does not have a direct replacement for VSCodeTag, this implements a new Tag component for which the styles have been mostly copied from here. Some of the css attributes are hard-coded (e.g. background-color and color) because using the corresponding CSS variables makes the styles different for different themes. I have attached comparison screenshots of the old and new component.

Dark theme
Screenshot 2025-04-01 at 10 13 32

Light theme
Screenshot 2025-04-01 at 10 13 38

@Copilot Copilot AI review requested due to automatic review settings April 1, 2025 09:17
@tuan-nguen tuan-nguen requested review from a team as code owners April 1, 2025 09:17
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This pull request replaces the legacy VSCodeTag component with a new Tag component to support the transition to @vscode-elements/elements. Key changes include:

  • Removing the import and usage of VSCodeTag from multiple files.
  • Introducing a new Tag component with hard-coded styling values.
  • Updating all instances of tag usage to maintain consistent UI appearance.

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
extensions/ql-vscode/src/view/model-editor/ModelEditor.tsx Removed VSCodeTag and replaced with Tag for display of modeled percentage.
extensions/ql-vscode/src/view/model-editor/MethodClassifications.tsx Updated tag usage in classification display from VSCodeTag to Tag.
extensions/ql-vscode/src/view/model-editor/LibraryRow.tsx Replaced VSCodeTag with Tag for unsaved changes display.
extensions/ql-vscode/src/view/method-modeling/MethodModeling.tsx Updated styling and usage of tag component for unsaved status.
extensions/ql-vscode/src/view/common/Tag.tsx Introduced the new Tag component with dedicated styling.
extensions/ql-vscode/src/view/common/CodePaths/ThreadPath.tsx Replaced VSCodeTag with Tag for code path labels.
Comments suppressed due to low confidence (1)

extensions/ql-vscode/src/view/method-modeling/MethodModeling.tsx:42

  • [nitpick] Consider renaming 'StyledTag' to a more descriptive name such as 'StyledUnsavedTag' since it is used exclusively to indicate unsaved status. This would improve the clarity of the component's purpose.
const StyledTag = styled(Tag)<{ $visible: boolean }>`

Tip: Copilot only keeps its highest confidence comments to reduce noise and keep you focused. Learn more

Comment on lines 4 to 7
background-color: #4d4d4d;
border: 1px solid transparent;
border-radius: 2px;
color: #ffffff;
Copy link
Contributor

Choose a reason for hiding this comment

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

Some of the css attributes are hard-coded (e.g. background-color and color) because using the corresponding CSS variables makes the styles different for different themes.

Could you explain why we wouldn't want the styles to change?

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 thought it makes more sense the keep the appearance the same as the old component. I am happy to use the CSS variables if you think that's the better approach. Here are some screenshots of the differences where left is the old component and the right one is the new component.

Github dark theme
Screenshot 2025-04-01 at 12 26 37

Dark high contrast theme
Screenshot 2025-04-01 at 12 26 02

Copy link
Contributor

Choose a reason for hiding this comment

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

I've done a little experimentation and it seems to me that using --vscode-badge-background and --vscode-badge-foreground gets an experience that's closest to what it was before. So unless I'm misunderstanding things I'd suggest we go with those variables instead of hardcoding.

Interestingly I seem to be getting a different experience from you 🤔. Everything looks the same for the dark theme, but here's some screenshots I've taken using some other themes (including the wilder ones):

Appearance on main

Screenshot 2025-04-01 at 14 38 21 Screenshot 2025-04-01 at 14 38 02 Screenshot 2025-04-01 at 14 37 47

Appearance on tuan-nguen/remove-vscode-tags

Screenshot 2025-04-01 at 14 52 23 Screenshot 2025-04-01 at 14 52 14 Screenshot 2025-04-01 at 14 52 07

Appearance on tuan-nguen/remove-vscode-tags using CSS variables

Screenshot 2025-04-01 at 14 47 46 Screenshot 2025-04-01 at 14 47 53 Screenshot 2025-04-01 at 14 48 01

Copy link
Contributor

@robertbrignull robertbrignull left a comment

Choose a reason for hiding this comment

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

LGTM

I've given it another quick local test and the colours all look good to me and match with the other components.

@tuan-nguen tuan-nguen merged commit ca2b732 into main Apr 1, 2025
18 of 19 checks passed
@tuan-nguen tuan-nguen deleted the tuan-nguen/remove-vscode-tags branch April 1, 2025 15:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants