Skip to content

Commit e99adb0

Browse files
authored
Debugger QOL improvements and small fixes (#944)
* Stale variables fix * Introduced by #848 * Fixes #935 * Debugger QOL improvements and fixes * Property rename to match expected behavior: ** members now do not have a prefix in object instances: Member/Foo -> Foo ** Inherited properties now do have a prefix: Parent1/Foo, ParentOfParent1/Boo ** Categories are properly treated and not displayed as property * __repr__ support ** If the class contains __repr__ member, value of it will be used as a display name for it's instances representations. That works for Dictionary keys too. Smaller changes and fixes: * Arrays to display actual values for more complex types in preview (Vectors/Rects/etc) * Strings are 'quoted' (similar to other DAPs) * Rect2i fix (parse as int, not float) * StrnigName better representation in values and dict keys: &'StringName' * tasks discoverabilty: Added tasks for test and package to tasks.json. * code cleanup & array support * fix * missed vscode_id for ObjectId * some linter fixes * CI: Godot version bump to 4.5.1 Test project: update test proj * handling unset Godot Objects * make sure to stop prev client * test project to 4.6 update
1 parent dc48e50 commit e99adb0

22 files changed

Lines changed: 1222 additions & 1064 deletions

.github/ISSUE_TEMPLATE/bug_report.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ body:
1818
description: >
1919
Specify the Git commit hash if using a development or non-official build.
2020
If you use a custom build, please test if your issue is reproducible in official builds too.
21-
placeholder: 4.3.stable, 4.4.dev1 (28a72fa43)
21+
placeholder: 4.5.1.stable, 4.6.dev0 (6fd949a)
2222
validations:
2323
required: true
2424

.github/workflows/ci.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,25 +21,25 @@ jobs:
2121
- name: Install Godot (Ubuntu)
2222
if: matrix.os == 'ubuntu-latest'
2323
run: |
24-
wget https://github.com/godotengine/godot/releases/download/4.3-stable/Godot_v4.3-stable_linux.x86_64.zip
25-
unzip Godot_v4.3-stable_linux.x86_64.zip
26-
sudo mv Godot_v4.3-stable_linux.x86_64 /usr/local/bin/godot
24+
wget https://github.com/godotengine/godot/releases/download/4.5.1-stable/Godot_v4.5.1-stable_linux.x86_64.zip
25+
unzip Godot_v4.5.1-stable_linux.x86_64.zip
26+
sudo mv Godot_v4.5.1-stable_linux.x86_64 /usr/local/bin/godot
2727
chmod +x /usr/local/bin/godot
2828
2929
- name: Install Godot (macOS)
3030
if: matrix.os == 'macos-latest'
3131
run: |
32-
curl -L -o Godot.zip https://github.com/godotengine/godot/releases/download/4.3-stable/Godot_v4.3-stable_macos.universal.zip
32+
curl -L -o Godot.zip https://github.com/godotengine/godot/releases/download/4.5.1-stable/Godot_v4.5.1-stable_macos.universal.zip
3333
unzip Godot.zip
3434
sudo mv Godot.app /Applications/Godot.app
3535
sudo ln -s /Applications/Godot.app/Contents/MacOS/Godot /usr/local/bin/godot
3636
3737
- name: Install Godot (Windows)
3838
if: matrix.os == 'windows-latest'
3939
run: |
40-
Invoke-WebRequest -Uri "https://github.com/godotengine/godot/releases/download/4.3-stable/Godot_v4.3-stable_win64.exe.zip" -OutFile "Godot.zip"
41-
Expand-Archive -Path "Godot.zip" -DestinationPath "C:\Godot43"
42-
"C:\Godot43\Godot_v4.3-stable_win64.exe %*" | Out-File -Encoding ascii -FilePath ([Environment]::SystemDirectory+"\godot.cmd")
40+
Invoke-WebRequest -Uri "https://github.com/godotengine/godot/releases/download/4.5.1-stable/Godot_v4.5.1-stable_win64.exe.zip" -OutFile "Godot.zip"
41+
Expand-Archive -Path "Godot.zip" -DestinationPath "C:\Godot451"
42+
"C:\Godot451\Godot_v4.5.1-stable_win64.exe %*" | Out-File -Encoding ascii -FilePath ([Environment]::SystemDirectory+"\godot.cmd")
4343
4444
- name: Install dependencies
4545
run: npm install

.vscode/tasks.json

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,23 @@
1515
"kind": "build",
1616
"isDefault": true
1717
}
18-
}
18+
},
19+
{
20+
"type": "npm",
21+
"script": "test",
22+
"group": {
23+
"kind": "test",
24+
"isDefault": true
25+
}
26+
},
27+
{
28+
"type": "npm",
29+
"script": "package",
30+
"label": "Package extension (vsix)",
31+
"group": {
32+
"kind": "build",
33+
"isDefault": false
34+
}
35+
},
1936
]
2037
}

