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

Refactor to hide VS Code interfaces behind core services #9727

Merged
merged 9 commits into from
Aug 17, 2021

Conversation

tsmaeder
Copy link
Contributor

@tsmaeder tsmaeder commented Jul 13, 2021

Signed-off-by: Thomas Mäder tmader@redhat.com

What it does

This PR refactors the QuickInput and QuickAccess services introduced in #9154 in order to completely hide the types imported from VS Code.
In particular, this allows to write the all the related contributions in terms of a single implementation of quick access and quick input. Also, the quick access registry implementation allows to use dependency injection in the regular Theia way.
This refactoring was deferred from the original PR in order to facilitate merging it earlier.

How to test

We should do the same testing as for #9154

Review checklist

Reminder for reviewers

@@ -14,6 +14,8 @@
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
********************************************************************************/

const { QuickPickItem } = require('@theia/core/lib/browser');
Copy link
Member

Choose a reason for hiding this comment

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

@tsmaeder I believe it should be inside the describe('file-search'), line 26.

protected readonly quickAccessRegistry: QuickAccessRegistry;

constructor(@inject(KeybindingRegistry) protected readonly keybindingRegistry: KeybindingRegistry) {
}
Copy link
Contributor

Choose a reason for hiding this comment

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

do we really need an empty constructor?
can we use the property injection here instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No we don't.

@vince-fugnitto vince-fugnitto added monaco issues related to monaco quality issues related to code and application quality labels Jul 14, 2021
super();
this.initContainer();
this.initController();
this.monacoService = new MonacoQuickInputImplementation(this.contextKeyService);
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't we use inversify to inject the instance instead?

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 idea was that this is an implementation detail of the MonacoQuickInputService, but since we're using the same class over in MonacoEditorProvider, that is not true anyway.
The VS Code code can handle multiple instances no problem, but we don't need more than one instance, so using the one from the container seems the right thing.

@svor svor mentioned this pull request Jul 27, 2021
34 tasks
@tsmaeder tsmaeder force-pushed the 8969_refactor_quickinput branch from 9a1f71e to dfbc685 Compare July 27, 2021 12:53
@tsmaeder
Copy link
Contributor Author

Addressed review comments and rebased. Now (desperately ;-)) seeking for approval. 🥺

Copy link
Member

@vince-fugnitto vince-fugnitto left a comment

Choose a reason for hiding this comment

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

@tsmaeder do you mind rebasing the pull-request, I'd be happy to perform another review so we can benefit from the cleanup following the upgrade 👍

Signed-off-by: Thomas Mäder <tmader@redhat.com>
Signed-off-by: Thomas Mäder <tmader@redhat.com>
Signed-off-by: Thomas Mäder <tmader@redhat.com>
Signed-off-by: Thomas Mäder <tmader@redhat.com>
Signed-off-by: Thomas Mäder <tmader@redhat.com>
Signed-off-by: Thomas Mäder <tmader@redhat.com>
Signed-off-by: Thomas Mäder <tmader@redhat.com>
Signed-off-by: Thomas Mäder <tmader@redhat.com>
@tsmaeder tsmaeder force-pushed the 8969_refactor_quickinput branch from 595fa37 to 70393dc Compare August 6, 2021 14:18
Copy link
Member

@vince-fugnitto vince-fugnitto left a comment

Choose a reason for hiding this comment

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

The changes look good to me, I verified the different quick-input menus we have (seen with the ? prefix).

hideItem(label: string): void { }
showItem(label: string): void { }

readonly prefix = 'view ';
Copy link
Member

Choose a reason for hiding this comment

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

Leftover? We have QuickViewService.PREFIX.

@svor svor mentioned this pull request Aug 12, 2021
30 tasks
Copy link
Member

@msujew msujew left a comment

Choose a reason for hiding this comment

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

Looks good to me as well:

  • Every quick input prefix is working correctly ✔️
  • Command history is working correctly ✔️
  • Quick input icons are correctly displayed ✔️

Signed-off-by: Thomas Mäder <tmader@redhat.com>
@tsmaeder tsmaeder merged commit 7d637a1 into eclipse-theia:master Aug 17, 2021
dna2github pushed a commit to dna2fork/theia that referenced this pull request Aug 25, 2021
…ia#9727)

Refactor to hide VS Code interfaces behind core services

Signed-off-by: Thomas Mäder <tmader@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
monaco issues related to monaco quality issues related to code and application quality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants