Skip to content

Commit

Permalink
Upload command always visible on browser
Browse files Browse the repository at this point in the history
Signed-off-by: Federico Bozzini <federico.bozzini@gmail.com>
  • Loading branch information
federicobozzini committed Oct 12, 2022
1 parent 807cf6d commit 35b0066
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/core/src/common/selection-command-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export class SelectionCommandHandler<S> implements CommandHandler {

isVisible(...args: any[]): boolean {
const selection = this.getSelection(...args);
return !!selection && (!this.options.isVisible || (this.options.isVisible as any)(selection as any, ...args));
return !this.options.isVisible || (this.options.isVisible as any)(selection as any, ...args);
}

isEnabled(...args: any[]): boolean {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ export class FileSystemFrontendContribution implements FrontendApplicationContri
commands.registerCommand(FileSystemCommands.UPLOAD, new FileSelection.CommandHandler(this.selectionService, {
multi: false,
isEnabled: selection => this.canUpload(selection),
isVisible: selection => this.canUpload(selection),
isVisible: () => !environment.electron.is(),
execute: selection => this.upload(selection)
}));
}
Expand Down
6 changes: 6 additions & 0 deletions packages/markers/src/browser/problem/problem-selection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
// *****************************************************************************

/* eslint-disable @typescript-eslint/no-explicit-any */
import { SelectionService } from '@theia/core/lib/common/selection-service';
import { SelectionCommandHandler } from '@theia/core/lib/common/selection-command-handler';
import { Marker } from '../../common/marker';
Expand All @@ -39,6 +40,11 @@ export namespace ProblemSelection {
options
);
}

override isVisible(...args: any[]): boolean {
const selection = this.getSelection(...args);
return !!selection && super.isVisible(args);
}
}

}

0 comments on commit 35b0066

Please sign in to comment.