CONTRIBUTING.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
2. Download dependencies by using the command `npm install`
1313
3. When done, package a VSIX file by using the command `npm run package`.
1414
4. Install it by opening Visual Studio Code, opening the Extensions tab, clicking on the More actions (**...**) button in the top right, and choose **Install from VSIX...** and find the compiled VSIX file.
15+
5. Testing: `npm run test` to execute tests.
1516

1617
When developing for the extension, you can open this project in Visual Studio Code and debug the extension by using the **Run Extension** launch configuration instead of going through steps 3 and 4. It will launch a new instance of Visual Studio Code that has the extension running. You can then open a Godot project folder and debug the extension or GDScript debugger.
1718

@@ -32,8 +33,8 @@ An example `workspace.code-workspace` file:
3233
"godotTools.editorPath.godot3": "godot3.dev.exe",
3334
"godotTools.editorPath.godot4": "godot4.dev.exe",
3435
// "godotTools.editorPath.godot4": "godot4.custom.exe"
35-
// "godotTools.editorPath.godot4": "Godot_v4.1.1-stable_win64.exe",
36-
"godotTools.lsp.headless": false
36+
// "godotTools.editorPath.godot4": "Godot_v4.1.1-stable_win64.exe",
37+
"godotTools.lsp.headless": false
3738
}
3839
}
3940
```

src/debugger/godot4/debug_session.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export class GodotDebugSession extends LoggingDebugSession {
2727
private configuration_done: Subject = new Subject();
2828
private mode: "launch" | "attach" | "" = "";
2929

30-
public variables_manager = new VariablesManager(this.controller);
30+
public variables_manager: VariablesManager;
3131

3232
public constructor(projectVersion: string) {
3333
super();

src/debugger/godot4/helpers.ts

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { GodotVariable } from "../debug_runtime";
22
import { SceneNode } from "../scene_tree_provider";
3-
import { ObjectId } from "./variables/variants";
3+
import { VariablesManager } from "./variables/variables_manager";
4+
import { ObjectId, StringName } from "./variables/variants";
45

56
export function parse_next_scene_node(params: any[], ofs: { offset: number } = { offset: 0 }): SceneNode {
67
const childCount: number = params[ofs.offset++];
@@ -32,23 +33,29 @@ export function split_buffers(buffer: Buffer) {
3233
return buffers;
3334
}
3435

35-
export function get_sub_values(value: any): GodotVariable[] {
36+
export async function get_sub_values(value: any, variables_manager: VariablesManager): Promise<GodotVariable[]> {
3637
let subValues: GodotVariable[] = undefined;
3738

3839
if (value) {
3940
if (Array.isArray(value)) {
40-
subValues = value.map((va, i) => {
41-
return { name: `${i}`, value: va } as GodotVariable;
41+
subValues = value.map((val, i) => {
42+
const godot_id = val instanceof ObjectId ? val.id : undefined;
43+
return { id: godot_id, name: `${i}`, value: val } as GodotVariable;
4244
});
4345
} else if (value instanceof Map) {
4446
subValues = [];
4547
for (const [key, val] of value.entries()) {
46-
const name =
47-
typeof key.stringify_value === "function"
48-
? `${key.type_name()}${key.stringify_value()}`
49-
: `${key}`;
48+
let key_name = "";
49+
if (typeof key?.get_rendered_value === "function") { // (key instanceof ObjectId), (key instanceof StringName)
50+
key_name = await key.get_rendered_value(variables_manager);
51+
} else {
52+
key_name =
53+
typeof key.stringify_value === "function"
54+
? `${key.type_name()}${key.stringify_value()}`
55+
: `${key}`;
56+
}
5057
const godot_id = val instanceof ObjectId ? val.id : undefined;
51-
subValues.push({ id: godot_id, name, value: val } as GodotVariable);
58+
subValues.push({ id: godot_id, name: key_name, value: val } as GodotVariable);
5259
}
5360
} else if (typeof value.sub_values === "function") {
5461
subValues = value.sub_values()?.map((sva) => {
@@ -58,7 +65,7 @@ export function get_sub_values(value: any): GodotVariable[] {
5865
}
5966

6067
for (let i = 0; i < subValues?.length; i++) {
61-
subValues[i].sub_values = get_sub_values(subValues[i].value);
68+
subValues[i].sub_values = await get_sub_values(subValues[i].value, variables_manager);
6269
}
6370

6471
return subValues;

0 commit comments

Comments
 (0)