0.0.1 • Published 5 years ago

ace-ext-inline-annotator v0.0.1

Weekly downloads
6
License
MIT
Repository
github
Last release
5 years ago

Inline Annotator Plugin for Ace Editor

Ace plugin that can consume annotations and add them as dynamic markers to decorate error targets inline.

Getting Started

npm install ace-ext-inline-annotator

In the browser

<script src=""></script>

As an Ace module

import 'ace-ext-inline-annotator'

const InlineAnnotator = ace.require("ace/ext/inline_annotator").InlineAnnotator;

As an ES2015 module

import { InlineAnnotator } from 'ace-ext-inline-annotator';

Use with worker annotations

Extending the validation example from Ace:

var InlineAnnotator = require("ace/ext/inline_annotator").InlineAnnotator;
var WorkerClient = require("ace/worker/worker_client").WorkerClient;
this.createWorker = function(session) {
    var inlineAnnotator = new InlineAnnotator(session);
    var worker = new WorkerClient(["ace"], "path/to/worker", "WorkerModule");

    worker.attachToDocument(session.getDocument());

    worker.on("lint", function(results) {
        session.setAnnotations(results.data);
        inlineAnnotator.set(results.data);
    });

    worker.on("terminate", function() {
        session.clearAnnotations();
    });

    return worker;
};