davidhq / SublimeEthereum

Ethereum Solidity, Vyper, Yul and StarkNet Cairo language syntaxes
MIT License
116 stars 43 forks source link

Highlight last item in a parameter list if separated from closing paren by a newline #24

Closed ldct closed 5 years ago

ldct commented 6 years ago

Currently, the last item on this list is not highlighted properly:

image

It is correct if either 1) a comma is inserted after bytes32[] s, or 2) the newline between the bytes32[] s and the closing paren is deleted. However (1) is a syntax error in solidity and (2) is ugly.

davidhq commented 6 years ago

Thank you for this report, I think I noticed this already and tried to fix it but it was almost impossible with how it's currently implemented. SublimeText recently implemented better syntax definition system and I plan to investigate after holidays (august ...). After possible rewrite of solidity highlighter in updated system, I will try to tackle these edge cases, hopefully it will be easier. If someone has a temporary fix now, welcome, otherwise we see after cleanup and rewrite.

Thank you again!

paulofelipe84 commented 5 years ago

Another one here who's missing that! Any news about it?

davidhq commented 5 years ago

Hi there! I'm quite sorry, finishing something important, but slowly getting back to this rewrite, see discussion here: https://github.com/davidhq/SublimeEthereum/issues/29

I hope and believe that until 15.1.18 this package could be rewritten to the new syntax parsing system.

davidhq commented 5 years ago

I have some good news:

screen shot 2019-01-15 at 02 53 16

This is how the rewrite in the new context push syntax looks for the function:

https://gist.github.com/davidhq/811662ede7c304e146ed73c9e8e27259

So I managed to move forward with this greatly, I think there are no big open questions and I understand how to implement the rest of this, I just need a few more days to finish... will let you know when it can be tested.

davidhq commented 5 years ago

Another update, current state of capabilites:

screen shot 2019-01-16 at 22 11 33

I think most of big things are implemented, but I do still need to finish conditionals and loops... I hope no big issues there... So far it's 500 LOC, expect 200 or so more... old parser was 100 lines in total.

davidhq commented 5 years ago

done, please test

davidhq commented 5 years ago

Yes, it seems that PackageControl hack picked up v1.1.0 already... so it should install automatically if you have packages auto-update turned on as by default, if not, update the package Ethereum manually inside SublimeText

paulofelipe84 commented 5 years ago

Yeah, you can see that I even removed my comment. I had to uninstall and re-install it.

It works! Thanks heaps, David!

davidhq commented 5 years ago

Some very minor highlighting is missing (mainly from here, to be released in v1.1.1 quite soon, together with any issues you guys report by then...)

Enjoy better colors! this was harder to implement than I thought... or better said I suspected it would be hard and so I procrastinated for over a year in tackling it ^_^

Now it finally should also be easy to understand and contribute minor or major (?) enhancements . As well as being able to learn quite a lot about Solidity itself by looking at solidity-syntax file.

@paulofelipe84 yes I saw your comment was removed after I posted my reply. Anyway, if someone else has problems with update, I'd also like to know if it's always needed to remove and re-install... you probably have packages auto-update turned off... or it might just be enough to wait a little, not sure how auto-update for packages works exactly / how frequently it checks for new package releases.