All files / src/commands coreCommandHandlers.js

100% Statements 38/38
100% Branches 7/7
100% Functions 5/5
100% Lines 38/38

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 394x 4x 4x 1x 1x 1x 1x 4x 4x 4x 2x 2x 2x 2x 2x 2x 2x 2x 1x 1x 1x 1x 1x 4x 4x 4x 1x 4x 4x 4x 1x 4x 4x 4x 3x 3x 3x 3x  
function createCoreCommandHandlers({ vscodeApi, logger, sidebarProvider }) {
  return {
    "gbot.showSidebar": async () => {
      await vscodeApi.commands.executeCommand(
        "workbench.view.extension.gbotView",
      );
      await vscodeApi.commands.executeCommand("gbotSidebar.focus");
    },
 
    "gbot.refreshSidebar": () => {
      try {
        logger.info("Refrescando sidebar...");
        vscodeApi.window.showInformationMessage("Actualizando vista...");
        sidebarProvider.refresh();
        vscodeApi.window.showInformationMessage(
          "Vista actualizada correctamente",
        );
      } catch (error) {
        logger.error(`Error refrescando sidebar: ${error.message}`);
        vscodeApi.window.showErrorMessage(
          "No se pudo actualizar la vista. Revisa el Output de G-Bot.",
        );
      }
    },
 
    "gbot.openLog": async () => {
      await logger.openLogFile();
    },
 
    "gbot.showOutput": () => {
      logger.show();
    },
  };
}
 
module.exports = {
  createCoreCommandHandlers,
};