An open API service indexing awesome lists of open source software.

https://github.com/rencryptofish/codemirror-lang-vyper

CodeMirror 6 extension for Vyper language support and syntax highlighting
https://github.com/rencryptofish/codemirror-lang-vyper

Last synced: 5 months ago
JSON representation

CodeMirror 6 extension for Vyper language support and syntax highlighting

Awesome Lists containing this project

README

          

# codemirror-lang-vyper
A CodeMirror extension that provides Vyper syntax highlighting and language support. This is a work in progress.

![Screenshot](/public/cm-vyper-support.png)

## Usage

```ts
import { basicSetup } from 'codemirror';
import { EditorView, keymap } from '@codemirror/view';
import { EditorState } from '@codemirror/state';
import { indentWithTab } from '@codemirror/commands';
import { vyper } from '../src';

// Fetch the content of example.vy
fetch('/example.vy')
.then(response => response.text())
.then(doc => {
new EditorView({
state: EditorState.create({
doc, // use the fetched content here
extensions: [
basicSetup,
keymap.of([indentWithTab]),
vyper,
],
}),
parent: document.querySelector('#editor'),
});
})
.catch(error => {
console.error("Error fetching the Vyper file:", error);
});
```