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

plugin: fix hosted-plugin dialog #9764

Merged
merged 1 commit into from
Jul 29, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 5 additions & 9 deletions packages/plugin-dev/src/browser/hosted-plugin-manager-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { MessageService, Command, Emitter, Event, UriSelection } from '@theia/co
import { LabelProvider, isNative, AbstractDialog } from '@theia/core/lib/browser';
import { WindowService } from '@theia/core/lib/browser/window/window-service';
import { WorkspaceService } from '@theia/workspace/lib/browser';
import { OpenFileDialogFactory, DirNode } from '@theia/filesystem/lib/browser';
import { FileDialogService } from '@theia/filesystem/lib/browser';
import { HostedPluginServer } from '../common/plugin-dev-protocol';
import { DebugPluginConfiguration, LaunchVSCodeArgument, LaunchVSCodeRequest, LaunchVSCodeResult } from '@theia/debug/lib/browser/debug-contribution';
import { DebugSessionManager } from '@theia/debug/lib/browser/debug-session-manager';
Expand Down Expand Up @@ -107,8 +107,6 @@ export class HostedPluginManagerClient {
protected readonly hostedPluginServer: HostedPluginServer;
@inject(MessageService)
protected readonly messageService: MessageService;
@inject(OpenFileDialogFactory)
protected readonly openFileDialogFactory: OpenFileDialogFactory;
@inject(LabelProvider)
protected readonly labelProvider: LabelProvider;
@inject(WindowService)
Expand All @@ -123,6 +121,8 @@ export class HostedPluginManagerClient {
protected readonly debugSessionManager: DebugSessionManager;
@inject(HostedPluginPreferences)
protected readonly hostedPluginPreferences: HostedPluginPreferences;
@inject(FileDialogService)
protected readonly fileDialogService: FileDialogService;

@postConstruct()
protected async init(): Promise<void> {
Expand Down Expand Up @@ -272,17 +272,13 @@ export class HostedPluginManagerClient {
throw new Error('Unable to find the root');
}

const rootNode = DirNode.createRoot(workspaceFolder);

const dialog = this.openFileDialogFactory({
const result = await this.fileDialogService.showOpenDialog({
title: HostedPluginCommands.SELECT_PATH.label!,
openLabel: 'Select',
canSelectFiles: false,
canSelectFolders: true,
canSelectMany: false
});
dialog.model.navigateTo(rootNode);
const result = await dialog.open();
}, workspaceFolder);

if (UriSelection.is(result)) {
if (await this.hostedPluginServer.isPluginValid(result.uri.toString())) {
Expand Down