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

Minor improvements/fixes to custom plugin API doc #13358

Merged

Conversation

jcortell68
Copy link
Contributor

@jcortell68 jcortell68 commented Feb 6, 2024

What it does

Corrects/improves a few things in documentation and in one of the example Theia Extensions.

Found these by going through the steps in the recently updated documentation reflecting the new-and-improved mechanics for contributing custom plugin API.

How to test

  • Read the updated doc and check for accuracy.
  • Build the gotd example Theia extensions and ensure it builds and works

Review checklist

Reminder for reviewers

Found these by going through the steps in the recently updated
documentation reflecting the new-and-improved mechanics for
contributing custom plugin API.
return {
fooBar: {
getFoo(): Promise<Foo> {
return fooExt.getFooImpl();
return self.fooExt.getFooImpl();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Explanation: you can't directly access fooExt from here. You need the self local above.

@@ -31,7 +31,6 @@ import { ApiFactory, PluginContainerModule } from '@theia/plugin-ext/lib/plugin/

type Gotd = typeof gotd;
const GotdApiFactory = Symbol('GotdApiFactory');
type GotdApiFactory = ApiFactory<Gotd>;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Explanation: this type seems extraneous.

Copy link
Contributor

Choose a reason for hiding this comment

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

So it is! There's no problem of unused name reported by tsc/eslint because the const symbol of the same name is referenced.

Copy link
Contributor

@cdamus cdamus left a comment

Choose a reason for hiding this comment

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

Thanks for looking after this developer guide material! I do have a couple of comments in-line.

@@ -89,7 +89,6 @@ import { FooExtImpl } from './foo-ext-impl';
import * as fooBarAPI from '@bar/foo';

type FooBarApi = typeof fooBarAPI;
type Foo = FooBarApi['Foo'];
Copy link
Contributor

Choose a reason for hiding this comment

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

This type is used at line 132.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Indeed. I apparently got myself confused there. Will fix

@@ -31,7 +31,6 @@ import { ApiFactory, PluginContainerModule } from '@theia/plugin-ext/lib/plugin/

type Gotd = typeof gotd;
const GotdApiFactory = Symbol('GotdApiFactory');
type GotdApiFactory = ApiFactory<Gotd>;
Copy link
Contributor

Choose a reason for hiding this comment

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

So it is! There's no problem of unused name reported by tsc/eslint because the const symbol of the same name is referenced.

@@ -89,7 +89,6 @@ import { FooExtImpl } from './foo-ext-impl';
import * as fooBarAPI from '@bar/foo';

type FooBarApi = typeof fooBarAPI;
type Foo = FooBarApi['Foo'];

const FooBarApiFactory = Symbol('FooBarApiFactory');
type FooBarApiFactory = ApiFactory<FooBarApi>;
Copy link
Contributor

Choose a reason for hiding this comment

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

Similarly to the GotD example, this type definition is actually unused. We can remove it and the ApiFactory import as in GotD.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Above you pointed out it's used at line 132, and that does appear to be the case. So am I wrong about being wrong?

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 guess part of the confusion is that both snippets are actually in the same file, and thus the contents of the file are spread out in two disjointed parts of the documentation.

Copy link
Contributor

Choose a reason for hiding this comment

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

No, the FooBarApiFactory type definition doesn't appear to be used. The thing that's used at line 132 is the Foo type definition.

Copy link
Contributor Author

@jcortell68 jcortell68 Feb 6, 2024

Choose a reason for hiding this comment

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

So, where I got confused is that I mis-associated your comment here. My eye went to the pink-highlighted line (92) instead of the line directly above your comment (95). I should probably get more coffee. All is good. I'll fix the one issue and remove this line, too

Copy link
Contributor

Choose a reason for hiding this comment

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

And we also need to remove the now-unused import of ApiFactory from the Foo example in the MD as we did for the GotD example in "real code".

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Indeed. Done

@jcortell68
Copy link
Contributor Author

OK. Hopefully it's all straight now. Thanks for the review.

Copy link
Contributor

@cdamus cdamus left a comment

Choose a reason for hiding this comment

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

Great! Thanks, @jcortell68 .

Copy link
Contributor

@martin-fleck-at martin-fleck-at left a comment

Choose a reason for hiding this comment

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

Thank you for double checking this and improving this example! Looks good to me!

@martin-fleck-at martin-fleck-at merged commit 9530193 into eclipse-theia:master Feb 6, 2024
14 checks passed
@jfaltermeier jfaltermeier added this to the 1.47.0 milestone Feb 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

4 participants