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

Ask user to generate .vscode/ folder with launch/debug configuration, if external script editor is VS Code #5661

Closed
tvardero opened this issue Oct 26, 2022 · 1 comment

Comments

@tvardero
Copy link

Describe the project you are working on

not relevant

Describe the problem or limitation you are having in your project

not relevant

Describe the feature / enhancement and how it helps to overcome the problem or limitation

Firstly, both Godot editor and VS Code are lightweight and fast IDEs, and also could be used on any platform. For Linux users thats even their primary choise.
Secondly, Godot editor's IntelliSense is not that advanced as Omnisharp`s one in VS Code, so C# developers will prefer to work in VS Code, write code and debug it.

And latter is kinda tricky with Godot 4 rolled out, since the only extension for C# debugging in VS Code is incompatible with Godot 4 .

The extension is not required tho, since Godot 4 release we can freely debug with Omnisharp`s debugger. But not so many developers are aware of that. Even I continued trying to get extension to work with Godot 4.

Explicitly showing developers a way to debug Godot 4 projects inside with VS Code will ease the situation.
Only two (three*) files are required to launch and debug Godot's project from VS Code. They are stored in .vscode/ folder and their names are launch.json and tasks.json (and extensions.json*). File named settings.json is not required in our case.

With these files user can launch and debug simply by pressing F5 key. Breakpoints are supported. Experienced VS Code users are aware of those folders, so they won't question what those do and how to debug their Godot projects.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

image
Three options:

  • On new project creation, add checkbox with option to generate .vscode/ folder with tasks.json and launch.json (by default already selected).
  • In editor settings, section "Mono -> Editor", if current selected editor "VS Code", show button "Generate VS Code assets for Build and Debug".

Below is content of such files, it is very simillar to what Omnisharp generates for itself.

tasks.json's content:

{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "build",
            "command": "dotnet",
            "type": "process",
            "args": [
                "build",
                "/property:GenerateFullPaths=true",
                "/consoleloggerparameters:NoSummary"
            ],
            "problemMatcher": "$msCompile",
        }
    ]
}

launch.json's content:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Select and Launch Scene",
            "type": "coreclr",
            "request": "launch",
            "preLaunchTask": "build",
// Below is absolute path of Godot executable.
            "program": "D:\\\\Programs\\\\Utils\\\\Godot4.0b2\\\\godot4.exe",
            "args": [
                "${input:pickScene}"
            ],
            "cwd": "${workspaceFolder}",
            "console": "internalConsole",
            "stopAtEntry": false
        },
        {
            "name": "Launch Main Scene",
            "type": "coreclr",
            "request": "launch",
            "preLaunchTask": "build",
// Below is absolute path of Godot executable.
            "program": "D:\\\\Programs\\\\Utils\\\\Godot4.0b2\\\\godot4.exe", 
            "args": [
                "--path",
                "${workspaceFolder}"
            ],
            "cwd": "${workspaceFolder}",
            "console": "internalConsole",
            "stopAtEntry": false
        },
        {
            "name": "Attach",
            "type": "coreclr",
            "request": "attach"
        }
    ],
    "inputs": [
        {
            "id": "pickScene",
            "type": "command",
            "command": "filePicker.pick",
            "args": {
                "masks": "**/*.tscn",
                "display": "filePath",
                "output": "filePath"
            }
        }
    ]
}

NOTE: you need this extension (or another analogue) to use launch configuration "Select and Launch Scene". File named extensions.json will help user to find it by prompting user to install all recomended extensions.
extensions.json's content:

{
    "recommendations": [
        "dfarley1.file-picker"
    ]
}

If this enhancement will not be used often, can it be worked around with a few lines of script?

It is used on every debug.

Is there a reason why this should be core and not an add-on in the asset library?

It is a core feature.

@Calinou Calinou changed the title Godot editor: Ask user to generate .vscode/ folder with launch/debug configuration, if external script editor is VS Code Ask user to generate .vscode/ folder with launch/debug configuration, if external script editor is VS Code Oct 26, 2022
@raulsntos
Copy link
Member

Creating assets for a specific editor is the responsibility of that editor, and VSCode already allows you to create those assets in the Run and Debug view. I don't think Godot should re-implement this functionality, it adds a maintainability burden that would be best solved by each specific editor or an editor's extension.

I also don't think it's Godot's responsibility to teach you how to use your editor either and there's no way we could support every editor out there, but we do have documentation that explains how to setup the most common editors. It may be possible to show a link to this documentation page in Godot which may be enough to address your concerns.

Keep in mind that the documentation hasn't been updated for 4.0 yet. The C# extension should close the gap between Godot and VSCode but it hasn't been updated yet either.

@tvardero tvardero closed this as not planned Won't fix, can't repro, duplicate, stale Jul 12, 2023
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

4 participants