Welcome to mirror list, hosted at ThFree Co, Russian Federation.

sql-lint.js « addon « codemirror « js « assets - github.com/HuasoFoundries/phpPgAdmin6.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 064bc954d3e634a4e1b9eb96696c74705a51d1cd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
CodeMirror.sqlLint = function (text, updateLinting, options, cm) {
  // Skipping check if text box is empty.
  if (text.trim() === '') {
    updateLinting(cm, []);
    return;
  }

  function handleResponse(response) {
    var found = [];
    for (var idx in response) {
      found.push({
        from: CodeMirror.Pos(response[idx].fromLine, response[idx].fromColumn),
        to: CodeMirror.Pos(response[idx].toLine, response[idx].toColumn),
        messageHTML: response[idx].message,
        severity: response[idx].severity,
      });
    }

    updateLinting(cm, found);
  }

  $.ajax({
    method: 'POST',
    url: 'lint.php',
    dataType: 'json',
    data: {
      sql_query: text,
      server: PMA_commonParams.get('server'),
      options: options.lintOptions,
      no_history: true,
    },
    success: handleResponse,
  });
};