6.0.2 • Published 3 months ago

@replit/codemirror-lang-solidity v6.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
3 months ago

CodeMirror Solidity Language Support

A CodeMirror extension that provides Solidity syntax highlighting and language support.

Screenshot

Usage

import { basicSetup } from 'codemirror';
import { EditorView } from '@codemirror/view';
import { EditorState } from '@codemirror/state';
import { solidity } from '@replit/codemirror-lang-solidity';

const doc = `
pragma solidity ^0.8.10;

contract EtherWallet {
    address payable public owner;

    constructor() {
        owner = payable(msg.sender);
    }

    receive() external payable {}

    function withdraw(uint _amount) external {
        require(msg.sender == owner, "caller is not owner");
        payable(msg.sender).transfer(_amount);
    }

    function getBalance() external view returns (uint) {
        return address(this).balance;
    }
}
`

new EditorView({
  state: EditorState.create({
    doc,
    extensions: [
      basicSetup,
      solidity,
    ],
  }),
  parent: document.querySelector('#editor'),
});
6.0.2

3 months ago

6.0.1

2 years ago

6.0.0

2 years ago

0.20.0

2 years ago

0.19.0

2 years ago