Selaa lähdekoodia

Fixes some context menu commands

main
Eric Amodio 4 vuotta sitten
vanhempi
commit
6b27a480c9
1 muutettua tiedostoa jossa 5 lisäystä ja 5 poistoa
  1. +5
    -5
      src/commands/common.ts

+ 5
- 5
src/commands/common.ts Näytä tiedosto

@ -380,10 +380,7 @@ export abstract class Command implements Disposable {
let firstArg = args[0];
if (
options.editor &&
(firstArg == null || (firstArg.id != null && firstArg.document != null && firstArg.document.uri != null))
) {
if (options.editor && (firstArg == null || (firstArg.id != null && firstArg.document?.uri != null))) {
editor = firstArg;
args = args.slice(1);
firstArg = args[0];
@ -452,7 +449,10 @@ export abstract class ActiveEditorCommand extends Command {
}
protected _execute(command: string, ...args: any[]): any {
return super._execute(command, window.activeTextEditor, ...args);
// Only include the editor if there are no args
return args.length === 0
? super._execute(command, window.activeTextEditor)
: super._execute(command, undefined, ...args);
}
abstract execute(editor?: TextEditor, ...args: any[]): any;

Ladataan…
Peruuta
Tallenna