godotengine / godot-vscode-plugin

Godot development tools for VSCode
MIT License
1.53k stars 151 forks source link

Errors get opened in Godot rather than VSCode #683

Closed Burloe closed 1 month ago

Burloe commented 1 month ago

Godot version

4.3beta3

VS Code version

1.91.1

Godot Tools VS Code extension version

2.0.0

System information

Windows 10

Issue description

Whenever I get a code error. The affected script is opened in the Godot text editor rather than VSCode. Also all debugging tools and functionality doesn't work unless I run the project from VSCode. Additionally, around 1 in 10 times when I run the project, it just stops before Godot even produces a window. The output just prints "[DAP] Disconnected". I've reinstalled VSC, the extension and tried to redo all the steps to use an external editor many times but I can't seem to get this fixed.

Apologies if this is unrelated to the extension. If that's the case, feel free to close it.

Steps to reproduce

Don't know how to reproduce it.

DaelonSuzuka commented 1 month ago

Whenever I get a code error. The affected script is opened in the Godot text editor rather than VSCode.

Sounds like the expected behavior.

Also all debugging tools and functionality doesn't work unless I run the project from VSCode.

Definitely the expected behavior.

The output just prints "[DAP] Disconnected".

Sounds like you're running an unsupported debug configuration.

Please post the contents of your launch.json.

Burloe commented 1 month ago

Whenever I get a code error. The affected script is opened in the Godot text editor rather than VSCode.

Sounds like the expected behavior.

I could've sworn when I first setup VSCode as the external editor, any time a script was opened(including errors), they'd open in the external editor. That being said, this is my first time using an external editor so I could very well be wrong.

Also all debugging tools and functionality doesn't work unless I run the project from VSCode.

Definitely the expected behavior.

Alright, that's good to know.

Here's the requested contents of the 'launch.json'. Got these settings from some instruction tutorial on how to setup VSC:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "GDScript: Launch Project",
            "type": "godot",
            "request": "launch",
            "project": "${workspaceFolder}",
            "port": 6006,
            "debugServer": 6006,
            "address": "127.0.0.1",
            "debug_collisions": false,
            "debug_paths": false,
            "debug_navigation": false,
            "additional_options": ""
        }
    ]
}
DaelonSuzuka commented 1 month ago

I could've sworn when I first setup VSCode as the external editor, any time a script was opened(including errors), they'd open in the external editor. That being said, this is my first time using an external editor so I could very well be wrong.

You should double check the external editor options in Godot's Editor Settings. This behavior is controlled entirely by the Godot editor.

launch.json

Use of the debugServer field is not supported. Try using the recommended minimal debug configuration:

{
    "name": "Launch",
    "type": "godot",
    "request": "launch"
}
Burloe commented 1 month ago

That seems to have fixed a bunch of minor instabilities from my limited testing, most notably the [DAP] disconnected issue. I started by using the minimal configs and progressively added things and I just have one question if you don't mind.

When I run my project without the debugServer, the instance is ran completely independently from Godot and I don't have access to the instance in Godot like the remote tree, making changes in the editor has no effect, nothing is printed to the output, can't stop/pause/restart/go through breakpoints, nothing is printed to the output etc. I can of course still run the project from Godot and do all that and I can access most of the info in VSC but I can't make on-the-fly changes like I can usually. Is this also expected behavior?

I know you're not tech support or anything so I'm not expecting an answer. I tried my best to find answers by myself about this but being new to external IDE's, I hardly understand what I'm editing and couldn't find comprehensible answers. I appreciate the help and valuable information. I'll close the thread after this. Thanks!

Burloe commented 1 month ago

Closing this

DaelonSuzuka commented 1 month ago

I have to apologize, I started but never finished a response to this thread.

Is this also expected behavior?

The currently supported behavior is that you have to choose between launching a debug session with the Godot editor or with VSCode. You cannot have both attached to a running game instance at once.

I know you're not tech support

I'm pretty sure I am tech support, so don't apologize for asking questions.

Burloe commented 1 month ago

No worries at all. Okay, that's good to know. After having tested it a lot more with the new launch config. I've gotten used to launching an instance from whichever one I need at that time. When it's all new, it's hard to distinguish between bugs, intended behavior or simple user error. Thanks again!