@cloudcare/codemirror-dql 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cjs/dql.d.ts CHANGED
@@ -2,15 +2,19 @@ import { Extension } from '@codemirror/state';
2
2
  import { LRLanguage } from '@codemirror/language';
3
3
  import { CompleteStrategy } from './complete';
4
4
  import { DQLClient } from './client';
5
+ import { LintStrategy } from './lint';
5
6
  export declare function DQLLanguage(): LRLanguage;
6
7
  export declare class DQLExtension {
7
8
  private complete;
9
+ private lint;
8
10
  private enableCompletion;
9
11
  private enableLinter;
10
12
  constructor();
11
13
  setComplete(dqlClent: DQLClient): DQLExtension;
12
14
  getComplete(): CompleteStrategy;
13
15
  activateCompletion(activate: boolean): DQLExtension;
16
+ setLinter(linter: LintStrategy): DQLExtension;
17
+ getLinter(): LintStrategy;
14
18
  activateLinter(activate: boolean): DQLExtension;
15
19
  asExtension(): Extension;
16
20
  }
package/dist/cjs/dql.js CHANGED
@@ -5,6 +5,7 @@ exports.DQLLanguage = DQLLanguage;
5
5
  var lezer_dql_1 = require("@cloudcare/lezer-dql");
6
6
  var language_1 = require("@codemirror/language");
7
7
  var complete_1 = require("./complete");
