Autocompletes

Interface

  const autocompleter = new SqlAutocompleter({
    autocompleteParser: autocompleteParser.value,
    editor: editor.value,
    editorId: editorId.value,
    executor: executor.value as Executor,
    sqlAnalyzerProvider: sqlAnalyzerProvider.value || {
      getSqlAnalyzer: () => new CombinedSqlAnalyser(executor.value.connector()),
    },
    sqlReferenceProvider: sqlReferenceProvider.value,
    temporaryOnly: temporaryOnly.value,
  });

Call

parseResult = await autocompleter.parse();

Use your own

For example call a remote API with the content of the cell and the position of the cursor:

let parseResult: AutocompleteParseResult = {};

var value = session.getValue();
var cursorRow = pos.row;
var cursorColumn = pos.column;
var res =  await autocompleter.autocomplete(value, cursorRow, cursorColumn);

var kw = []
res.res.forEach((n, i) => {
  kw.push({ value: n, weight: -1 });
});

parseResult = {
  locations: [],
  lowerCase: false,
  suggestKeywords: kw,
  definitions: [],
};