Yesterday17 / ZenScript

Visual Studio Code extension/Language Server for ZenScript, includes highlight, code snippet and language server(WIP). Works with πŸ‘‡
https://github.com/Yesterday17/Probe
MIT License
34 stars 4 forks source link

ZenCode support #41

Open rlnt opened 3 years ago

rlnt commented 3 years ago

Hey there,

you may know me as a long time user of your glorious extension which saved me a ton of time while developing modpacks.

I know you didn't have much time lately as I also submitted other issues where you explained that.

But do you think it would be possible to develop a similar extension for newer versions of minecraft such as 1.16?

There would be a lot to do tho since the way Crafttweaker works changed a lot in that version. It would probably be a better idea to create a completely new extension called ZenCode or something since the language CT uses is ZenCode now and no longer ZenScript. Also the syntax changed quite a bit since they are using item tags now and no longer bracket handlers.

The probe mod to dump all information can stay the same as it can be a separate mod for each version of minecraft. But you would need to update it as well because it needs to store everything as item tags and not as bracket handlers anymore.

I know this is a ton of work but there isn't something so useful like your extension for 1.16 yet and developing modpacks is a pain. I'd be ready to become a backer of your project if you want to make some money with it and would happily donate if that helps you investing some of your time on that project.

Let me know your thoughts of that.

Yesterday17 commented 3 years ago

Since my network condition is bad these days, it's hard to set up the latest dev environment for Probe. So I'll work on the extension(lexer and parser) first.

rlnt commented 3 years ago

Awesome! I didn't expect such a fast answer and such enthusiasm. ❀️

So, you plan to add ZenCode support to the same extension? If you need any reference, here is the official repository where they have a lot of their definitions which could become quite handy for the parser and the linter: https://github.com/ZenCodeLang/ZenCode

kindlich commented 3 years ago

πŸ“ For getting info about Bracket Handlers: CraftTweaker in 1.16 already provides ways for you to get a dump of all Bracket handlers using a special command /ct dumpBrackets. This will create several files in the <mc_root>/ct_dumps folder. For bracket handler completion, you could already use that. The format of these files is one matching Bracket expression per line and one file per Bracket expression type. The bracket expressions inside these files are sorted alphabetically if my memory server correctly (in case some of your code may need that info as optimization).

πŸ’‘ Info regardig ZC We're also working on some docs for ZC (though personally I don't have that much time recently...), you can find an early version describing the syntax of some script files here: https://zencode.blamejared.com/language/

πŸ“ For getting the methods/globals and the like: You can already get all registered classes using the CraftTweakerRegistry. From there as well as from the ZenClassRegistry that it exposes you should get access to all classes currently registrered to CraftTweaker.

Afaik we currently have not way to properly export the inner definitions so you would have to recreate some workings to get the definitions in your own format. If you need some assistance there, or feel that something may be easier if it was instead added to CraftTweaker, don't hesistate to reach out πŸ˜‰

⚠️ BEPs to take into consideration You may also need to be careful, since currently we have some "special" Bracket Expression Parsers, one for recipetypes and one for Tags (not NBT tags, but Item/Block/Fluid tags, the new concept similar to oredicts). Their handling inside ZC is different due to them having different return types depending on the type provided. For example, the reciptype BEP returns the matching RecipeManager (typed, so ZC knows what special methods it has). This means that <recipetype:minecraft:crafting> would return CraftingTableManager whereas <recipetype:minecraft:smelting> would return FurnaceManager.

Tags on the other hand always return MCTag<T> but the T depends on the tag BEP. So <tag:items:minecraft:wool> would return MCTag<Item> whereas <tag:fluids:minecraft:water> would return MCTag<Fluid>

rlnt commented 3 years ago

@kindlich Thanks a lot for visiting this issue and for the detailed explanation! ❀️ This project has a lot of potential and was a huge time-saver for 1.12 modpack creation. It would be nice if he manages to update it for the new version.

rlnt commented 3 years ago

Hit me up on Discord if you need any help or testing @Yesterday17. I would be more than happy to help. :) Relentless#3812