8
+ var lint_1 = require("./lint");
8
9
  function DQLLanguage() {
9
10
  return language_1.LRLanguage.define({
10
11
  parser: lezer_dql_1.parser,
@@ -17,7 +18,7 @@ function DQLLanguage() {
17
18
  var DQLExtension = /** @class */ (function () {
18
19
  function DQLExtension() {
19
20
  this.complete = (0, complete_1.newCompleteStrategy)();
20
- // this.lint = newLintStrategy()
21
+ this.lint = (0, lint_1.newLintStrategy)();
21
22
  this.enableLinter = true;
22
23
  this.enableCompletion = true;
23
24
  }
@@ -32,13 +33,13 @@ var DQLExtension = /** @class */ (function () {
32
33
  this.enableCompletion = activate;
33
34
  return this;
34
35
  };
35
- // setLinter(linter: LintStrategy): DQLExtension {
36
- // this.lint = linter
37
- // return this
38
- // }
39
- // getLinter(): LintStrategy {
40
- // return this.lint
41
- // }
36
+ DQLExtension.prototype.setLinter = function (linter) {
37
+ this.lint = linter;
38
+ return this;
39
+ };
40
+ DQLExtension.prototype.getLinter = function () {
41
+ return this.lint;
42
+ };
42
43
  DQLExtension.prototype.activateLinter = function (activate) {
43
44
  this.enableLinter = activate;
44
45
  return this;
@@ -55,9 +56,9 @@ var DQLExtension = /** @class */ (function () {
55
56
  });
56
57
  extension = extension.concat(completion);
57
58
  }
58
- // if (this.enableLinter) {
59
- // extension = extension.concat(promQLLinter(this.lint.promQL, this.lint))
60
- // }
59
+ if (this.enableLinter) {
60
+ extension = extension.concat((0, lint_1.DQLLinter)(this.lint.promQL, this.lint));
61
+ }
61
62
  return extension;
62
63
  };
63
64
  return DQLExtension;
@@ -1 +1 @@
1
- {"version":3,"file":"dql.js","sourceRoot":"","sources":["../../src/dql.ts"],"names":[],"mappings":";;;AAMA,kCAQC;AAdD,kDAA8C;AAG9C,iDAAkD;AAClD,uCAAmE;AAEnE,SAAgB,WAAW;IACzB,OAAO,qBAAU,CAAC,MAAM,CAAC;QACvB,MAAM,EAAE,kBAAM;QACd,YAAY,EAAE;YACZ,aAAa,EAAE,EAAE,QAAQ,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE;YAC3D,aAAa,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE;SAC7B;KACF,CAAC,CAAC;AACL,CAAC;AACD;IAME;QACE,IAAI,CAAC,QAAQ,GAAG,IAAA,8BAAmB,GAAE,CAAC;QACtC,gCAAgC;QAChC,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;QACzB,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC;IAC/B,CAAC;IAED,kCAAW,GAAX,UAAY,QAAmB;QAC7B,IAAI,CAAC,QAAQ,GAAG,IAAA,8BAAmB,EAAC,QAAQ,CAAC,CAAC;QAC9C,OAAO,IAAI,CAAC;IACd,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E,CAAC;gBAClC,YAAY,EAAE,UAAC,OAA0B;oBACvC,OAAO,KAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;gBACpC,CAAC;aACF,CAAC,CAAC;YACH,SAAS,GAAG,SAAS,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;QAC3C,CAAC;QACD,IAAI,IAAI,CAAC,YAAY,EAAE,CAAC;YACtB,SAAS,GAAG,SAAS,CAAC,MAAM,CAAC,IAAA,gBAAS,EAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;QACvE,CAAC;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;IACH,mBAAC;AAAD,CAAC,AAzDD,IAyDC;AAzDY,oCAAY"}
@@ -0,0 +1,6 @@
1
+ import { LintStrategy } from './index';
2
+ import { EditorView } from '@codemirror/view';
3
+ import { Diagnostic } from '@codemirror/lint';
4
+ export declare class HybridLint implements LintStrategy {
5
+ promQL(this: HybridLint): (view: EditorView) => readonly Diagnostic[];
6
+ }
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ // Copyright 2021 The Prometheus Authors
3
+ // Licensed under the Apache License, Version 2.0 (the "License");
4
+ // you may not use this file except in compliance with the License.
5
+ // You may obtain a copy of the License at
6
+ //
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ //
9
+ // Unless required by applicable law or agreed to in writing, software
10
+ // distributed under the License is distributed on an "AS IS" BASIS,
11
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ // See the License for the specific language governing permissions and
13
+ // limitations under the License.
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.HybridLint = void 0;
16
+ var parser_1 = require("../parser");
17
+ // HybridLint will provide a promQL linter with static analysis
18
+ var HybridLint = /** @class */ (function () {
19
+ function HybridLint() {
20
+ }
21
+ HybridLint.prototype.promQL = function () {
22
+ return function (view) {
23
+ var parser = new parser_1.Parser(view.state);
24
+ parser.analyze();
25
+ return parser.getDiagnostics();
26
+ };
27
+ };
28
+ return HybridLint;
29
+ }());
30
+ exports.HybridLint = HybridLint;
31
+ //# sourceMappingURL=hybrid.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hybrid.js","sourceRoot":"","sources":["../../../src/lint/hybrid.ts"],"names":[],"mappings":";AAAA,wCAAwC;AACxC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;;AAKjC,oCAAmC;AAEnC,+DAA+D;AAC/D;IAAA;IAQA,CAAC;IAPQ,2BAAM,GAAb;QACE,OAAO,UAAC,IAAgB;YACtB,IAAM,MAAM,GAAG,IAAI,eAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YACtC,MAAM,CAAC,OAAO,EAAE,CAAC;YACjB,OAAO,MAAM,CAAC,cAAc,EAAE,CAAC;QACjC,CAAC,CAAC;IACJ,CAAC;IACH,iBAAC;AAAD,CAAC,AARD,IAQC;AARY,gCAAU"}
@@ -0,0 +1,10 @@
1
+ import { EditorView } from '@codemirror/view';
2
+ import { Diagnostic } from '@codemirror/lint';
3
+ import { Extension } from '@codemirror/state';
4
+ type lintFunc = (view: EditorView) => readonly Diagnostic[] | Promise<readonly Diagnostic[]>;
5
+ export interface LintStrategy {
6
+ promQL(this: LintStrategy): lintFunc;
7
+ }
8
+ export declare function newLintStrategy(): LintStrategy;
9
+ export declare function DQLLinter(callbackFunc: (this: LintStrategy) => lintFunc, thisArg: LintStrategy): Extension;
10
+ export {};
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ // Copyright 2021 The Prometheus Authors
3
+ // Licensed under the Apache License, Version 2.0 (the "License");
4
+ // you may not use this file except in compliance with the License.
5
+ // You may obtain a copy of the License at
6
+ //
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ //
9
+ // Unless required by applicable law or agreed to in writing, software
10
+ // distributed under the License is distributed on an "AS IS" BASIS,
11
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ // See the License for the specific language governing permissions and
13
+ // limitations under the License.
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.newLintStrategy = newLintStrategy;
16
+ exports.DQLLinter = DQLLinter;
17
+ var lint_1 = require("@codemirror/lint");
18
+ var hybrid_1 = require("./hybrid");
19
+ function newLintStrategy() {
20
+ return new hybrid_1.HybridLint();
21
+ }
22
+ function DQLLinter(callbackFunc, thisArg) {
23
+ return (0, lint_1.linter)(callbackFunc.call(thisArg));
24
+ }
25
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lint/index.ts"],"names":[],"mappings":";AAAA,wCAAwC;AACxC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAejC,0CAEC;AAED,8BAEC;AAlBD,yCAAsD;AACtD,mCAAsC;AAWtC,SAAgB,eAAe;IAC7B,OAAO,IAAI,mBAAU,EAAE,CAAC;AAC1B,CAAC;AAED,SAAgB,SAAS,CAAC,YAA8C,EAAE,OAAqB;IAC7F,OAAO,IAAA,aAAM,EAAC,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;AAC5C,CAAC"}
@@ -1,2 +1,3 @@
1
1
  export { walkBackward, containsAtLeastOneChild, containsChild, getChildNodeText } from './path-finder';
2
2
  export { isMatcher, createMatcher } from './matcher';
3
+ export { Parser } from './parser';
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createMatcher = exports.isMatcher = exports.getChildNodeText = exports.containsChild = exports.containsAtLeastOneChild = exports.walkBackward = void 0;
3
+ exports.Parser = exports.createMatcher = exports.isMatcher = exports.getChildNodeText = exports.containsChild = exports.containsAtLeastOneChild = exports.walkBackward = void 0;
4
4
  var path_finder_1 = require("./path-finder");
5
5
  Object.defineProperty(exports, "walkBackward", { enumerable: true, get: function () { return path_finder_1.walkBackward; } });
6
6
  Object.defineProperty(exports, "containsAtLeastOneChild", { enumerable: true, get: function () { return path_finder_1.containsAtLeastOneChild; } });
@@ -9,4 +9,6 @@ Object.defineProperty(exports, "getChildNodeText", { enumerable: true, get: func
9
9
  var matcher_1 = require("./matcher");
10
10
  Object.defineProperty(exports, "isMatcher", { enumerable: true, get: function () { return matcher_1.isMatcher; } });
11
11
  Object.defineProperty(exports, "createMatcher", { enumerable: true, get: function () { return matcher_1.createMatcher; } });
12
+ var parser_1 = require("./parser");
13
+ Object.defineProperty(exports, "Parser", { enumerable: true, get: function () { return parser_1.Parser; } });
12
14
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/parser/index.ts"],"names":[],"mappings":";;;AAAA,6CAAuG;AAA9F,2GAAA,YAAY,OAAA;AAAE,sHAAA,uBAAuB,OAAA;AAAE,4GAAA,aAAa,OAAA;AAAE,+GAAA,gBAAgB,OAAA;AAC/E,qCAAqD;AAA5C,oGAAA,SAAS,OAAA;AAAE,wGAAA,aAAa,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/parser/index.ts"],"names":[],"mappings":";;;AAAA,6CAAuG;AAA9F,2GAAA,YAAY,OAAA;AAAE,sHAAA,uBAAuB,OAAA;AAAE,4GAAA,aAAa,OAAA;AAAE,+GAAA,gBAAgB,OAAA;AAC/E,qCAAqD;AAA5C,oGAAA,SAAS,OAAA;AAAE,wGAAA,aAAa,OAAA;AACjC,mCAAkC;AAAzB,gGAAA,MAAM,OAAA"}
@@ -0,0 +1,14 @@
1
+ import { Diagnostic } from '@codemirror/lint';
2
+ import { SyntaxNode } from '@lezer/common';
3
+ import { EditorState } from '@codemirror/state';
4
+ export declare class Parser {
5
+ private readonly tree;
6
+ private readonly state;
7
+ private readonly diagnostics;
8
+ constructor(state: EditorState);
9
+ getDiagnostics(): Diagnostic[];
10
+ analyze(): void;
11
+ private diagnoseAllErrorNodes;
12
+ checkAST(node: SyntaxNode | null): void;
13
+ private addDiagnostic;
14
+ }
@@ -0,0 +1,65 @@
1
+ "use strict";
2
+ // Copyright 2021 The Prometheus Authors
3
+ // Licensed under the Apache License, Version 2.0 (the "License");
4
+ // you may not use this file except in compliance with the License.
5
+ // You may obtain a copy of the License at
6
+ //
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ //
9
+ // Unless required by applicable law or agreed to in writing, software
10
+ // distributed under the License is distributed on an "AS IS" BASIS,
11
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ // See the License for the specific language governing permissions and
13
+ // limitations under the License.
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.Parser = void 0;
16
+ var language_1 = require("@codemirror/language");
17
+ var Parser = /** @class */ (function () {
18
+ function Parser(state) {
19
+ this.tree = (0, language_1.syntaxTree)(state);
20
+ this.state = state;
21
+ this.diagnostics = [];
22
+ }
23
+ Parser.prototype.getDiagnostics = function () {
24
+ return this.diagnostics.sort(function (a, b) {
25
+ return a.from - b.from;
26
+ });
27
+ };
28
+ Parser.prototype.analyze = function () {
29
+ // when you are at the root of the tree, the first node is not `Expr` but a node with no name.
30
+ // So to be able to iterate other the node relative to the promql node, we have to get the first child at the beginning
31
+ this.checkAST(this.tree.topNode.firstChild);
32
+ this.diagnoseAllErrorNodes();
33
+ };
34
+ Parser.prototype.diagnoseAllErrorNodes = function () {
35
+ var cursor = this.tree.cursor();
36
+ while (cursor.next()) {
37
+ // usually there is an error node at the end of the expression when user is typing
38
+ // so it's not really a useful information to say the expression is wrong.
39
+ // Hopefully if there is an error node at the end of the tree, checkAST should yell more precisely
40
+ if (cursor.type.id === 0 && cursor.to !== this.tree.topNode.to) {
41
+ var node = cursor.node.parent;
42
+ this.diagnostics.push({
43
+ severity: 'error',
44
+ message: 'unexpected expression',
45
+ from: node ? node.from : cursor.from,
46
+ to: node ? node.to : cursor.to,
47
+ });
48
+ }
49
+ }
50
+ };
51
+ // checkAST is inspired of the same named method from prometheus/prometheus:
52
+ // https://github.com/prometheus/prometheus/blob/3470ee1fbf9d424784eb2613bab5ab0f14b4d222/promql/parser/parse.go#L433
53
+ Parser.prototype.checkAST = function (node) { };
54
+ Parser.prototype.addDiagnostic = function (node, msg) {
55
+ this.diagnostics.push({
56
+ severity: 'error',
57
+ message: msg,
58
+ from: node.from,
59
+ to: node.to,
60
+ });
61
+ };
62
+ return Parser;
63
+ }());
64
+ exports.Parser = Parser;
65
+ //# sourceMappingURL=parser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parser.js","sourceRoot":"","sources":["../../../src/parser/parser.ts"],"names":[],"mappings":";AAAA,wCAAwC;AACxC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;;AAQjC,iDAAkD;AAGlD;IAKE,gBAAY,KAAkB;QAC5B,IAAI,CAAC,IAAI,GAAG,IAAA,qBAAU,EAAC,KAAK,CAAC,CAAC;QAC9B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,WAAW,GAAG,EAAE,CAAC;IACxB,CAAC;IAED,+BAAc,GAAd;QACE,OAAO,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,UAAC,CAAC,EAAE,CAAC;YAChC,OAAO,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC;QACzB,CAAC,CAAC,CAAC;IACL,CAAC;IAED,wBAAO,GAAP;QACE,8FAA8F;QAC9F,uHAAuH;QACvH,IAAI,CA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ts CHANGED
@@ -2,15 +2,19 @@ import { Extension } from '@codemirror/state';
2
2
  import { LRLanguage } from '@codemirror/language';
3
3
  import { CompleteStrategy } from './complete';
4
4
  import { DQLClient } from './client';
5
+ import { LintStrategy } from './lint';
5
6
  export declare function DQLLanguage(): LRLanguage;
6
7
  export declare class DQLExtension {
7
8
  private complete;
9
+ private lint;
8
10
  private enableCompletion;
9
11
  private enableLinter;
10
12
  constructor();
11
13
  setComplete(dqlClent: DQLClient): DQLExtension;
12
14
  getComplete(): CompleteStrategy;
13
15
  activateCompletion(activate: boolean): DQLExtension;
16
+ setLinter(linter: LintStrategy): DQLExtension;
17
+ getLinter(): LintStrategy;
14
18
  activateLinter(activate: boolean): DQLExtension;
15
19
  asExtension(): Extension;
16
20
  }
package/dist/esm/dql.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import { parser } from '@cloudcare/lezer-dql';
2
2
  import { LRLanguage } from '@codemirror/language';
3
3
  import { newCompleteStrategy } from './complete';
4
+ import { newLintStrategy, DQLLinter } from './lint';
4
5
  export function DQLLanguage() {
5
6
  return LRLanguage.define({
6
7
  parser: parser,
@@ -13,7 +14,7 @@ export function DQLLanguage() {
13
14
  export class DQLExtension {
14
15
  constructor() {
15
16
  this.complete = newCompleteStrategy();
16
- // this.lint = newLintStrategy()
17
+ this.lint = newLintStrategy();
17
18
  this.enableLinter = true;
18
19
  this.enableCompletion = true;
19
20
  }
@@ -28,13 +29,13 @@ export class DQLExtension {
28
29
  this.enableCompletion = activate;
29
30
  return this;
30
31
  }
31
- // setLinter(linter: LintStrategy): DQLExtension {
32
- // this.lint = linter
33
- // return this
34
- // }
35
- // getLinter(): LintStrategy {
36
- // return this.lint
37
- // }
32
+ setLinter(linter) {
33
+ this.lint = linter;
34
+ return this;
35
+ }
36
+ getLinter() {
37
+ return this.lint;
38
+ }
38
39
  activateLinter(activate) {
39
40
  this.enableLinter = activate;
40
41
  return this;
@@ -50,9 +51,9 @@ export class DQLExtension {
50
51
  });
51
52
  extension = extension.concat(completion);
52
53
  }
53
- // if (this.enableLinter) {
54
- // extension = extension.concat(promQLLinter(this.lint.promQL, this.lint))
55
- // }
54
+ if (this.enableLinter) {
55
+ extension = extension.concat(DQLLinter(this.lint.promQL, this.lint));
56
+ }
56
57
  return extension;
57
58
  }
58
59
  }
@@ -1 +1 @@
1
- {"version":3,"file":"dql.js","sourceRoot":"","sources":["../../src/dql.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAG9C,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,mBAAmB,EAAoB,MAAM,YAAY,CAAC;AAEnE,MAAM,UAAU,WAAW;IACzB,OAAO,UAAU,CAAC,MAAM,CAAC;QACvB,MAAM,EAAE,MAAM;QACd,YAAY,EAAE;YACZ,aAAa,EAAE,EAAE,QAAQ,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE;YAC3D,aAAa,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE;SAC7B;KACF,CAAC,CAAC;AACL,CAAC;AACD,MAAM,OAAO,YAAY;IAMvB;QACE,IAAI,CAAC,QAAQ,GAAG,mBAAmB,EAAE,CAAC;QACtC,gCAAgC;QAChC,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;QACzB,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC;IAC/B,CAAC;IAED,WAAW,CAAC,QAAmB;QAC7B,IAAI,CAAC,QAAQ,GAAG,mBAAmB,CAAC,QAAQ,CAAC,CAAC;QAC9C,OAAO,IAAI,CAAC;IACd,CAAC;IAED,WAAW;QACT,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;IAED,kBAAkB,CAAC,QAAiB;QAClC,IAAI,CAAC,gBAAgB,GAAG,QAAQ,CAAC;QACjC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,oDAAoD;IAC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CAAC,UAAU,CAAC,CAAC;QAC3C,CAAC;QACD,IAAI,IAAI,CAAC,YAAY,EAAE,CAAC;YACtB,SAAS,GAAG,SAAS,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;QACvE,CAAC;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;CACF"}
@@ -0,0 +1,6 @@
1
+ import { LintStrategy } from './index';
2
+ import { EditorView } from '@codemirror/view';
3
+ import { Diagnostic } from '@codemirror/lint';
4
+ export declare class HybridLint implements LintStrategy {
5
+ promQL(this: HybridLint): (view: EditorView) => readonly Diagnostic[];
6
+ }
@@ -0,0 +1,24 @@
1
+ // Copyright 2021 The Prometheus Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ import { Parser } from '../parser';
14
+ // HybridLint will provide a promQL linter with static analysis
15
+ export class HybridLint {
16
+ promQL() {
17
+ return (view) => {
18
+ const parser = new Parser(view.state);
19
+ parser.analyze();
20
+ return parser.getDiagnostics();
21
+ };
22
+ }
23
+ }
24
+ //# sourceMappingURL=hybrid.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hybrid.js","sourceRoot":"","sources":["../../../src/lint/hybrid.ts"],"names":[],"mappings":"AAAA,wCAAwC;AACxC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAKjC,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAEnC,+DAA+D;AAC/D,MAAM,OAAO,UAAU;IACd,MAAM;QACX,OAAO,CAAC,IAAgB,EAAE,EAAE;YAC1B,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YACtC,MAAM,CAAC,OAAO,EAAE,CAAC;YACjB,OAAO,MAAM,CAAC,cAAc,EAAE,CAAC;QACjC,CAAC,CAAC;IACJ,CAAC;CACF"}
@@ -0,0 +1,10 @@
1
+ import { EditorView } from '@codemirror/view';
2
+ import { Diagnostic } from '@codemirror/lint';
3
+ import { Extension } from '@codemirror/state';
4
+ type lintFunc = (view: EditorView) => readonly Diagnostic[] | Promise<readonly Diagnostic[]>;
5
+ export interface LintStrategy {
6
+ promQL(this: LintStrategy): lintFunc;
7
+ }
8
+ export declare function newLintStrategy(): LintStrategy;
9
+ export declare function DQLLinter(callbackFunc: (this: LintStrategy) => lintFunc, thisArg: LintStrategy): Extension;
10
+ export {};
@@ -0,0 +1,21 @@
1
+ // Copyright 2021 The Prometheus Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ import { linter } from '@codemirror/lint';
14
+ import { HybridLint } from './hybrid';
15
+ export function newLintStrategy() {
16
+ return new HybridLint();
17
+ }
18
+ export function DQLLinter(callbackFunc, thisArg) {
19
+ return linter(callbackFunc.call(thisArg));
20
+ }
21
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lint/index.ts"],"names":[],"mappings":"AAAA,wCAAwC;AACxC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAGjC,OAAO,EAAc,MAAM,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAWtC,MAAM,UAAU,eAAe;IAC7B,OAAO,IAAI,UAAU,EAAE,CAAC;AAC1B,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,YAA8C,EAAE,OAAqB;IAC7F,OAAO,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;AAC5C,CAAC"}
@@ -1,2 +1,3 @@
1
1
  export { walkBackward, containsAtLeastOneChild, containsChild, getChildNodeText } from './path-finder';
2
2
  export { isMatcher, createMatcher } from './matcher';
3
+ export { Parser } from './parser';
@@ -1,3 +1,4 @@
1
1
  export { walkBackward, containsAtLeastOneChild, containsChild, getChildNodeText } from './path-finder';
2
2
  export { isMatcher, createMatcher } from './matcher';
3
+ export { Parser } from './parser';
3
4
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/parser/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,uBAAuB,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACvG,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/parser/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,uBAAuB,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACvG,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC"}
@@ -0,0 +1,14 @@
1
+ import { Diagnostic } from '@codemirror/lint';
2
+ import { SyntaxNode } from '@lezer/common';
3
+ import { EditorState } from '@codemirror/state';
4
+ export declare class Parser {
5
+ private readonly tree;
6
+ private readonly state;
7
+ private readonly diagnostics;
8
+ constructor(state: EditorState);
9
+ getDiagnostics(): Diagnostic[];
10
+ analyze(): void;
11
+ private diagnoseAllErrorNodes;
12
+ checkAST(node: SyntaxNode | null): void;
13
+ private addDiagnostic;
14
+ }
@@ -0,0 +1,60 @@
1
+ // Copyright 2021 The Prometheus Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ import { syntaxTree } from '@codemirror/language';
14
+ export class Parser {
15
+ constructor(state) {
16
+ this.tree = syntaxTree(state);
17
+ this.state = state;
18
+ this.diagnostics = [];
19
+ }
20
+ getDiagnostics() {
21
+ return this.diagnostics.sort((a, b) => {
22
+ return a.from - b.from;
23
+ });
24
+ }
25
+ analyze() {
26
+ // when you are at the root of the tree, the first node is not `Expr` but a node with no name.
27
+ // So to be able to iterate other the node relative to the promql node, we have to get the first child at the beginning
28
+ this.checkAST(this.tree.topNode.firstChild);
29
+ this.diagnoseAllErrorNodes();
30
+ }
31
+ diagnoseAllErrorNodes() {
32
+ const cursor = this.tree.cursor();
33
+ while (cursor.next()) {
34
+ // usually there is an error node at the end of the expression when user is typing
35
+ // so it's not really a useful information to say the expression is wrong.
36
+ // Hopefully if there is an error node at the end of the tree, checkAST should yell more precisely
37
+ if (cursor.type.id === 0 && cursor.to !== this.tree.topNode.to) {
38
+ const node = cursor.node.parent;
39
+ this.diagnostics.push({
40
+ severity: 'error',
41
+ message: 'unexpected expression',
42
+ from: node ? node.from : cursor.from,
43
+ to: node ? node.to : cursor.to,
44
+ });
45
+ }
46
+ }
47
+ }
48
+ // checkAST is inspired of the same named method from prometheus/prometheus:
49
+ // https://github.com/prometheus/prometheus/blob/3470ee1fbf9d424784eb2613bab5ab0f14b4d222/promql/parser/parse.go#L433
50
+ checkAST(node) { }
51
+ addDiagnostic(node, msg) {
52
+ this.diagnostics.push({
53
+ severity: 'error',
54
+ message: msg,
55
+ from: node.from,
56
+ to: node.to,
57
+ });
58
+ }
59
+ }
60
+ //# sourceMappingURL=parser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parser.js","sourceRoot":"","sources":["../../../src/parser/parser.ts"],"names":[],"mappings":"AAAA,wCAAwC;AACxC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAQjC,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAGlD,MAAM,OAAO,MAAM;IAKjB,YAAY,KAAkB;QAC5B,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC;QAC9B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,WAAW,GAAG,EAAE,CAAC;IACxB,CAAC;IAED,cAAc;QACZ,OAAO,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;YACpC,OAAO,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC;QACzB,CAAC,CAAC,CAAC;IACL,CAAC;IAED,OAAO;QACL,8FAA8F;QAC9F,uHAAuH;QACvH,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,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CodeMirror mode for the DQL language",
5
5
  "types": "dist/esm/index.d.ts",
6
6
  "module": "dist/esm/index.js",
@@ -24,7 +24,7 @@
24
24
  "author": "Prometheus Authors <prometheus-developers@googlegroups.com>",
25
25
  "license": "Apache-2.0",
26
26
  "dependencies": {
27
- "@cloudcare/lezer-dql": "0.0.2",
27
+ "@cloudcare/lezer-dql": "0.0.3",
28
28
  "lru-cache": "^11.1.0"
29
29
  },
30
30
  "devDependencies": {
@@ -56,5 +56,5 @@
56
56
  "engines": {
57
57
  "node": ">=12.0.0"
58
58
  },
59
- "gitHead": "a1c0217095b29383b81c5c24d4be3ba2e0c952c2"
59
+ "gitHead": "6925ee0ce46855c85369c3232732a4a8ca044941"
60
60
  }