Limit rate of language handler to run on file save events?

plugins

#1

I’m using the following language handler for my linter plugin:

    handler.analyze = function(value, ast, callback) {
        if (!ast)
            return;
        callback(null, [{
            pos: { sl: 0, el: 0, sc: 0, ec: 0 },
            type: "info",
            message: "Hey there! I'm an info marker"
        }]);
    };

Unfortunately, the linter gets called on each keystroke… Is there a way to limit the analyze function so that it only gets called on file save events?


Recommended C9 testing tools for plugins? Mocha & Chai?
#2

Currently we do not have a way to do this. Could you give me a bit more detail why do you want to run it only on save? and what should happen with old annotations when file is modified but not saved yet?


#3

I’m currently working on revamping style50 for CS50, which is a linter for C that runs clang and then an ANTLR generated C parser.

We are thinking about limiting the linter to run only on file save events as we are wondering about:

  • How does running language.worker_util.execAnalysis and then calling handler.analyze impact performance?
  • Running only onsave events seems more intuitive than constantly pushing errors in front of students

As for old annotations, we are thinking that they would stay and only be changed once a file is saved again.