gdharness 1.1.36 → 1.1.38
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cli.js +63 -22
- package/build/index.js +60 -18
- package/package.json +1 -1
package/build/cli.js
CHANGED
|
@@ -17758,7 +17758,7 @@ var init_tool_definitions = __esm(() => {
|
|
|
17758
17758
|
},
|
|
17759
17759
|
{
|
|
17760
17760
|
name: "script_edit",
|
|
17761
|
-
description: "Creates a GDScript file, or adds functions, variables and signals to one. Every declaration written carries a type. Both load what they wrote under the project's own warning settings and answer with parses; the engine's reasons for a refusal come back under engine_messages. create answers with the extends and class_name the engine read, and a script declaring a class_name is put in the project's class list, with registered saying whether it is there. modify makes every addition or none, and answers with the line each one is on in the file written. rename renames a class or a member wherever the engine uses it and writes every file or none. A new name already taken is refused with nothing written, a member's included when a class inheriting it already uses the name in code, as a local or a parameter. changed lists each file with its changed lines as they now read, and leftAlone lists every other whole-word occurrence of the old name with what the tokenizer makes of it (code, string, comment, doc, nodePath, scene, text, or ignored for a file under a .gdignore directory, which is never changed) and, where it is not plain, why: a string that is the old name whole, such as find_children's type or a call's method name, which nothing renames or compiles and which is listed first; a node named like the class; a call on a value whose type the analyser could not tell. A member rename answers under languageServer how many requests it made and how long they took. A comment
|
|
17761
|
+
description: "Creates a GDScript file, or adds functions, variables and signals to one. Every declaration written carries a type. Both load what they wrote under the project's own warning settings and answer with parses; the engine's reasons for a refusal come back under engine_messages. create answers with the extends and class_name the engine read, and a script declaring a class_name is put in the project's class list, with registered saying whether it is there. modify makes every addition or none, and answers with the line each one is on in the file written. rename renames a class or a member wherever the engine uses it and writes every file or none. A new name already taken is refused with nothing written, a member's included when a class inheriting it already uses the name in code, as a local or a parameter. changed lists each file with its changed lines as they now read, and leftAlone lists every other whole-word occurrence of the old name with what the tokenizer makes of it (code, string, comment, doc, nodePath, scene, text, or ignored for a file under a .gdignore directory, which is never changed) and, where it is not plain, why: a string that is the old name whole, such as find_children's type or a call's method name, which nothing renames or compiles and which is listed first; a node named like the class; a call on a value whose type the analyser could not tell. A member rename answers under languageServer how many requests it made and how long they took. A comment, documentation line, string or text file line with nothing more to say is given under leftAloneInProse by file, kind and line instead, and code that is certainly another symbol of the same name, a bare name in a file where nothing inherits the member or one the language server resolved to another declaration, under leftAloneOtherSymbols as each why with the files and lines it covers. summary.leftAlone counts each of the three lists beside the total. Read both before calling the rename done; nothing in them was changed. Afterwards an open editor scans the changed files and reloads every changed script, which is also the compile check, and its answer comes back under editor; with no editor the class cache is rebuilt and the changed scripts are compiled in a fresh engine, under classCache and compiled. written is true once the files are written, and ok is false when what came after the write failed: the files are left changed, and note says so.",
|
|
17762
17762
|
parameters: {
|
|
17763
17763
|
projectPath: PROJECT_PATH,
|
|
17764
17764
|
scriptPath: SCRIPT_PATH,
|
|
@@ -40136,7 +40136,7 @@ function planClassRename(args) {
|
|
|
40136
40136
|
return plan.build();
|
|
40137
40137
|
}
|
|
40138
40138
|
function planMemberRename(args) {
|
|
40139
|
-
const { texts, scripts, graph, root, family, kind, oldName, newName, resolved } = args;
|
|
40139
|
+
const { texts, scripts, graph, root, family, kind, oldName, newName, resolved, elsewhere, heirFiles } = args;
|
|
40140
40140
|
const plan = new PlanBuilder(oldName, newName);
|
|
40141
40141
|
const heirs = graph.descendants(root);
|
|
40142
40142
|
const docKind = DOC_KIND[kind];
|
|
@@ -40193,7 +40193,13 @@ function planMemberRename(args) {
|
|
|
40193
40193
|
if (mentionKind !== "code") {
|
|
40194
40194
|
return;
|
|
40195
40195
|
}
|
|
40196
|
-
|
|
40196
|
+
if (!occurrence.afterDot && !heirFiles.has(file)) {
|
|
40197
|
+
return NOT_INHERITED;
|
|
40198
|
+
}
|
|
40199
|
+
if (elsewhere.has(`${file}:${String(occurrence.offset)}`)) {
|
|
40200
|
+
return RESOLVED_ELSEWHERE;
|
|
40201
|
+
}
|
|
40202
|
+
return occurrence.afterDot ? "not resolved to this member by the language server: a value whose type the analyser could not tell, so it may be this member and is left for you" : "not resolved to this member by the language server, which gave no single declaration for it";
|
|
40197
40203
|
});
|
|
40198
40204
|
return plan.build();
|
|
40199
40205
|
}
|
|
@@ -40530,7 +40536,7 @@ function applyRewrites(rewrites) {
|
|
|
40530
40536
|
throw error;
|
|
40531
40537
|
}
|
|
40532
40538
|
}
|
|
40533
|
-
var DOC_LINK_KINDS, DOC_KIND, WHOLE_CLASS_NAME = "the whole string is the class's name, as find_children's type, a comparison with get_global_name() or a list of accepted type names takes it, and it was not changed: if it names this class, it no longer matches anything after the rename, and no compile says so", WHOLE_MEMBER_NAME = "the whole string is the member's name, as call, connect, has_method, get or set take it, and it was not changed: if it names this member, it no longer finds it after the rename, and no compile says so";
|
|
40539
|
+
var DOC_LINK_KINDS, DOC_KIND, WHOLE_CLASS_NAME = "the whole string is the class's name, as find_children's type, a comparison with get_global_name() or a list of accepted type names takes it, and it was not changed: if it names this class, it no longer matches anything after the rename, and no compile says so", WHOLE_MEMBER_NAME = "the whole string is the member's name, as call, connect, has_method, get or set take it, and it was not changed: if it names this member, it no longer finds it after the rename, and no compile says so", NOT_INHERITED = "no class in this file inherits the member, so a bare name here is that class's own local, parameter or member, or a global", RESOLVED_ELSEWHERE = "the language server resolved this to another declaration of the name";
|
|
40534
40540
|
var init_rename = __esm(() => {
|
|
40535
40541
|
init_gdscript_source();
|
|
40536
40542
|
DOC_LINK_KINDS = new Set([
|
|
@@ -40747,9 +40753,10 @@ async function renameSymbol(request, services) {
|
|
|
40747
40753
|
overrides = family.map((one) => one.file).filter((file) => file !== fileOf(root));
|
|
40748
40754
|
declaringFiles = family.map((one) => one.file);
|
|
40749
40755
|
took = { references: { asked: 0, ms: 0 }, definitions: { asked: 0, ms: 0 } };
|
|
40756
|
+
const heirFiles = new Set([...graph.descendants(root)].map(fileOf));
|
|
40750
40757
|
let resolved;
|
|
40751
40758
|
try {
|
|
40752
|
-
resolved = await resolveMember(projectPath, texts, scripts, family, symbol, services, took);
|
|
40759
|
+
resolved = await resolveMember(projectPath, texts, scripts, family, symbol, services, took, heirFiles);
|
|
40753
40760
|
} catch (error) {
|
|
40754
40761
|
if (!(error instanceof LSPTimeout)) {
|
|
40755
40762
|
throw error;
|
|
@@ -40785,7 +40792,9 @@ async function renameSymbol(request, services) {
|
|
|
40785
40792
|
kind,
|
|
40786
40793
|
oldName: symbol,
|
|
40787
40794
|
newName,
|
|
40788
|
-
resolved
|
|
40795
|
+
resolved: resolved.ours,
|
|
40796
|
+
elsewhere: resolved.elsewhere,
|
|
40797
|
+
heirFiles
|
|
40789
40798
|
});
|
|
40790
40799
|
}
|
|
40791
40800
|
if (moveTo !== null) {
|
|
@@ -40798,6 +40807,7 @@ async function renameSymbol(request, services) {
|
|
|
40798
40807
|
}, plan);
|
|
40799
40808
|
}
|
|
40800
40809
|
plan = mentionIgnored(plan, ignoredTexts(projectPath), symbol, moveTo === null ? null : declaringPath);
|
|
40810
|
+
const left = leftAloneReport(plan.mentions);
|
|
40801
40811
|
const rewrites = rewritesOf(plan, texts, moveTo === null || request.newScriptPath === null ? null : { from: declaringPath, to: moveTo, absoluteTo: request.newScriptPath });
|
|
40802
40812
|
const graph = new ClassGraph(scripts, declared);
|
|
40803
40813
|
const rank = (path) => (declaringFiles.includes(path) ? 0 : 1000) + graph.ancestors(`${path}#`).length;
|
|
@@ -40814,12 +40824,12 @@ async function renameSymbol(request, services) {
|
|
|
40814
40824
|
...overrides.length > 0 ? { overridesRenamed: overrides } : {},
|
|
40815
40825
|
...moveTo === null ? {} : { moved: { from: declaringPath, to: moveTo } },
|
|
40816
40826
|
changed: changedReport(plan.edits, rewrites),
|
|
40817
|
-
...
|
|
40818
|
-
summary: summaryOf(plan.edits, plan.mentions, rewrites)
|
|
40827
|
+
...left.lists,
|
|
40828
|
+
summary: summaryOf(plan.edits, plan.mentions, rewrites, left.counts)
|
|
40819
40829
|
}
|
|
40820
40830
|
};
|
|
40821
40831
|
}
|
|
40822
|
-
async function resolveMember(projectPath, texts, scripts, family, name, services, took) {
|
|
40832
|
+
async function resolveMember(projectPath, texts, scripts, family, name, services, took, heirFiles) {
|
|
40823
40833
|
const absoluteOf = new Map(texts.map((file) => [file.path, file.absolute]));
|
|
40824
40834
|
const key = (place) => `${place.file}:${place.offset}`;
|
|
40825
40835
|
const toResolved = (located) => {
|
|
@@ -40843,9 +40853,10 @@ async function resolveMember(projectPath, texts, scripts, family, name, services
|
|
|
40843
40853
|
}
|
|
40844
40854
|
};
|
|
40845
40855
|
const ours = new Map;
|
|
40856
|
+
const elsewhere = new Set;
|
|
40846
40857
|
const root = family[0];
|
|
40847
40858
|
if (root === undefined) {
|
|
40848
|
-
return [];
|
|
40859
|
+
return { ours: [], elsewhere };
|
|
40849
40860
|
}
|
|
40850
40861
|
const seeded = await ask("references", root);
|
|
40851
40862
|
if (seeded.length === 0) {
|
|
@@ -40861,14 +40872,19 @@ async function resolveMember(projectPath, texts, scripts, family, name, services
|
|
|
40861
40872
|
if (occurrence.kind !== "code" || ours.has(key(place))) {
|
|
40862
40873
|
continue;
|
|
40863
40874
|
}
|
|
40875
|
+
if (!occurrence.afterDot && !heirFiles.has(script.path)) {
|
|
40876
|
+
continue;
|
|
40877
|
+
}
|
|
40864
40878
|
const declared = await ask("definitions", place);
|
|
40865
40879
|
const only = declared.length === 1 ? declared[0] : undefined;
|
|
40866
40880
|
if (only !== undefined && declarations.has(key(only))) {
|
|
40867
40881
|
ours.set(key(place), place);
|
|
40882
|
+
} else if (only !== undefined) {
|
|
40883
|
+
elsewhere.add(key(place));
|
|
40868
40884
|
}
|
|
40869
40885
|
}
|
|
40870
40886
|
}
|
|
40871
|
-
return [...ours.values()];
|
|
40887
|
+
return { ours: [...ours.values()], elsewhere };
|
|
40872
40888
|
}
|
|
40873
40889
|
function changedReport(edits, rewrites) {
|
|
40874
40890
|
return rewrites.map((rewrite) => {
|
|
@@ -40907,26 +40923,49 @@ function changedReport(edits, rewrites) {
|
|
|
40907
40923
|
function leftAloneReport(mentions) {
|
|
40908
40924
|
const full = [];
|
|
40909
40925
|
const prose = new Map;
|
|
40926
|
+
const others = new Map;
|
|
40927
|
+
const counts = { quoted: 0, inProse: 0, otherSymbols: 0 };
|
|
40928
|
+
const add = (lines, line) => {
|
|
40929
|
+
if (!lines.includes(line)) {
|
|
40930
|
+
lines.push(line);
|
|
40931
|
+
}
|
|
40932
|
+
};
|
|
40910
40933
|
for (const mention of mentions) {
|
|
40911
|
-
if ((mention.kind
|
|
40934
|
+
if (PROSE_KINDS.has(mention.kind) && mention.why === undefined) {
|
|
40912
40935
|
const key = `${mention.file}
|
|
40913
40936
|
${mention.kind}`;
|
|
40914
40937
|
const group = prose.get(key) ?? { file: mention.file, kind: mention.kind, lines: [] };
|
|
40915
|
-
|
|
40916
|
-
group.lines.push(mention.line);
|
|
40917
|
-
}
|
|
40938
|
+
add(group.lines, mention.line);
|
|
40918
40939
|
prose.set(key, group);
|
|
40940
|
+
counts.inProse += 1;
|
|
40941
|
+
} else if (mention.kind === "code" && (mention.why === NOT_INHERITED || mention.why === RESOLVED_ELSEWHERE)) {
|
|
40942
|
+
const files = others.get(mention.why) ?? new Map;
|
|
40943
|
+
const lines = files.get(mention.file) ?? [];
|
|
40944
|
+
add(lines, mention.line);
|
|
40945
|
+
files.set(mention.file, lines);
|
|
40946
|
+
others.set(mention.why, files);
|
|
40947
|
+
counts.otherSymbols += 1;
|
|
40919
40948
|
} else {
|
|
40920
40949
|
full.push(mention);
|
|
40950
|
+
counts.quoted += 1;
|
|
40921
40951
|
}
|
|
40922
40952
|
}
|
|
40923
40953
|
const loudFirst = (mention) => mention.kind === "string" && mention.why !== undefined ? 0 : 1;
|
|
40924
40954
|
return {
|
|
40925
|
-
|
|
40926
|
-
|
|
40955
|
+
lists: {
|
|
40956
|
+
leftAlone: full.sort((a, b) => loudFirst(a) - loudFirst(b)),
|
|
40957
|
+
...prose.size > 0 ? { leftAloneInProse: [...prose.values()] } : {},
|
|
40958
|
+
...others.size > 0 ? {
|
|
40959
|
+
leftAloneOtherSymbols: [...others.entries()].map(([why, files]) => ({
|
|
40960
|
+
why,
|
|
40961
|
+
files: [...files.entries()].map(([file, lines]) => ({ file, lines }))
|
|
40962
|
+
}))
|
|
40963
|
+
} : {}
|
|
40964
|
+
},
|
|
40965
|
+
counts
|
|
40927
40966
|
};
|
|
40928
40967
|
}
|
|
40929
|
-
function summaryOf(edits, mentions, rewrites) {
|
|
40968
|
+
function summaryOf(edits, mentions, rewrites, left) {
|
|
40930
40969
|
const count = (values) => {
|
|
40931
40970
|
const counted = {};
|
|
40932
40971
|
for (const value of values) {
|
|
@@ -40938,11 +40977,11 @@ function summaryOf(edits, mentions, rewrites) {
|
|
|
40938
40977
|
filesChanged: rewrites.length,
|
|
40939
40978
|
edits: edits.length,
|
|
40940
40979
|
editsByKind: count(edits.map((edit) => edit.kind)),
|
|
40941
|
-
leftAlone: mentions.length,
|
|
40980
|
+
leftAlone: { total: mentions.length, ...left },
|
|
40942
40981
|
leftAloneByKind: count(mentions.map((mention) => mention.kind))
|
|
40943
40982
|
};
|
|
40944
40983
|
}
|
|
40945
|
-
var WHAT;
|
|
40984
|
+
var WHAT, PROSE_KINDS;
|
|
40946
40985
|
var init_rename_symbol = __esm(() => {
|
|
40947
40986
|
init_gdscript_source();
|
|
40948
40987
|
init_lsp_client();
|
|
@@ -40958,6 +40997,7 @@ var init_rename_symbol = __esm(() => {
|
|
|
40958
40997
|
class: "inner class",
|
|
40959
40998
|
enumValue: "enum value"
|
|
40960
40999
|
};
|
|
41000
|
+
PROSE_KINDS = new Set(["comment", "doc", "string", "text"]);
|
|
40961
41001
|
});
|
|
40962
41002
|
|
|
40963
41003
|
// src/restart-note.ts
|
|
@@ -47789,8 +47829,9 @@ To rename a class or a member across the project, use \`script_edit rename\` rat
|
|
|
47789
47829
|
replacement: it changes the uses the engine resolves, doc links and what scenes record, and lists
|
|
47790
47830
|
every other occurrence of the word for you to read: a string that is the name whole, such as a
|
|
47791
47831
|
\`find_children\` type, first under \`leftAlone\` since nothing compiles it, a file under a
|
|
47792
|
-
\`.gdignore\` directory there too,
|
|
47793
|
-
\`leftAloneInProse
|
|
47832
|
+
\`.gdignore\` directory there too, a word in a comment, a doc line, a string or a text file by
|
|
47833
|
+
line under \`leftAloneInProse\`, and a local or another class's member of the same name by line
|
|
47834
|
+
under \`leftAloneOtherSymbols\`. Pass \`preview\` first on a large rename. If the answer has \`ok: false\`
|
|
47794
47835
|
beside \`written: true\`, the files were changed and a script did not compile afterwards.
|
|
47795
47836
|
|
|
47796
47837
|
Editing a file while a game is running does not change the running game. \`auto_reload\` is an
|
package/build/index.js
CHANGED
|
@@ -30861,8 +30861,10 @@ function planClassRename(args) {
|
|
|
30861
30861
|
});
|
|
30862
30862
|
return plan.build();
|
|
30863
30863
|
}
|
|
30864
|
+
var NOT_INHERITED = "no class in this file inherits the member, so a bare name here is that class's own local, parameter or member, or a global";
|
|
30865
|
+
var RESOLVED_ELSEWHERE = "the language server resolved this to another declaration of the name";
|
|
30864
30866
|
function planMemberRename(args) {
|
|
30865
|
-
const { texts, scripts, graph, root, family, kind, oldName, newName, resolved } = args;
|
|
30867
|
+
const { texts, scripts, graph, root, family, kind, oldName, newName, resolved, elsewhere, heirFiles } = args;
|
|
30866
30868
|
const plan = new PlanBuilder(oldName, newName);
|
|
30867
30869
|
const heirs = graph.descendants(root);
|
|
30868
30870
|
const docKind = DOC_KIND[kind];
|
|
@@ -30919,7 +30921,13 @@ function planMemberRename(args) {
|
|
|
30919
30921
|
if (mentionKind !== "code") {
|
|
30920
30922
|
return;
|
|
30921
30923
|
}
|
|
30922
|
-
|
|
30924
|
+
if (!occurrence.afterDot && !heirFiles.has(file)) {
|
|
30925
|
+
return NOT_INHERITED;
|
|
30926
|
+
}
|
|
30927
|
+
if (elsewhere.has(`${file}:${String(occurrence.offset)}`)) {
|
|
30928
|
+
return RESOLVED_ELSEWHERE;
|
|
30929
|
+
}
|
|
30930
|
+
return occurrence.afterDot ? "not resolved to this member by the language server: a value whose type the analyser could not tell, so it may be this member and is left for you" : "not resolved to this member by the language server, which gave no single declaration for it";
|
|
30923
30931
|
});
|
|
30924
30932
|
return plan.build();
|
|
30925
30933
|
}
|
|
@@ -31718,9 +31726,10 @@ async function renameSymbol(request, services) {
|
|
|
31718
31726
|
overrides = family.map((one) => one.file).filter((file) => file !== fileOf(root));
|
|
31719
31727
|
declaringFiles = family.map((one) => one.file);
|
|
31720
31728
|
took = { references: { asked: 0, ms: 0 }, definitions: { asked: 0, ms: 0 } };
|
|
31729
|
+
const heirFiles = new Set([...graph.descendants(root)].map(fileOf));
|
|
31721
31730
|
let resolved;
|
|
31722
31731
|
try {
|
|
31723
|
-
resolved = await resolveMember(projectPath, texts, scripts, family, symbol, services, took);
|
|
31732
|
+
resolved = await resolveMember(projectPath, texts, scripts, family, symbol, services, took, heirFiles);
|
|
31724
31733
|
} catch (error) {
|
|
31725
31734
|
if (!(error instanceof LSPTimeout)) {
|
|
31726
31735
|
throw error;
|
|
@@ -31756,7 +31765,9 @@ async function renameSymbol(request, services) {
|
|
|
31756
31765
|
kind,
|
|
31757
31766
|
oldName: symbol,
|
|
31758
31767
|
newName,
|
|
31759
|
-
resolved
|
|
31768
|
+
resolved: resolved.ours,
|
|
31769
|
+
elsewhere: resolved.elsewhere,
|
|
31770
|
+
heirFiles
|
|
31760
31771
|
});
|
|
31761
31772
|
}
|
|
31762
31773
|
if (moveTo !== null) {
|
|
@@ -31769,6 +31780,7 @@ async function renameSymbol(request, services) {
|
|
|
31769
31780
|
}, plan);
|
|
31770
31781
|
}
|
|
31771
31782
|
plan = mentionIgnored(plan, ignoredTexts(projectPath), symbol, moveTo === null ? null : declaringPath);
|
|
31783
|
+
const left = leftAloneReport(plan.mentions);
|
|
31772
31784
|
const rewrites = rewritesOf(plan, texts, moveTo === null || request.newScriptPath === null ? null : { from: declaringPath, to: moveTo, absoluteTo: request.newScriptPath });
|
|
31773
31785
|
const graph = new ClassGraph(scripts, declared);
|
|
31774
31786
|
const rank = (path) => (declaringFiles.includes(path) ? 0 : 1000) + graph.ancestors(`${path}#`).length;
|
|
@@ -31785,12 +31797,12 @@ async function renameSymbol(request, services) {
|
|
|
31785
31797
|
...overrides.length > 0 ? { overridesRenamed: overrides } : {},
|
|
31786
31798
|
...moveTo === null ? {} : { moved: { from: declaringPath, to: moveTo } },
|
|
31787
31799
|
changed: changedReport(plan.edits, rewrites),
|
|
31788
|
-
...
|
|
31789
|
-
summary: summaryOf(plan.edits, plan.mentions, rewrites)
|
|
31800
|
+
...left.lists,
|
|
31801
|
+
summary: summaryOf(plan.edits, plan.mentions, rewrites, left.counts)
|
|
31790
31802
|
}
|
|
31791
31803
|
};
|
|
31792
31804
|
}
|
|
31793
|
-
async function resolveMember(projectPath, texts, scripts, family, name, services, took) {
|
|
31805
|
+
async function resolveMember(projectPath, texts, scripts, family, name, services, took, heirFiles) {
|
|
31794
31806
|
const absoluteOf = new Map(texts.map((file) => [file.path, file.absolute]));
|
|
31795
31807
|
const key = (place) => `${place.file}:${place.offset}`;
|
|
31796
31808
|
const toResolved = (located) => {
|
|
@@ -31814,9 +31826,10 @@ async function resolveMember(projectPath, texts, scripts, family, name, services
|
|
|
31814
31826
|
}
|
|
31815
31827
|
};
|
|
31816
31828
|
const ours = new Map;
|
|
31829
|
+
const elsewhere = new Set;
|
|
31817
31830
|
const root = family[0];
|
|
31818
31831
|
if (root === undefined) {
|
|
31819
|
-
return [];
|
|
31832
|
+
return { ours: [], elsewhere };
|
|
31820
31833
|
}
|
|
31821
31834
|
const seeded = await ask("references", root);
|
|
31822
31835
|
if (seeded.length === 0) {
|
|
@@ -31832,14 +31845,19 @@ async function resolveMember(projectPath, texts, scripts, family, name, services
|
|
|
31832
31845
|
if (occurrence.kind !== "code" || ours.has(key(place))) {
|
|
31833
31846
|
continue;
|
|
31834
31847
|
}
|
|
31848
|
+
if (!occurrence.afterDot && !heirFiles.has(script.path)) {
|
|
31849
|
+
continue;
|
|
31850
|
+
}
|
|
31835
31851
|
const declared = await ask("definitions", place);
|
|
31836
31852
|
const only = declared.length === 1 ? declared[0] : undefined;
|
|
31837
31853
|
if (only !== undefined && declarations.has(key(only))) {
|
|
31838
31854
|
ours.set(key(place), place);
|
|
31855
|
+
} else if (only !== undefined) {
|
|
31856
|
+
elsewhere.add(key(place));
|
|
31839
31857
|
}
|
|
31840
31858
|
}
|
|
31841
31859
|
}
|
|
31842
|
-
return [...ours.values()];
|
|
31860
|
+
return { ours: [...ours.values()], elsewhere };
|
|
31843
31861
|
}
|
|
31844
31862
|
function changedReport(edits, rewrites) {
|
|
31845
31863
|
return rewrites.map((rewrite) => {
|
|
@@ -31878,26 +31896,50 @@ function changedReport(edits, rewrites) {
|
|
|
31878
31896
|
function leftAloneReport(mentions) {
|
|
31879
31897
|
const full = [];
|
|
31880
31898
|
const prose = new Map;
|
|
31899
|
+
const others = new Map;
|
|
31900
|
+
const counts = { quoted: 0, inProse: 0, otherSymbols: 0 };
|
|
31901
|
+
const add = (lines, line) => {
|
|
31902
|
+
if (!lines.includes(line)) {
|
|
31903
|
+
lines.push(line);
|
|
31904
|
+
}
|
|
31905
|
+
};
|
|
31881
31906
|
for (const mention of mentions) {
|
|
31882
|
-
if ((mention.kind
|
|
31907
|
+
if (PROSE_KINDS.has(mention.kind) && mention.why === undefined) {
|
|
31883
31908
|
const key = `${mention.file}
|
|
31884
31909
|
${mention.kind}`;
|
|
31885
31910
|
const group = prose.get(key) ?? { file: mention.file, kind: mention.kind, lines: [] };
|
|
31886
|
-
|
|
31887
|
-
group.lines.push(mention.line);
|
|
31888
|
-
}
|
|
31911
|
+
add(group.lines, mention.line);
|
|
31889
31912
|
prose.set(key, group);
|
|
31913
|
+
counts.inProse += 1;
|
|
31914
|
+
} else if (mention.kind === "code" && (mention.why === NOT_INHERITED || mention.why === RESOLVED_ELSEWHERE)) {
|
|
31915
|
+
const files = others.get(mention.why) ?? new Map;
|
|
31916
|
+
const lines = files.get(mention.file) ?? [];
|
|
31917
|
+
add(lines, mention.line);
|
|
31918
|
+
files.set(mention.file, lines);
|
|
31919
|
+
others.set(mention.why, files);
|
|
31920
|
+
counts.otherSymbols += 1;
|
|
31890
31921
|
} else {
|
|
31891
31922
|
full.push(mention);
|
|
31923
|
+
counts.quoted += 1;
|
|
31892
31924
|
}
|
|
31893
31925
|
}
|
|
31894
31926
|
const loudFirst = (mention) => mention.kind === "string" && mention.why !== undefined ? 0 : 1;
|
|
31895
31927
|
return {
|
|
31896
|
-
|
|
31897
|
-
|
|
31928
|
+
lists: {
|
|
31929
|
+
leftAlone: full.sort((a, b) => loudFirst(a) - loudFirst(b)),
|
|
31930
|
+
...prose.size > 0 ? { leftAloneInProse: [...prose.values()] } : {},
|
|
31931
|
+
...others.size > 0 ? {
|
|
31932
|
+
leftAloneOtherSymbols: [...others.entries()].map(([why, files]) => ({
|
|
31933
|
+
why,
|
|
31934
|
+
files: [...files.entries()].map(([file, lines]) => ({ file, lines }))
|
|
31935
|
+
}))
|
|
31936
|
+
} : {}
|
|
31937
|
+
},
|
|
31938
|
+
counts
|
|
31898
31939
|
};
|
|
31899
31940
|
}
|
|
31900
|
-
|
|
31941
|
+
var PROSE_KINDS = new Set(["comment", "doc", "string", "text"]);
|
|
31942
|
+
function summaryOf(edits, mentions, rewrites, left) {
|
|
31901
31943
|
const count = (values) => {
|
|
31902
31944
|
const counted = {};
|
|
31903
31945
|
for (const value of values) {
|
|
@@ -31909,7 +31951,7 @@ function summaryOf(edits, mentions, rewrites) {
|
|
|
31909
31951
|
filesChanged: rewrites.length,
|
|
31910
31952
|
edits: edits.length,
|
|
31911
31953
|
editsByKind: count(edits.map((edit) => edit.kind)),
|
|
31912
|
-
leftAlone: mentions.length,
|
|
31954
|
+
leftAlone: { total: mentions.length, ...left },
|
|
31913
31955
|
leftAloneByKind: count(mentions.map((mention) => mention.kind))
|
|
31914
31956
|
};
|
|
31915
31957
|
}
|
|
@@ -33083,7 +33125,7 @@ var TOOL_SPECS = [
|
|
|
33083
33125
|
},
|
|
33084
33126
|
{
|
|
33085
33127
|
name: "script_edit",
|
|
33086
|
-
description: "Creates a GDScript file, or adds functions, variables and signals to one. Every declaration written carries a type. Both load what they wrote under the project's own warning settings and answer with parses; the engine's reasons for a refusal come back under engine_messages. create answers with the extends and class_name the engine read, and a script declaring a class_name is put in the project's class list, with registered saying whether it is there. modify makes every addition or none, and answers with the line each one is on in the file written. rename renames a class or a member wherever the engine uses it and writes every file or none. A new name already taken is refused with nothing written, a member's included when a class inheriting it already uses the name in code, as a local or a parameter. changed lists each file with its changed lines as they now read, and leftAlone lists every other whole-word occurrence of the old name with what the tokenizer makes of it (code, string, comment, doc, nodePath, scene, text, or ignored for a file under a .gdignore directory, which is never changed) and, where it is not plain, why: a string that is the old name whole, such as find_children's type or a call's method name, which nothing renames or compiles and which is listed first; a node named like the class; a call on a value whose type the analyser could not tell. A member rename answers under languageServer how many requests it made and how long they took. A comment
|
|
33128
|
+
description: "Creates a GDScript file, or adds functions, variables and signals to one. Every declaration written carries a type. Both load what they wrote under the project's own warning settings and answer with parses; the engine's reasons for a refusal come back under engine_messages. create answers with the extends and class_name the engine read, and a script declaring a class_name is put in the project's class list, with registered saying whether it is there. modify makes every addition or none, and answers with the line each one is on in the file written. rename renames a class or a member wherever the engine uses it and writes every file or none. A new name already taken is refused with nothing written, a member's included when a class inheriting it already uses the name in code, as a local or a parameter. changed lists each file with its changed lines as they now read, and leftAlone lists every other whole-word occurrence of the old name with what the tokenizer makes of it (code, string, comment, doc, nodePath, scene, text, or ignored for a file under a .gdignore directory, which is never changed) and, where it is not plain, why: a string that is the old name whole, such as find_children's type or a call's method name, which nothing renames or compiles and which is listed first; a node named like the class; a call on a value whose type the analyser could not tell. A member rename answers under languageServer how many requests it made and how long they took. A comment, documentation line, string or text file line with nothing more to say is given under leftAloneInProse by file, kind and line instead, and code that is certainly another symbol of the same name, a bare name in a file where nothing inherits the member or one the language server resolved to another declaration, under leftAloneOtherSymbols as each why with the files and lines it covers. summary.leftAlone counts each of the three lists beside the total. Read both before calling the rename done; nothing in them was changed. Afterwards an open editor scans the changed files and reloads every changed script, which is also the compile check, and its answer comes back under editor; with no editor the class cache is rebuilt and the changed scripts are compiled in a fresh engine, under classCache and compiled. written is true once the files are written, and ok is false when what came after the write failed: the files are left changed, and note says so.",
|
|
33087
33129
|
parameters: {
|
|
33088
33130
|
projectPath: PROJECT_PATH,
|
|
33089
33131
|
scriptPath: SCRIPT_PATH,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gdharness",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.38",
|
|
4
4
|
"mcpName": "io.github.Aureliolo/gdharness",
|
|
5
5
|
"description": "A harness for driving a Godot 4 project from an agent: editor addons, a runtime bridge into the running game, an MCP server in front of them, and a CLI that installs and diagnoses the Godot side.",
|
|
6
6
|
"type": "module",
|