mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-11-29 01:04:29 +00:00
Read namespaced snippet folders and list snippets
- Resolve snippet references in snippet/<type>/ first, then in snippet/iris/<group>/<type>/ - Route every reference-to-file lookup through SnippetFolders - Inline list snippets as their entries inside lists of snippet types - Read values as JSON trees so a malformed entry is skipped instead of re-read forever - List snippets from both layouts in schemas and workspace file matches - Add tests for both layouts, list inlining, the malformed value loop and a pack walk
This commit is contained in:
1 parent
ed037ea40b
commit
08df9a4ca4
17 files changed
+1010
-115
No files matched your search
+2
-7
@@ -24,14 +24,13 @@ import art.arcane.iris.pack.schema.SchemaBuilder;
|
||||
import art.arcane.iris.pack.schema.annotation.Snippet;
|
||||
import art.arcane.iris.spi.IrisLogging;
|
||||
import art.arcane.iris.world.task.J;
|
||||
import art.arcane.volmlib.util.collection.KList;
|
||||
import art.arcane.volmlib.util.format.Form;
|
||||
import art.arcane.volmlib.util.io.IO;
|
||||
import art.arcane.volmlib.util.json.JSONArray;
|
||||
import art.arcane.volmlib.util.json.JSONObject;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
public final class ModdedWorkspaceGenerator {
|
||||
private ModdedWorkspaceGenerator() {
|
||||
@@ -100,11 +99,7 @@ public final class ModdedWorkspaceGenerator {
|
||||
try {
|
||||
String snipType = snippetClass.getDeclaredAnnotation(Snippet.class).value();
|
||||
JSONObject entry = new JSONObject();
|
||||
KList<String> fileMatch = new KList<>();
|
||||
|
||||
for (int depth = 1; depth < 8; depth++) {
|
||||
fileMatch.add("/snippet/" + snipType + Form.repeat("/*", depth) + ".json");
|
||||
}
|
||||
List<String> fileMatch = data.getSnippetFolders(snipType).workspaceFileMatches();
|
||||
|
||||
entry.put("fileMatch", new JSONArray(fileMatch.toArray()));
|
||||
entry.put("url", "./.iris/schema/snippet/" + snipType + "-schema.json");
|
||||
|
||||
Reference in new issue
Block a user