A human-friendly DSL for ATProto Lexicons mlf.lol

Imports Do Not Work As Described in the Docs When Importing Without `as` or `{}` #10

Closed stavola.xyz
Closed opened by stavola.xyz

I've got a simple scenario where I have a defs file like this:

com/example/defs.mlf:

def type exampleDef = {
  name: string
};

I can't import it like this:

com/example/post.mlf:

use com.example.defs.exampleDef;

record post {
  thing: exampleDef
}

But I can import it like this:

use com.example.defs.exampleDef;

record post {
  thing: exampleDef
}

Or like this:

use com.example.defs.{exampleDef};

record post {
  thing: exampleDef
}

I have an AI fix for it if you want me to open a PR so you can look at it, but I haven't spent the time to understand it yet, and I'm happy to just use the workaround, now that I realized there is a workaround.

I found that the workaround didn't actually work for mlf generate, even though it works for mlf check.

More AI fixing and it looks like the issue is that the generate command wasn't creating a workspace, it was just compiling all the files individually.


After the AI fixed that, I also noticed that the generated defs reference is wrong if you import a module module, and then try to reference definitions in that module.

i.e. if I use com.example.defs.exmpleDef and then in the lexicon, then ref will be com.example.defs#exampleDef, but if I use com.example.defs and then I reference it with defs.exmpleDef, the ref in the lexicon file will be just defs#exampleDef instead of having the full path.

I guess that should probably be a new issue. This has taken a bit longer than I thought and I do need to get these lexicons going. 😅 I think I'll probably try out typelex real quick to see how that goes.

I don't want to open a mostly-unreviewed AI PR unless you ask for it, but here is the commit that seem to fix this issue if you are interested: https://tangled.org/zicklag.dev/mlf/commit/3a2f4f9cda49c5fbf885dd4c8663ace99e7261e8

This should be fixed now.

Sign up or Sign in to add to the discussion.