bitwes / gut-extension

VSCode extension to run GUT from the editor.
MIT License
29 stars 6 forks source link

Bug: Can't run tests - getRunGodotCommand() returns undefined - Caused by renamed editor_path setting #29

Closed WebF0x closed 7 months ago

WebF0x commented 8 months ago

Env

Windows 10 gut-extension v2.1.0 godot-tools v2.0.0 (master branch build)

Problem

When I run any Gut command, e.g. GUT: Run all, I get this error: undefined -s res://addons/gut/gut_cmdln.gd -d

A little digging to get started

This creates the command string to run: https://github.com/bitwes/gut-extension/blob/930ea4f84ccb07083d70eac9172b0de894c7bd67/src/gut-tools.ts#L134

cmd is declared here, so it means getRunGodotCommand() returns undefined https://github.com/bitwes/gut-extension/blob/930ea4f84ccb07083d70eac9172b0de894c7bd67/src/gut-tools.ts#L132

I think the error might come from here, when I search my settings, none are called editor_path https://github.com/bitwes/gut-extension/blob/930ea4f84ccb07083d70eac9172b0de894c7bd67/src/utils.ts#L87

If I understand this file correctly, the godot_tools.editor_path setting from extension godot-tools was split/renamed to godotTools.editorPath.godot3 and godotTools.editorPath.godot4. Might have caused this issue.

bitwes commented 8 months ago

I think I see this error often when oh-my-zsh is asking to upgrade. Are you by chance using zsh as your shell with oh-my-zsh?

Was the tool working and then stopped or is this the first time you are using it?

bitwes commented 8 months ago

Nevermind, you are probably right, I'm still using 1.3 of Godot Tools. I'll have a look.

WebF0x commented 8 months ago

Thanks, I'm looking forward to try it. Your 2 extensions are what I needed to motivate me to get back into Godot!

Just in case, I'm on Windows and Powershell (I know ugh!). I had to use the master build because of this and this is the first time I use your GUT extension.

But yeah it's likely compatible with 1.3 but will be on the next release

bitwes commented 8 months ago

I've created a PR for the godot-extension to make it easier to get the path from it. Depending on what happens with that PR I will update this extension to act accordingly.

In the meantime, if you make the following change you should be able to use this extension: Change src/utils.ts line 87 from https://github.com/bitwes/gut-extension/blob/930ea4f84ccb07083d70eac9172b0de894c7bd67/src/utils.ts#L87 To

let editorPath = vscode.workspace.getConfiguration("godotTools").get("editorPath.godot4") // or godot3

You could also just hardcode the path on this line as well.

WebF0x commented 8 months ago

Thanks a lot, I'll wait for the merge, it looks like it will be accepted soon.

PS: your TDD Pong Youtube vids are great, it's great to see that you can apply TDD to game dev!

bitwes commented 7 months ago

godot-tools 2.0 has been released so I've released Version 2.2.0 which fixes this issue.