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

Add ability to specify arbitrary arguments to Godot when launching the debugger #362

Closed
bitwes opened this issue May 15, 2022 · 0 comments
Closed

Comments

@bitwes
Copy link
Contributor

bitwes commented May 15, 2022

Godot version

3.3 stable

VS Code version

1.64.2

Godot Tools VS Code extension version

1.3.0

System information

macOS 10.15.7

Problem statement

I discovered that other VSCode plugins can launch the debugger (provided by this plugin) using:

vscode.debug.startDebugging(...);

I would like to be able to send an arbitrary argument list when using this command.

I have a VSCode extension that runs GUT unit tests through VSCode (https://github.com/bitwes/gut-extension). If I can pass arbitrary arguments to the debugger then I can run GUT through the debugger. This would also give any other VSCode extension the ability to use the debugger for any purpose they want.

Here's an example of a GUT command:

 -s res://addons/gut/gut_cmdln.gd  -d  -gselect=test_bar.gd -ginner_class=TestBarClassTwo -gunit_test_name=test_bar_one

The -s option isn't currently supported by this plugin. Also, there are over 15 CLI arguments available for GUT. Being able to pass a string to launch the debugger would be great.

Proposed solution

I was able to get a proof of concept working. I added an additional_options parameter to this plugin (PR). I then create a DebugConfiguration object and use it to launch the debugger with vscode.debug.startDebugging(undefined, config);.

Full Example

class GodotDebugConfiguration implements vscode.DebugConfiguration{
    public type = "godot";
    public name = "Debug Godot";
    public request = "launch";
    public project = "${workspaceFolder}";
    public port = 6007;
    public address = "127.0.0.1";
    public launch_game_instance = true;
    public launch_scene = false;
    public additional_options = "";
}

private runGutThroughDebugger(options:string = ''){
    let config = new GodotDebugConfiguration();
    config.additional_options = "-s \"res://addons/gut/gut_cmdln.gd\"";
    vscode.debug.startDebugging(undefined, config);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants