Skip to content

Commit 03c0ccc

Browse files
CopilotDaanV2
andauthored
fix: support quoted structure names in structure command diagnostics (#456)
Quoted structure names in commands (e.g. `structure load "mystructure:house" ~ ~ ~`) triggered false "missing structure" errors because the diagnoser compared the raw token—including surrounding quotes—against stored unquoted IDs. ## Changes - **`diagnose_structure_implementation`** — call `Text.UnQuote()` on the resolved ID string before all lookup checks, consistent with how other diagnosers (tickingarea, fake-entity, mcfunction, etc.) handle quoted tokens. - **Structure diagnoser test** — add a case asserting that a quoted token resolves cleanly when the unquoted ID exists in the pack. ``` # Before — false positive error structure load "mystructure:house" ~ ~ ~ # ^^^^^^^^^^^^^^^^^^^ → looked up as `"mystructure:house"`, not found # After — no error structure load "mystructure:house" ~ ~ ~ # → stripped to `mystructure:house`, found ✓ ``` --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: DaanV2 <2393905+DaanV2@users.noreply.github.com>
1 parent 9712013 commit 03c0ccc

3 files changed

Lines changed: 15 additions & 2 deletions

File tree

ide/vscode/src/version.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export const Version = "9.0.31";
1+
export const Version = "9.0.32";

packages/bedrock-diagnoser/src/diagnostics/behavior-pack/structure/diagnose.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { OffsetWord } from 'bc-minecraft-bedrock-shared';
2+
import { Text } from 'bc-minecraft-bedrock-project';
23
import { Errors } from '../..';
34
import { DiagnosticsBuilder } from '../../../types';
45
import { check_definition_value } from '../../definitions';
@@ -7,7 +8,7 @@ export function diagnose_structure_implementation(
78
id: OffsetWord | string,
89
diagnoser: DiagnosticsBuilder,
910
): boolean {
10-
const strId = typeof id === 'string' ? id : id.text;
11+
const strId = Text.UnQuote(typeof id === 'string' ? id : id.text);
1112

1213
const data = diagnoser.context.getProjectData().projectData;
1314

packages/bedrock-diagnoser/test/lib/diagnostics/behavior-pack/structure.test.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,18 @@ describe("BehaviorPack", () => {
4848
diagnoser.expectEmpty();
4949
});
5050

51+
it("quoted structure name is looked up unquoted", () => {
52+
data.behaviorPacks.packs[0].structures.set({
53+
id: "mystructure:house",
54+
documentation: "",
55+
location: { position: 0, uri: "" },
56+
});
57+
58+
diagnose_structure_implementation({ offset: 0, text: '"mystructure:house"' }, diagnoser);
59+
60+
diagnoser.expectEmpty();
61+
});
62+
5163
it("missing structure reports error", () => {
5264
diagnose_structure_implementation({ offset: 0, text: "puff:coin1" }, diagnoser);
5365

0 commit comments

Comments
 (0)