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

Extensions api fixes #1233

Merged
merged 5 commits into from
Nov 7, 2020
Merged

Extensions api fixes #1233

merged 5 commits into from
Nov 7, 2020

Conversation

ixrock
Copy link
Contributor

@ixrock ixrock commented Nov 5, 2020

Changes:

  • fix: listing extensions itself instead of it's instances in UI
  • fix: create extension instance only when enabled
  • extensions active state now handled in common extensions-store.ts

Signed-off-by: Roman <ixrock@gmail.com>
@ixrock ixrock added bug Something isn't working area/extension Something to related to the extension api labels Nov 5, 2020
@ixrock ixrock requested review from jakolehm and a team November 5, 2020 13:00
@ixrock ixrock requested a review from a team November 5, 2020 13:17
Signed-off-by: Roman <ixrock@gmail.com>
Copy link
Contributor

@nevalla nevalla left a comment

Choose a reason for hiding this comment

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

LGTM. @jakolehm PTAL again.

Signed-off-by: Roman <ixrock@gmail.com>
readonly manifest: LensExtensionManifest;
readonly manifestPath: string;
readonly isBundled: boolean;

@observable private isEnabled = false;
Copy link
Collaborator

Choose a reason for hiding this comment

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

With this being private, I don't think it implements the InstalledExtension interface anymore, is that desirable?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Why you think it should implement? Using private field was suggested by @jakolehm

Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe I don't have a grasp of how these types interact, I would have assumed that the extension-manager.ts file keeps a record to instances of this type. Does it not?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nope.. extension-loader.ts keeps both InstalledExtension list and enabled instances of those.

Copy link
Collaborator

Choose a reason for hiding this comment

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

IMO that seems very strange, because we are keeping two lists of information that should always be the same. Why not just one 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.

Extension-manager doesn't keep anything.. Its purpose for install & load extensions.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Isn't extension-loader for installing and loading extensions? I would have assumed that extension-manager is the manager of truth and then uses loader to load stuff and store to persist data between restarts...

Copy link
Contributor

Choose a reason for hiding this comment

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

About private: without private extension instance itself cold toggle this which does not make any sense to me and is not really desirable. Why would we allow extension to do this?

ExtensionLoader: it's only purpose is to load (read: execute) extension instances. List of extensions are given to this class, it does not care how that list has generated.

ExtensionManager: it's only purpose is to gather a list of extensions and then install those to central node_modules folder (including all dependencies). Note: this does not load (or create) extension instances.

Naming things is one of the most difficult things in computer science so we probably could have better names for these. Still I strongly believe that separating complex things to smaller units is better than having one giant class that tries to do everything.

readonly manifest: LensExtensionManifest;
readonly manifestPath: string;
readonly isBundled?: boolean; // defined in package.json
enabled?: boolean;
}

Copy link
Collaborator

Choose a reason for hiding this comment

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

I want to comment on Line 25 and maybe this should be done in a follow up PR (make that a certainly as to not hold up this PR too much) but I am very confused about ExtensionManager since it doesn't actually hold on to a list of extensions that are loaded.

Signed-off-by: Roman <ixrock@gmail.com>
@ixrock
Copy link
Contributor Author

ixrock commented Nov 7, 2020

@jakolehm @Nokel81 PTAL again

Copy link
Collaborator

@Nokel81 Nokel81 left a comment

Choose a reason for hiding this comment

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

I'll approve this PR so that we can fix master with it. But I am still dissatisfied with this design of this part of the system. I think it is too interconnected and doesn't really match how the rest of our systems are designed.

Signed-off-by: Roman <ixrock@gmail.com>
@ixrock
Copy link
Contributor Author

ixrock commented Nov 7, 2020

Yes, maybe, but afaik it was desire of @jakolehm to keep these parts separated (manager, loader & store).

@ixrock ixrock merged commit 94ac081 into master Nov 7, 2020
@ixrock ixrock deleted the extensions_enable_disable_fix branch November 7, 2020 16:57
@nevalla nevalla mentioned this pull request Nov 9, 2020
@jakolehm jakolehm mentioned this pull request Nov 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/extension Something to related to the extension api area/ui bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants