Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/replit/codemirror-lang-solidity
CodeMirror 6 extension for Solidity language support and syntax highlighting
https://github.com/replit/codemirror-lang-solidity
codemirror editor solidity
Last synced: 3 months ago
JSON representation
CodeMirror 6 extension for Solidity language support and syntax highlighting
- Host: GitHub
- URL: https://github.com/replit/codemirror-lang-solidity
- Owner: replit
- License: mit
- Created: 2022-01-25T23:37:53.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2024-02-04T16:37:56.000Z (11 months ago)
- Last Synced: 2024-10-09T12:39:34.952Z (3 months ago)
- Topics: codemirror, editor, solidity
- Language: TypeScript
- Homepage: https://replit.com/@util/codemirror-lang-solidity
- Size: 175 KB
- Stars: 6
- Watchers: 30
- Forks: 4
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# CodeMirror Solidity Language Support
A CodeMirror extension that provides Solidity syntax highlighting and language support.
![Screenshot](public/cm-solidity-support.png)
### Usage
```ts
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'),
});
```