godot-csharp-vscode: "Play in Editor" hangs when Godot project is in subdirectory

My project structure is a bit unusual:

project\
   .vscode\launch.json
   library_im_writing\
   godot_project\

With this configuration there doesn’t appear to be a way of using the Play in Editor configuration. I’ve tried specifying the working directory in launch.json with cwd and symlinking my project.godot file to the root project directory. Neither appear to work. Godot doesn’t even log any incoming debugger connection when running godot -v.

When I put a .vscode\launch.json inside my godot_project directory and open the folder in VSCode, that does work - so I don’t think its my project settings causing this.

Edit Oddly enough, debugging seems to work just fine when I run the “Attach” configuration with my scene already running in Godot.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 30 (30 by maintainers)

Most upvoted comments

I got it working through a contributes setting, but agreed that a selector is a better way of doing it. I’ll give it a shot - i mean i’m not familiar with writing extensions or even TS, but it can’t be that difficult to figure this out. The C# extension already has a good starting point: https://github.com/OmniSharp/omnisharp-vscode/blob/1756e252a74b051097ed9acb9e080fba8fdff185/src/main.ts#L102

And debugger breakpoints are working now too. There are a lot of things in life that don’t make senshe…

Anyways thanks a bunch for the help, much appreciated!

This has to be some kind of VSCode caching issue. I finally got it to raise an exception by just saving random characters to extension.bundled.js. That threw an exception! And now it seems to be picking up my changed to the bundle file.

Got it built, thank you! The only extra thing I had to do was a nuget restore in the ./GodotDebugSession/ path before running make build. I’ll see if I can get a project path config param added now and open up a PR if so.

First you need to have Node.JS installed (the installer should add the node and the npm commands to your PATH). The last version should probably be fine, but this is what I’m using: node v14.2.0 | npm 6.14.4.

Now you have to download the dependencies of the project, just execute npm install in the root directory of the repository (where the package.json file is located).

You’ll also need to install the webpack command globally: npm install --global webpack-cli. (This would no longer be necessary if #27 gets merged).

Now you can build the extension using the Makefile with the make build command. This will transpile the typescript into javascript and compile the C# projects.

If it built successfully you can now launch the extension locally (the Run Extension configuration in .vscode/launch.json). This will open a new VSCode window with the locally-built extension installed, you can then open your godot project in this VSCode window and try it out.