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

feat: improved syntax highlighting for the solidity language #435

Merged
merged 1 commit into from
May 15, 2023

Conversation

erunion
Copy link
Member

@erunion erunion commented May 12, 2023

🚥 Fixes RM-7006

🧰 Changes

When I added support for the Solidity language1 in #219 I pretty half-assed it by treating all code in that language as C-like, which is sort of true as it does has elements of C. In reality, this ends up treating most every keyword and aspect of the language as a C language comment or a variable, resulting in everything being highlighted as green:

Screen Shot 2023-05-12 at 11 57 10 AM

There's a codemirror-solidity library that handles this as it should2 but unfortunately it can't be imported in here because of the way that it defines its Codemirror mode3. Because of this, I've pulled that source over into this library, added attribution where necessary, and updated our Solidity example to better reflect real-world usage of the language4.

tl;dr: Our Solidity highlighting sucks, is better now.

Footnotes

  1. Solidity is for blockchain programming.

  2. https://alincode.github.io/codemirror-solidity/

  3. https://github.com/alincode/codemirror-solidity/blob/master/index.js

  4. https://docs.soliditylang.org/en/latest/solidity-by-example.html

@erunion erunion added the enhancement New feature or request label May 12, 2023
@erunion erunion requested review from a team, llimllib, gratcliff and jamestclark and removed request for a team May 12, 2023 19:04
@erunion erunion merged commit 3ec99cf into main May 15, 2023
@erunion erunion deleted the feat/better-solidity-support branch May 15, 2023 17:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant