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

LLDB: Overwrite Launch Configurations from Cargo.toml #1099

Open
punowo opened this issue May 11, 2024 · 0 comments
Open

LLDB: Overwrite Launch Configurations from Cargo.toml #1099

punowo opened this issue May 11, 2024 · 0 comments
Labels
enhancement Enchancement request

Comments

@punowo
Copy link

punowo commented May 11, 2024

Would something like this be needed / accepted ? I find myself copying, creating .vscode/launch.json and pasting the contents of the already existing similar command a lot and I would love to just have a command that does all this.

I'm already creating a mini vscode extension that acts as a wrapper around "lldb.getCargoLaunchConfigs" but I was thinking maybe something like this can be a pull request for this extension.

function activate(context) {
  let disposable = vscode.commands.registerCommand(
    "cargo-quick-config.generateStuff",
    async function () {
      await vscode.commands.executeCommand("lldb.getCargoLaunchConfigs");
      if (vscode.window.activeTextEditor.document.isUntitled) {
        const content = vscode.window.activeTextEditor.document.getText();
        const workSpaceFolder = vscode.workspace.workspaceFolders
          ? vscode.workspace.workspaceFolders[0].uri.fsPath
          : null;

        if (workSpaceFolder) {
          const filePath = path.join(workSpaceFolder, "MyNewLaunch.json");
          fs.writeFileSync(filePath, content);
          await vscode.commands.executeCommand(
            "workbench.action.revertAndCloseActiveEditor"
          );

          // Use the command to close the active editor
          await vscode.commands.executeCommand(
            "workbench.action.closeActiveEditor"
          );
        } else {
          vscode.window.showWarningMessage("No workspace folder found.");
        }
      }
    }
  );

  context.subscriptions.push(disposable);
}
@punowo punowo added the enhancement Enchancement request label May 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enchancement request
Projects
None yet
Development

No branches or pull requests

1 participant