Closed spacesailor24 closed 5 years ago
Please give me until tomorrow to check this. Thank you for the report.
Of course, again let me know if there is any additional information I can provide.
I think the problem is more complex that I'm currently capable of tackling... probably, not sure yet...
What I planned to do for a long time and I still think it's rather easily doable (again, maybe with some help from community... would be welcome, of course) is this:
http://www.sublimetext.com/docs/3/syntax.html
Main point:
Sublime Text can use both .sublime-syntax and .tmLanguage files for syntax highlighting. This document describes .sublime-syntax files.
Basically .tmLanguage
is the old way with regular expresions that is already showing cracks (as you can see with some open issues). .sublime-syntax
works with stacks and contexts.
So quick question for you:
can you point me to some resources in understanding how exactly Linguist works for this case?
Would rewrite help here "automatically" or if not, then at least is it a good next step?
I won't be able to do anything on this project until rewrite (whenever that is, I hope soon, I started working on it "today"), will push some code on separate branch in a few days... EXCEPT I can do really small tweaks if I come to understand why pragma breaks when doing your Linguist magic...
As you can see here, it doesn't have anything to do with the sublime syntax definition itself (except as I say because it's the old way of doing things and Linguist would work better with new stack based syntax?):
@alexvandesande could also probably join the conversation?
I'm confused because the original Adoption.sol
contract I showed you now has proper syntax highlighting in Github even with the ^
before the solidity version:
However, this contract, Migrations.sol
, doesn't have syntax highlighting and the reason is because it doesn't have the two blank lines before the contract definition:
Before adding an extra line:
After adding an extra line:
Any thoughts? I see that nothing has changed in Master for this repository
Hi @spacesailor24 -- a few more days and we can observe if it fixes the issue and if not, investigate from there... see here for progress report: https://github.com/davidhq/SublimeEthereum/issues/24
new syntax parser has been published, now we wait for github linguist to pick it up
Something was broken with the latest changes:
The source file on the screen: https://github.com/poanetwork/poa-network-consensus-contracts/blob/master/contracts/BallotsStorage.sol
Thanks. Also, something strange with colors - they were changed, I think. For example, on the screen the validatorSetContract
variable has different colors (I didn't change anything in settings):
The corresponding file: https://github.com/poanetwork/pos-contracts/blob/master/contracts/BlockRewardAuRa.sol
Hi, yes indeed some rather minor color changes do happen with new syntax parsing. All hopefully for the better.
I will examine this particular case later today and explain what happened and if I think it’s a good idea or if it needs discussion or it’s a bug.
@varasev I pushed the updates, some colors are back as before and there are additional fixes. Thank you very much for these reports, please write back if anything is still broken.
@spacesailor24 as for the original reported issue, I now identified one contract example here that is not properly identified by Linguist. And here is one that is properly highlighted.
GitHub hasn't yet updated their submodule reference to the latest version of SublimeEthereum
but before they do that, I'll try to test locally and see if the new .sublime-syntax is even supported etc. So, soon we know a bit more and thank you again for the report.
@davidhq Thank you for fixing, it seems to be fine now, but I still see a few minor color inconsistencies:
In the same file: https://github.com/poanetwork/pos-contracts/blob/master/contracts/BlockRewardAuRa.sol
In which IDE do you get such colors? I get this locally in my SublimeText:
So here it seems ok, please check again why difference at your side.
Also try some other theme and see if your theme brings in these inconsistencies.. I still probably can do something to fix this but we have to know where it comes from actually.
I use Sublime Text 3.0, build 3170
with packages Ethereum v1.1.3
and ColorSublime v2.1.0
. The color scheme on my above screen is Dawn
.
If I try to switch to some of default color schemes, I get the same issue. For example (Mariana
color scheme):
I think now in v1.1.5
it's fixed... btw a tip for any further problem detection → you can use :
While editing in Sublime Text, you can check what scopes have been applied to the text under the caret by pressing control+shift+p (OSX) or ctrl+alt+shift+p (Windows and Linux).
I used that to see that I used different scopes for two things you were showing and none of my themes were so exact as to apply some other styling to variable.language
scope... I now removed this scope from syntax highlighting.
Thank you, it's ok now.
Hi there, I noticed that this repo is being used to provide the syntax highlighting in Github repositories using Linguist.
I also noticied that syntax highlighting works fine when there is no
^
present in the Solidity version like so: Usingpragma solidity 0.4.17;
will yield:But when using the
^
like so:pragma solidity 0.4.17;
will yield:Please let me know if there is anymore information I can provide, and thank you for creating SublimeEthereum!