vyperlang / blackadder

MIT License
14 stars 5 forks source link

`implements` parse error #13

Open eightyfive opened 3 years ago

eightyfive commented 3 years ago

I guess it does not work with the latest vyper version/syntax:

$ blackadder contracts/NFT.vy

error: cannot format contracts/NFT.vy: cannot use --safe with this file; failed to parse source file.  AST error message: invalid syntax (<unknown>, line 8)
Oh no! 💥 💔 💥
1 file failed to reformat.

And at line 8:

implements: ERC721

What's the status of the library ? I am not a python developer myself, but I enjoy vyperlang. I am not sure the best way to help here, I come from JS, where prettier is very popular and well integrated everywhere.

I'll have a look at how easy is it to implement a prettier-vyper plugin for the JS community. I believe a lot of JS devs are tempted by vyperlang but having to switch all tooling can be a blocker.

spinoch commented 3 years ago

Hey @eightyfive

I guess it does not work with the latest vyper version/syntax:

Yeah, that's a bug.

What's the status of the library ?

I've been meaning to work on this to get it to a minimally functional state, but have had too little time so far. Atm we're monkey-patching Python's black formatter. If we can use a language agnostic code formatter with Vyper's AST, that could be a great way to resolve https://github.com/vyperlang/blackadder/issues/7. I didn't know these language agnostic formatters were a thing until you mentioned prettier here.

It'd be great if you can come up with a prettier-vyper plugin, I think such an approach would make more sense than what we're doing here atm. I probably won't be able to help you out directly but do reach out if you need support

eightyfive commented 3 years ago

Will try to look into that as soon as possible.

Meanwhile what should I use to parse Vyper code and get the corresponding AST?

Cheers @spinoch

spinoch commented 3 years ago

The main function is https://github.com/vyperlang/vyper/blob/master/vyper/ast/utils.py#L10

spinoch commented 3 years ago

@eightyfive any progress on this?

eightyfive commented 3 years ago

Unfortunately not. Still on my list though.