~lattis/meson-playground

d65270e9499a1949532930982c73777283cf8824 — Stone Tickle 1 year, 1 month ago a963476
allow passing extra linter args
2 files changed, 13 insertions(+), 2 deletions(-)

M index.html
M main.js
M index.html => index.html +1 -1
@@ 24,7 24,7 @@
      <div class="bottom">
        <div class="lhs">
          <div>
            <button onclick="muonRun(['analyze', '-l', '-O', 'meson.build'])">lint</button>
            <button onclick="muonRun(muonLintArgs)">lint</button>
          </div>

          <hr class="vr" />

M main.js => main.js +12 -1
@@ 67,7 67,14 @@ function stripEscapes(str) {
 */
var factory = require('./muon.js');

const muonLintArgs = ['analyze', '-l', '-O', 'meson.build'];
var muonLintExtraArgs = [];

function muonRun(arguments, output) {
  if (arguments[0] == 'analyze') {
    arguments = arguments.concat(muonLintExtraArgs);
  }

  factory({
    arguments: arguments,
    printErr: (function() {


@@ 133,7 140,7 @@ function textChanged(elem) {
  document.getElementById('share').href = uri;

  if (document.getElementById('analyze_while_typing').checked) {
    muonRun(['analyze', '-l', '-O', 'meson.build']);
    muonRun(muonLintArgs);
  }
}



@@ 153,6 160,10 @@ textarea.addEventListener('input', event => { textChanged(event.target); });
    element.value = str;
  }

  if (params.args) {
    muonLintExtraArgs = params.args.split(" ");
  }

  textChanged(element);

  var lineNo = 0;