Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

solidity syntax highlighting for codemirror #5

Closed
1 task done
serapath opened this issue Jul 19, 2018 · 15 comments
Closed
1 task done

solidity syntax highlighting for codemirror #5

serapath opened this issue Jul 19, 2018 · 15 comments
Assignees
Labels
#editor specification category up for grabs outsource task for third parties
Milestone

Comments

@serapath serapath mentioned this issue Jul 19, 2018
@serapath serapath added the up for grabs outsource task for third parties label Jul 19, 2018
@serapath
Copy link
Contributor Author

got some inspiration and wonder if it makes sense to have scope highlighting in solidity.
Don't know the exact scoping rules of solidity yet i have to say, but here is the link:

@raphaelhuefner
Copy link

My opinion on scope highlighting:

In general, I agree that scope highlighting is more helpful than "just" syntax highlighting. (I certainly liked how Eclipse was more helpful by having a deeper understanding of the code, before I ditched it for being resource-heavy.)

I will keep scope highlighting in mind when porting the ACE Solidity highlighter over to CodeMirror, but I think it should be kept in it's own GitHub issue and should only be worked on after the syntax highlighting is done.

My first hunch is that scope highlighting could turn out to be resource intensive, that's why I would strongly suggest to make it configurable, i.e. allow the user to turn it off:

I believe that in order to get scope highlighting to work, we need to keep an AST representation of the source code around. (Your example uses JSLint, most likely for that.) I will try to research if there are any AST parsers which can deal with line-by-line changes, i.e. don't have to re-parse the whole file each time only one line got changed. CodeMirror's syntax highlighting works like that:

[...] CodeMirror needs to keep valid versions of a state around so that it can restart a parse at any line [...]

(source)

If it - against my gut feeling - turns out to be light on resources, then all the better.

@serapath
Copy link
Contributor Author

sweet :-)

@serapath
Copy link
Contributor Author

@raphaelhuefner did you already do something ragrding any porting of syntax highlighting?

you can see a rough preview of the editor embedded in a workshop here:

Currently we just apply javascript syntax highlitghting and it kinda works because of solidity being slightly similar to javascript :-)

@raphaelhuefner
Copy link

@serapath Looks great! I'll get started with it in the next few days, but I doubt it will be ready before Christmas.

@alincode
Copy link

alincode commented Apr 24, 2019

todo list:

https://docs.google.com/spreadsheets/d/1xEGdDAK-2_dKgGZbkieaWAfOkNd-LYA07t3llkAmFYI/edit?usp=sharing

code:

https://github.com/alincode/CodeMirror

@alincode
Copy link

alincode commented May 7, 2019

total item: 49
work on progress: 5
todo: 2

@mfix22
Copy link

mfix22 commented May 30, 2019

@alincode is this about ready for beta-testing? If you publish a release without all the console.log's I can add it to Carbon for people to try it out, if that would help.

@alincode
Copy link

alincode commented Jun 1, 2019

@mfix22 I removed all console.log, release at codemirror-solidity 0.1.4. 😀

@Pet3ris
Copy link

Pet3ris commented Aug 7, 2019

This is a cool effort - was this ever completed/if not are the outputs already usable, better than the javascript syntax highlighting?

@serapath
Copy link
Contributor Author

serapath commented Aug 7, 2019

Hey thx :-)
Yes it is done, but we haven't had the time to integrate it into our editor yet, because we don't have a lot of resources and it's not top priority.

If you want to make a pull request to add it in, check:

The thing is the integration needs an afternoon of thinking and refactoring to keep things minimal and lean and we are quite busy with our p2p search engine and the editor currently works "well enough" ...but it's not forgotten and it's of course still on our roadmap :-)

@mfix22
Copy link

mfix22 commented Aug 22, 2019

Hey @alincode codemirror-solidity is breaking in strict mode (see carbon-app/carbon#848). Wondering if you could take a look at this PR to solve it? Thanks! 👍

@alincode
Copy link

alincode commented Aug 23, 2019

@mfix22 thanks for your feedback.

@alincode
Copy link

@mfix22 it releases at codemirror-solidity@0.2.0, check it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
#editor specification category up for grabs outsource task for third parties
Projects
None yet
Development

No branches or pull requests

5 participants