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

Add engines to Works With section #1058

Merged
merged 1 commit into from
Dec 9, 2024

Conversation

amvanbaren
Copy link
Contributor

Add engines to Works With section. Related issue: #1042

Some examples:
image

image

image

@amvanbaren amvanbaren self-assigned this Dec 4, 2024
@amvanbaren
Copy link
Contributor Author

@jthomasmock @filiptronicek What do you think?

Copy link
Member

@filiptronicek filiptronicek left a comment

Choose a reason for hiding this comment

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

LGTM, left some non-blocking comments

const displayName = getTargetPlatformDisplayName(targetPlatform);
return displayName ? <span key={targetPlatform}>{index > 0 ? ', ' : ''}{displayName}</span> : null;
});
const renderWorksWithEngines = (engines?: Record<string, string>): ReactNode => {
Copy link
Member

Choose a reason for hiding this comment

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

I'd be great to make this use useCallback so that we memoize the return value without having to re-render every time. The same goes for renderWorksWithTargetPlatformsList as well.

Copy link
Member

Choose a reason for hiding this comment

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

If we do, we should make the functions depend on extension.engines and extension.downloads respectively by removing the arguments and using extension there and always reference extension from the component itself.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sounds good. I'll add memoization.

@@ -91,7 +91,7 @@ export interface Extension {
description?: string;

// key: engine, value: version constraint
engines?: string[];
engines?: Record<string, string>;
Copy link
Member

Choose a reason for hiding this comment

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

looks like this is nothing new, just aligning with reality 👍

.map((engine) => ({
key: engine,
name: getEngineDisplayName(engine),
version: engines[engine]
Copy link
Member

Choose a reason for hiding this comment

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

I wonder how much free rein extensions have here. Do we have any limits on what users can put into the engine version?
I don't think it's necessary to parse these values per se, but we could have some validation on the backend if we don't already.

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 vscode version is required, but a publisher can add other engines too. From https://code.visualstudio.com/api/references/extension-manifest:
image

@jthomasmock
Copy link

@jthomasmock @filiptronicek What do you think?

Looks great to me!

@amvanbaren amvanbaren merged commit ca404c1 into eclipse:master Dec 9, 2024
2 checks passed
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.

3 participants