discoveryjs / discovery

A framework for rapid data (JSON) analysis, shareable serverless reports and dashboards
https://discoveryjs.github.io/discovery/
MIT License
336 stars 6 forks source link

Autocomplete for variables #7

Closed obenjiro closed 5 years ago

obenjiro commented 5 years ago

Auto complete dons't work for variables with helper

$a: <($.a.b)>;

[{ a: { b: 2 } }].exec($a)

helper

exec(...args) {
      let ctx = args.shift();
      return args.reduce((ctx, fn) => {
        if (typeof fn === 'function'){
            console.log('fn');
          return fn(ctx);
        }
        throw 'Unsupproted argument ' + fn + ' of type: ' + typeof fn;
      }, ctx);
    }

you can try to remove ".b"; at first line and write "." - Autocomplete won't show up

lahmatiy commented 5 years ago

I found that in tollerant mode jora inserts suggestion point (symbol) before a function by incedent that cause to parse error. Need to fix jora’s tollerant parsing.

lahmatiy commented 5 years ago

Fixed by bumping jora in 1.0.0-beta.10