Skip to content

electric-capital/codemirror-lang-vyper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

codemirror-lang-vyper

A CodeMirror extension that provides Vyper syntax highlighting and language support. This is a work in progress.

Thank you to the Replit team for their work on the solidity plugin that the vyper plugin was based on: https://github.com/replit/codemirror-lang-solidity

Screenshot

Usage

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);
    });

About

CodeMirror 6 extension for Vyper language support and syntax highlighting

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published