@malloydata/malloy 0.0.22-dev230207182613 → 0.0.22-dev230207183024

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.
Files changed (155) hide show
  1. package/dist/connection_utils.js +7 -7
  2. package/dist/dialect/dialect.d.ts +1 -1
  3. package/dist/dialect/duckdb.d.ts +1 -1
  4. package/dist/dialect/duckdb.js +9 -9
  5. package/dist/dialect/postgres.d.ts +1 -1
  6. package/dist/dialect/postgres.js +16 -16
  7. package/dist/dialect/standardsql.d.ts +1 -1
  8. package/dist/dialect/standardsql.js +8 -8
  9. package/dist/index.d.ts +6 -6
  10. package/dist/lang/ast/ast-utils.js +3 -3
  11. package/dist/lang/ast/elements/define-query.js +4 -4
  12. package/dist/lang/ast/elements/define-source.d.ts +1 -1
  13. package/dist/lang/ast/elements/define-source.js +8 -8
  14. package/dist/lang/ast/elements/import-statement.js +2 -2
  15. package/dist/lang/ast/elements/pipeline-desc.d.ts +1 -1
  16. package/dist/lang/ast/elements/pipeline-desc.js +7 -7
  17. package/dist/lang/ast/elements/refined-source.d.ts +1 -1
  18. package/dist/lang/ast/elements/refined-source.js +5 -5
  19. package/dist/lang/ast/elements/source.js +1 -1
  20. package/dist/lang/ast/error-factory.js +16 -13
  21. package/dist/lang/ast/expressions/binary-boolean.d.ts +1 -1
  22. package/dist/lang/ast/expressions/binary-boolean.js +4 -4
  23. package/dist/lang/ast/expressions/binary-numeric.d.ts +1 -1
  24. package/dist/lang/ast/expressions/binary-numeric.js +1 -1
  25. package/dist/lang/ast/expressions/boolean.js +1 -1
  26. package/dist/lang/ast/expressions/constant-sub-expression.js +7 -7
  27. package/dist/lang/ast/expressions/expr-aggregate-function.d.ts +3 -3
  28. package/dist/lang/ast/expressions/expr-aggregate-function.js +12 -12
  29. package/dist/lang/ast/expressions/expr-alternation-tree.js +3 -3
  30. package/dist/lang/ast/expressions/expr-asymmetric.d.ts +1 -1
  31. package/dist/lang/ast/expressions/expr-asymmetric.js +1 -1
  32. package/dist/lang/ast/expressions/expr-avg.d.ts +1 -1
  33. package/dist/lang/ast/expressions/expr-avg.js +1 -1
  34. package/dist/lang/ast/expressions/expr-cast.d.ts +1 -1
  35. package/dist/lang/ast/expressions/expr-cast.js +26 -4
  36. package/dist/lang/ast/expressions/expr-compare.d.ts +1 -1
  37. package/dist/lang/ast/expressions/expr-compare.js +3 -3
  38. package/dist/lang/ast/expressions/expr-count.js +6 -6
  39. package/dist/lang/ast/expressions/expr-filter.d.ts +2 -2
  40. package/dist/lang/ast/expressions/expr-filter.js +8 -8
  41. package/dist/lang/ast/expressions/expr-func.d.ts +1 -1
  42. package/dist/lang/ast/expressions/expr-func.js +3 -3
  43. package/dist/lang/ast/expressions/expr-granular-time.js +7 -7
  44. package/dist/lang/ast/expressions/expr-id-reference.js +11 -11
  45. package/dist/lang/ast/expressions/expr-logical-op.js +1 -1
  46. package/dist/lang/ast/expressions/expr-minus.d.ts +1 -1
  47. package/dist/lang/ast/expressions/expr-minus.js +3 -3
  48. package/dist/lang/ast/expressions/expr-not.js +2 -2
  49. package/dist/lang/ast/expressions/expr-now.js +7 -7
  50. package/dist/lang/ast/expressions/expr-null.js +3 -3
  51. package/dist/lang/ast/expressions/expr-number.js +1 -1
  52. package/dist/lang/ast/expressions/expr-parens.js +2 -2
  53. package/dist/lang/ast/expressions/expr-regex.js +3 -3
  54. package/dist/lang/ast/expressions/expr-string.js +6 -6
  55. package/dist/lang/ast/expressions/expr-sum.d.ts +1 -1
  56. package/dist/lang/ast/expressions/expr-sum.js +1 -1
  57. package/dist/lang/ast/expressions/expr-time-extract.d.ts +1 -1
  58. package/dist/lang/ast/expressions/expr-time-extract.js +29 -29
  59. package/dist/lang/ast/expressions/expr-time.js +7 -7
  60. package/dist/lang/ast/expressions/expr-ungroup.d.ts +2 -2
  61. package/dist/lang/ast/expressions/expr-ungroup.js +11 -8
  62. package/dist/lang/ast/expressions/for-range.d.ts +1 -1
  63. package/dist/lang/ast/expressions/for-range.js +1 -1
  64. package/dist/lang/ast/expressions/granular-literal.js +12 -12
  65. package/dist/lang/ast/expressions/partial-compare.d.ts +1 -1
  66. package/dist/lang/ast/expressions/partial-compare.js +1 -1
  67. package/dist/lang/ast/expressions/pick-when.d.ts +1 -1
  68. package/dist/lang/ast/expressions/pick-when.js +11 -11
  69. package/dist/lang/ast/expressions/range.js +4 -4
  70. package/dist/lang/ast/expressions/top-by.d.ts +1 -1
  71. package/dist/lang/ast/expressions/top-by.js +4 -4
  72. package/dist/lang/ast/expressions/unary.js +1 -1
  73. package/dist/lang/ast/field-space/dynamic-space.d.ts +1 -1
  74. package/dist/lang/ast/field-space/dynamic-space.js +1 -1
  75. package/dist/lang/ast/field-space/index-field-space.js +2 -2
  76. package/dist/lang/ast/field-space/query-field-struct.js +1 -1
  77. package/dist/lang/ast/field-space/query-space-field.js +1 -1
  78. package/dist/lang/ast/field-space/query-spaces.js +2 -2
  79. package/dist/lang/ast/field-space/reference-field.js +1 -1
  80. package/dist/lang/ast/field-space/rename-space-field.js +2 -2
  81. package/dist/lang/ast/field-space/static-space.js +8 -8
  82. package/dist/lang/ast/field-space/struct-space-field-base.js +1 -1
  83. package/dist/lang/ast/fragtype-utils.js +2 -2
  84. package/dist/lang/ast/parameters/constant-parameter.js +9 -9
  85. package/dist/lang/ast/parameters/has-parameter.js +5 -5
  86. package/dist/lang/ast/query-elements/anonymous-query.js +1 -1
  87. package/dist/lang/ast/query-elements/existing-query.d.ts +1 -1
  88. package/dist/lang/ast/query-elements/existing-query.js +11 -11
  89. package/dist/lang/ast/query-elements/full-query.js +11 -11
  90. package/dist/lang/ast/query-elements/query-head-struct.js +1 -1
  91. package/dist/lang/ast/query-items/field-declaration.d.ts +1 -1
  92. package/dist/lang/ast/query-items/field-declaration.js +11 -11
  93. package/dist/lang/ast/query-items/field-references.d.ts +1 -1
  94. package/dist/lang/ast/query-items/field-references.js +1 -1
  95. package/dist/lang/ast/query-properties/filters.d.ts +1 -1
  96. package/dist/lang/ast/query-properties/filters.js +7 -7
  97. package/dist/lang/ast/query-properties/indexing.d.ts +1 -1
  98. package/dist/lang/ast/query-properties/indexing.js +2 -2
  99. package/dist/lang/ast/query-properties/joins.d.ts +1 -1
  100. package/dist/lang/ast/query-properties/joins.js +17 -14
  101. package/dist/lang/ast/query-properties/nest.js +4 -4
  102. package/dist/lang/ast/query-properties/ordering.js +2 -2
  103. package/dist/lang/ast/query-properties/qop-desc.js +1 -1
  104. package/dist/lang/ast/query-properties/top.js +3 -3
  105. package/dist/lang/ast/source-properties/field-list-edit.js +1 -1
  106. package/dist/lang/ast/source-properties/primary-key.js +1 -1
  107. package/dist/lang/ast/source-properties/renames.js +1 -1
  108. package/dist/lang/ast/sources/named-source.d.ts +2 -2
  109. package/dist/lang/ast/sources/named-source.js +6 -6
  110. package/dist/lang/ast/sources/query-source.d.ts +1 -1
  111. package/dist/lang/ast/sources/query-source.js +2 -2
  112. package/dist/lang/ast/sources/table-source.js +7 -5
  113. package/dist/lang/ast/space-seed.d.ts +1 -1
  114. package/dist/lang/ast/sql-elements/sql-statement.js +5 -5
  115. package/dist/lang/ast/sql-elements/sql-string.js +1 -1
  116. package/dist/lang/ast/struct-utils.js +2 -2
  117. package/dist/lang/ast/time-utils.js +32 -32
  118. package/dist/lang/ast/types/expression-def.js +34 -34
  119. package/dist/lang/ast/types/malloy-element.d.ts +4 -4
  120. package/dist/lang/ast/types/malloy-element.js +27 -27
  121. package/dist/lang/ast/types/query-comp.d.ts +1 -1
  122. package/dist/lang/ast/types/space-field.js +1 -1
  123. package/dist/lang/ast/types/space-param.js +2 -2
  124. package/dist/lang/ast/types/turtle-headed-pipe.d.ts +1 -1
  125. package/dist/lang/ast/types/turtle-headed-pipe.js +1 -1
  126. package/dist/lang/ast/types/type-desc.d.ts +1 -1
  127. package/dist/lang/field-utils.d.ts +1 -1
  128. package/dist/lang/index.d.ts +1 -1
  129. package/dist/lang/malloy-to-ast.d.ts +1 -1
  130. package/dist/lang/malloy-to-ast.js +11 -11
  131. package/dist/lang/parse-error-handler.js +4 -4
  132. package/dist/lang/parse-malloy.d.ts +4 -4
  133. package/dist/lang/parse-malloy.js +61 -61
  134. package/dist/lang/parse-tree-walkers/document-completion-walker.js +16 -16
  135. package/dist/lang/parse-tree-walkers/document-help-context-walker.js +10 -10
  136. package/dist/lang/parse-tree-walkers/document-highlight-walker.js +85 -82
  137. package/dist/lang/parse-tree-walkers/document-symbol-walker.js +40 -40
  138. package/dist/lang/parse-tree-walkers/find-external-references.d.ts +1 -1
  139. package/dist/lang/parse-tree-walkers/find-external-references.js +2 -2
  140. package/dist/lang/reference-list.d.ts +1 -1
  141. package/dist/lang/test/document-help-context-walker.spec.js +6 -6
  142. package/dist/lang/test/document-symbol-walker.spec.js +3 -3
  143. package/dist/lang/test/field-symbols.spec.js +62 -58
  144. package/dist/lang/test/parse.spec.js +262 -260
  145. package/dist/lang/test/test-translator.d.ts +1 -1
  146. package/dist/lang/test/test-translator.js +139 -139
  147. package/dist/lang/translate-response.d.ts +1 -1
  148. package/dist/lang/zone.js +5 -5
  149. package/dist/malloy.d.ts +5 -5
  150. package/dist/malloy.js +72 -72
  151. package/dist/model/malloy_query.d.ts +2 -2
  152. package/dist/model/malloy_query.js +179 -176
  153. package/dist/model/malloy_types.js +41 -41
  154. package/dist/model/sql_block.js +2 -2
  155. package/package.json +1 -1
@@ -87,7 +87,7 @@ class ParseStep {
87
87
  const msg = e instanceof Error ? e.message : "";
88
88
  that.urlIsFullPath = false;
89
89
  that.root.logger.log({
90
- message: `Could not compute full path URL: ${msg}`,
90
+ "message": `Could not compute full path URL: ${msg}`
91
91
  });
92
92
  }
93
93
  }
@@ -105,7 +105,7 @@ class ParseStep {
105
105
  this.response = that.fatalErrors();
106
106
  return this.response;
107
107
  }
108
- return { urls: [that.sourceURL] };
108
+ return { "urls": [that.sourceURL] };
109
109
  }
110
110
  const source = srcEnt.value == "" ? "\n" : srcEnt.value;
111
111
  this.sourceInfo = this.getSourceInfo(source);
@@ -115,14 +115,14 @@ class ParseStep {
115
115
  }
116
116
  catch (parseException) {
117
117
  that.root.logger.log({
118
- message: `Malloy internal parser exception [${parseException.message}]`,
118
+ "message": `Malloy internal parser exception [${parseException.message}]`
119
119
  });
120
120
  parse = undefined;
121
121
  }
122
122
  if (that.root.logger.hasErrors()) {
123
123
  this.response = {
124
124
  parse,
125
- ...that.fatalErrors(),
125
+ ...that.fatalErrors()
126
126
  };
127
127
  }
128
128
  else {
@@ -137,9 +137,9 @@ class ParseStep {
137
137
  getSourceInfo(code) {
138
138
  const eolRegex = /\r?\n/;
139
139
  const info = {
140
- at: [],
141
- lines: [],
142
- length: code.length,
140
+ "at": [],
141
+ "lines": [],
142
+ "length": code.length
143
143
  };
144
144
  let src = code;
145
145
  let lineStart = 0;
@@ -150,8 +150,8 @@ class ParseStep {
150
150
  info.lines.push(src.slice(0, eol.index));
151
151
  const lineLength = eol.index + eol[0].length;
152
152
  info.at.push({
153
- begin: lineStart,
154
- end: lineStart + lineLength,
153
+ "begin": lineStart,
154
+ "end": lineStart + lineLength
155
155
  });
156
156
  lineStart += lineLength;
157
157
  src = src.slice(lineLength);
@@ -159,7 +159,7 @@ class ParseStep {
159
159
  else {
160
160
  // last line, does not have a line end
161
161
  info.lines.push(src);
162
- info.at.push({ begin: lineStart, end: lineStart + src.length });
162
+ info.at.push({ "begin": lineStart, "end": lineStart + src.length });
163
163
  break;
164
164
  }
165
165
  }
@@ -180,12 +180,12 @@ class ParseStep {
180
180
  throw new Error(`No such parse rule as ${that.grammarRule}`);
181
181
  }
182
182
  return {
183
- root: parseFunc.call(malloyParser),
184
- tokenStream: tokenStream,
185
- sourceStream: inputStream,
183
+ "root": parseFunc.call(malloyParser),
184
+ "tokenStream": tokenStream,
185
+ "sourceStream": inputStream,
186
186
  // TODO put the real version here
187
- malloyVersion: "?.?.?-????",
188
- subTranslator: that,
187
+ "malloyVersion": "?.?.?-????",
188
+ "subTranslator": that
189
189
  };
190
190
  }
191
191
  }
@@ -205,8 +205,8 @@ class ImportsAndTablesStep {
205
205
  if (parseRefs === null || parseRefs === void 0 ? void 0 : parseRefs.tables) {
206
206
  for (const ref in parseRefs.tables) {
207
207
  that.root.schemaZone.reference(ref, {
208
- url: that.sourceURL,
209
- range: parseRefs.tables[ref],
208
+ "url": that.sourceURL,
209
+ "range": parseRefs.tables[ref]
210
210
  });
211
211
  }
212
212
  }
@@ -217,8 +217,8 @@ class ImportsAndTablesStep {
217
217
  const ref = decodeURI(new URL(relativeRef, that.sourceURL).toString());
218
218
  that.addChild(ref);
219
219
  that.root.importZone.reference(ref, {
220
- url: that.sourceURL,
221
- range: firstRef,
220
+ "url": that.sourceURL,
221
+ "range": firstRef
222
222
  });
223
223
  }
224
224
  catch (err) {
@@ -226,8 +226,8 @@ class ImportsAndTablesStep {
226
226
  // may be impossible, because it will append any garbage
227
227
  // to the known good rootURL assuming it is relative
228
228
  that.root.logger.log({
229
- message: `Malformed URL '${relativeRef}'"`,
230
- at: { url: that.sourceURL, range: firstRef },
229
+ "message": `Malformed URL '${relativeRef}'"`,
230
+ "at": { "url": that.sourceURL, "range": firstRef }
231
231
  });
232
232
  }
233
233
  }
@@ -241,11 +241,11 @@ class ImportsAndTablesStep {
241
241
  let allMissing = {};
242
242
  const missingTables = that.root.schemaZone.getUndefined();
243
243
  if (missingTables) {
244
- allMissing = { tables: missingTables };
244
+ allMissing = { "tables": missingTables };
245
245
  }
246
246
  const missingImports = that.root.importZone.getUndefined();
247
247
  if (missingImports) {
248
- allMissing = { ...allMissing, urls: missingImports };
248
+ allMissing = { ...allMissing, "urls": missingImports };
249
249
  }
250
250
  if ((0, translate_response_1.isNeedResponse)(allMissing)) {
251
251
  return allMissing;
@@ -337,8 +337,8 @@ class ASTStep {
337
337
  newAst.setTranslator(that);
338
338
  this.response = {
339
339
  ...that.errors(),
340
- ast: newAst,
341
- final: true,
340
+ "ast": newAst,
341
+ "final": true
342
342
  };
343
343
  return this.response;
344
344
  }
@@ -374,11 +374,11 @@ class MetadataStep {
374
374
  }
375
375
  this.response = {
376
376
  symbols,
377
- highlights: (0, document_highlight_walker_1.sortHighlights)([
377
+ "highlights": (0, document_highlight_walker_1.sortHighlights)([
378
378
  ...(0, document_highlight_walker_1.passForHighlights)(tryParse.parse.tokenStream),
379
- ...walkHighlights,
379
+ ...walkHighlights
380
380
  ]),
381
- final: true,
381
+ "final": true
382
382
  };
383
383
  }
384
384
  }
@@ -406,7 +406,7 @@ class CompletionsStep {
406
406
  }
407
407
  return {
408
408
  ...tryParse,
409
- completions,
409
+ completions
410
410
  };
411
411
  }
412
412
  }
@@ -432,7 +432,7 @@ class HelpContextStep {
432
432
  }
433
433
  return {
434
434
  ...tryParse,
435
- helpContext,
435
+ helpContext
436
436
  };
437
437
  }
438
438
  }
@@ -472,8 +472,8 @@ class TranslateStep {
472
472
  }
473
473
  else {
474
474
  that.root.logger.log({
475
- message: `'${that.sourceURL}' did not parse to malloy document`,
476
- at: that.defaultLocation(),
475
+ "message": `'${that.sourceURL}' did not parse to malloy document`,
476
+ "at": that.defaultLocation()
477
477
  });
478
478
  }
479
479
  }
@@ -482,13 +482,13 @@ class TranslateStep {
482
482
  }
483
483
  else {
484
484
  this.response = {
485
- translated: {
486
- modelDef: that.modelDef,
487
- queryList: that.queryList,
488
- sqlBlocks: that.sqlBlocks,
485
+ "translated": {
486
+ "modelDef": that.modelDef,
487
+ "queryList": that.queryList,
488
+ "sqlBlocks": that.sqlBlocks
489
489
  },
490
490
  ...that.errors(),
491
- final: true,
491
+ "final": true
492
492
  };
493
493
  }
494
494
  return this.response;
@@ -502,9 +502,9 @@ class MalloyTranslation {
502
502
  this.sqlBlocks = [];
503
503
  this.childTranslators = new Map();
504
504
  this.modelDef = {
505
- name: sourceURL,
506
- exports: [],
507
- contents: {},
505
+ "name": sourceURL,
506
+ "exports": [],
507
+ "contents": {}
508
508
  };
509
509
  /**
510
510
  * This is sort of the makefile for the translation, all the steps
@@ -535,8 +535,8 @@ class MalloyTranslation {
535
535
  }
536
536
  fatalErrors() {
537
537
  return {
538
- final: true,
539
- errors: [...this.root.logger.getLog()],
538
+ "final": true,
539
+ "errors": [...this.root.logger.getLog()]
540
540
  };
541
541
  }
542
542
  /**
@@ -545,7 +545,7 @@ class MalloyTranslation {
545
545
  */
546
546
  errors() {
547
547
  const errors = this.root.logger.getLog();
548
- return { errors: [...errors] };
548
+ return { "errors": [...errors] };
549
549
  }
550
550
  getLineMap(url) {
551
551
  var _a, _b;
@@ -598,8 +598,8 @@ class MalloyTranslation {
598
598
  const ret = (_a = this.childTranslators.get(childURL)) === null || _a === void 0 ? void 0 : _a.translate();
599
599
  if (ret === null || ret === void 0 ? void 0 : ret.compileSQL) {
600
600
  return {
601
- compileSQL: ret.compileSQL,
602
- partialModel: ret.partialModel,
601
+ "compileSQL": ret.compileSQL,
602
+ "partialModel": ret.partialModel
603
603
  };
604
604
  }
605
605
  }
@@ -642,11 +642,11 @@ class MalloyTranslation {
642
642
  }
643
643
  defaultLocation() {
644
644
  return {
645
- url: this.sourceURL,
646
- range: {
647
- start: { line: 0, character: 0 },
648
- end: { line: 0, character: 0 },
649
- },
645
+ "url": this.sourceURL,
646
+ "range": {
647
+ "start": { "line": 0, "character": 0 },
648
+ "end": { "line": 0, "character": 0 }
649
+ }
650
650
  };
651
651
  }
652
652
  rangeFromContext(pcx) {
@@ -654,8 +654,8 @@ class MalloyTranslation {
654
654
  }
655
655
  rangeFromTokens(startToken, stopToken) {
656
656
  const start = {
657
- line: startToken.line - 1,
658
- character: startToken.charPositionInLine,
657
+ "line": startToken.line - 1,
658
+ "character": startToken.charPositionInLine
659
659
  };
660
660
  if (this.parseStep.sourceInfo && stopToken.stopIndex != -1) {
661
661
  // Find the line which contains the stopIndex
@@ -665,10 +665,10 @@ class MalloyTranslation {
665
665
  if (stopToken.stopIndex >= at.begin && stopToken.stopIndex <= at.end) {
666
666
  return {
667
667
  start,
668
- end: {
669
- line: lineNo,
670
- character: stopToken.stopIndex - at.begin + 1,
671
- },
668
+ "end": {
669
+ "line": lineNo,
670
+ "character": stopToken.stopIndex - at.begin + 1
671
+ }
672
672
  };
673
673
  }
674
674
  }
@@ -676,13 +676,13 @@ class MalloyTranslation {
676
676
  // character of the last line of the file
677
677
  return {
678
678
  start,
679
- end: {
680
- line: lastLine,
681
- character: this.parseStep.sourceInfo.lines[lastLine].length,
682
- },
679
+ "end": {
680
+ "line": lastLine,
681
+ "character": this.parseStep.sourceInfo.lines[lastLine].length
682
+ }
683
683
  };
684
684
  }
685
- return { start, end: start };
685
+ return { start, "end": start };
686
686
  }
687
687
  rangeFromToken(token) {
688
688
  return this.rangeFromTokens(token, token);
@@ -36,7 +36,7 @@ const EXPLORE_PROPERTIES = [
36
36
  "accept",
37
37
  "except",
38
38
  "query",
39
- "declare",
39
+ "declare"
40
40
  ];
41
41
  const QUERY_PROPERTIES = [
42
42
  "group_by",
@@ -49,7 +49,7 @@ const QUERY_PROPERTIES = [
49
49
  "where",
50
50
  "having",
51
51
  "nest",
52
- "declare",
52
+ "declare"
53
53
  ];
54
54
  const MODEL_PROPERTIES = ["source", "explore", "query", "sql"];
55
55
  class DocumentCompletionWalker {
@@ -61,16 +61,16 @@ class DocumentCompletionWalker {
61
61
  rangeOf(pcx) {
62
62
  const stopToken = pcx.stop || pcx.start;
63
63
  return {
64
- start: {
65
- line: pcx.start.line - 1,
66
- character: pcx.start.charPositionInLine,
64
+ "start": {
65
+ "line": pcx.start.line - 1,
66
+ "character": pcx.start.charPositionInLine
67
67
  },
68
- end: {
69
- line: stopToken.line - 1,
70
- character: stopToken.stopIndex -
68
+ "end": {
69
+ "line": stopToken.line - 1,
70
+ "character": stopToken.stopIndex -
71
71
  (stopToken.startIndex - stopToken.charPositionInLine) +
72
- 1,
73
- },
72
+ 1
73
+ }
74
74
  };
75
75
  }
76
76
  inRange(range) {
@@ -94,8 +94,8 @@ class DocumentCompletionWalker {
94
94
  if (!insideStatement) {
95
95
  for (const property of EXPLORE_PROPERTIES) {
96
96
  this.completions.push({
97
- type: "explore_property",
98
- text: `${property}: `,
97
+ "type": "explore_property",
98
+ "text": `${property}: `
99
99
  });
100
100
  }
101
101
  }
@@ -112,8 +112,8 @@ class DocumentCompletionWalker {
112
112
  if (!insideStatement) {
113
113
  for (const property of QUERY_PROPERTIES) {
114
114
  this.completions.push({
115
- type: "query_property",
116
- text: `${property}: `,
115
+ "type": "query_property",
116
+ "text": `${property}: `
117
117
  });
118
118
  }
119
119
  }
@@ -130,8 +130,8 @@ class DocumentCompletionWalker {
130
130
  if (!insideStatement) {
131
131
  for (const property of MODEL_PROPERTIES) {
132
132
  this.completions.push({
133
- type: "model_property",
134
- text: `${property}: `,
133
+ "type": "model_property",
134
+ "text": `${property}: `
135
135
  });
136
136
  }
137
137
  }
@@ -33,16 +33,16 @@ class HelpContextVisitor extends tree_1.AbstractParseTreeVisitor {
33
33
  rangeOf(ctx) {
34
34
  const stopToken = ctx.stop || ctx.start;
35
35
  return {
36
- start: {
37
- line: ctx.start.line - 1,
38
- character: ctx.start.charPositionInLine,
36
+ "start": {
37
+ "line": ctx.start.line - 1,
38
+ "character": ctx.start.charPositionInLine
39
39
  },
40
- end: {
41
- line: stopToken.line - 1,
42
- character: stopToken.stopIndex -
40
+ "end": {
41
+ "line": stopToken.line - 1,
42
+ "character": stopToken.stopIndex -
43
43
  (stopToken.startIndex - stopToken.charPositionInLine) +
44
- 1,
45
- },
44
+ 1
45
+ }
46
46
  };
47
47
  }
48
48
  inRange(range) {
@@ -60,8 +60,8 @@ class HelpContextVisitor extends tree_1.AbstractParseTreeVisitor {
60
60
  let result = this.defaultResult();
61
61
  if (this.inRange(this.rangeOf(ctx))) {
62
62
  result = {
63
- type: this.type,
64
- token: ctx.start.text,
63
+ "type": this.type,
64
+ "token": ctx.start.text
65
65
  };
66
66
  const n = ctx.childCount;
67
67
  for (let i = 0; i < n; i++) {
@@ -27,80 +27,80 @@ const ParseTreeWalker_1 = require("antlr4ts/tree/ParseTreeWalker");
27
27
  const MalloyParser_1 = require("../lib/Malloy/MalloyParser");
28
28
  // TODO maybe this could be an enum like Definition__Field, etc.
29
29
  exports.HighlightType = {
30
- Identifier: "identifier",
31
- Type: "type",
32
- Literal: {
33
- Date: "literal.date",
34
- Number: "literal.number",
35
- String: "literal.string",
36
- RegularExpression: "literal.regular_expression",
37
- Boolean: "literal.boolean",
38
- Null: "literal.null",
30
+ "Identifier": "identifier",
31
+ "Type": "type",
32
+ "Literal": {
33
+ "Date": "literal.date",
34
+ "Number": "literal.number",
35
+ "String": "literal.string",
36
+ "RegularExpression": "literal.regular_expression",
37
+ "Boolean": "literal.boolean",
38
+ "Null": "literal.null"
39
39
  },
40
- Call: {
41
- Aggregate: "call.aggregate",
42
- TimeFrame: "call.time_frame",
43
- Cast: "call.cast",
44
- Table: "call.table",
45
- From: "call.from",
46
- Function: "call.function",
47
- FromSQL: "call.from_sql",
40
+ "Call": {
41
+ "Aggregate": "call.aggregate",
42
+ "TimeFrame": "call.time_frame",
43
+ "Cast": "call.cast",
44
+ "Table": "call.table",
45
+ "From": "call.from",
46
+ "Function": "call.function",
47
+ "FromSQL": "call.from_sql"
48
48
  },
49
49
  // TODO many of these should probably be categorized further
50
- Keyword: {
51
- AggregateModifier: {
52
- Distinct: "keyword.aggregate_modifier.distinct",
50
+ "Keyword": {
51
+ "AggregateModifier": {
52
+ "Distinct": "keyword.aggregate_modifier.distinct"
53
53
  },
54
- CastModifier: {
55
- As: "keyword.cast_modifier.as",
54
+ "CastModifier": {
55
+ "As": "keyword.cast_modifier.as"
56
56
  },
57
- Is: "keyword.is",
58
- On: "keyword.on",
59
- Desc: "keyword.desc",
60
- Asc: "keyword.asc",
61
- Pick: "keyword.pick",
62
- When: "keyword.when",
63
- Else: "keyword.else",
64
- With: "keyword.with",
57
+ "Is": "keyword.is",
58
+ "On": "keyword.on",
59
+ "Desc": "keyword.desc",
60
+ "Asc": "keyword.asc",
61
+ "Pick": "keyword.pick",
62
+ "When": "keyword.when",
63
+ "Else": "keyword.else",
64
+ "With": "keyword.with",
65
65
  // TODO or is this a meta type?
66
- JSON: "keyword.json",
66
+ "JSON": "keyword.json",
67
67
  // TODO or is this a meta type?
68
- Turtle: "keyword.turtle",
69
- Import: "keyword.import",
68
+ "Turtle": "keyword.turtle",
69
+ "Import": "keyword.import"
70
70
  },
71
- Operator: {
72
- Comparison: "operator.comparison",
73
- Boolean: "operator.boolean",
74
- Date: "operator.date",
71
+ "Operator": {
72
+ "Comparison": "operator.comparison",
73
+ "Boolean": "operator.boolean",
74
+ "Date": "operator.date"
75
75
  },
76
- Comment: {
77
- Line: "comment.line",
78
- Block: "comment.block",
79
- },
80
- Property: {
81
- Accept: "property.accept",
82
- Aggregate: "property.aggregate",
83
- Dimension: "property.dimension",
84
- Except: "property.except",
85
- Source: "property.source",
86
- GroupBy: "property.group_by",
87
- Having: "property.having",
88
- Index: "property.index",
89
- JoinOne: "keyword.join_one",
90
- JoinMany: "keyword.join_many",
91
- JoinCross: "keyword.join_cross",
92
- Limit: "property.limit",
93
- Measure: "property.measure",
94
- Nest: "property.nest",
95
- OrderBy: "property.order_by",
96
- PrimaryKey: "property.primary_key",
97
- Project: "property.project",
98
- Query: "property.query",
99
- Rename: "property.rename",
100
- Top: "property.top",
101
- Where: "property.where",
102
- SQL: "property.sql",
76
+ "Comment": {
77
+ "Line": "comment.line",
78
+ "Block": "comment.block"
103
79
  },
80
+ "Property": {
81
+ "Accept": "property.accept",
82
+ "Aggregate": "property.aggregate",
83
+ "Dimension": "property.dimension",
84
+ "Except": "property.except",
85
+ "Source": "property.source",
86
+ "GroupBy": "property.group_by",
87
+ "Having": "property.having",
88
+ "Index": "property.index",
89
+ "JoinOne": "keyword.join_one",
90
+ "JoinMany": "keyword.join_many",
91
+ "JoinCross": "keyword.join_cross",
92
+ "Limit": "property.limit",
93
+ "Measure": "property.measure",
94
+ "Nest": "property.nest",
95
+ "OrderBy": "property.order_by",
96
+ "PrimaryKey": "property.primary_key",
97
+ "Project": "property.project",
98
+ "Query": "property.query",
99
+ "Rename": "property.rename",
100
+ "Top": "property.top",
101
+ "Where": "property.where",
102
+ "SQL": "property.sql"
103
+ }
104
104
  };
105
105
  function passForHighlights(tokens) {
106
106
  const highlights = [];
@@ -115,18 +115,21 @@ function passForHighlights(tokens) {
115
115
  const colonAdjustment = removeColon ? 1 : 0;
116
116
  highlights.push({
117
117
  type,
118
- range: {
119
- start: { line: token.line - 1, character: token.startIndex - offset },
120
- end: {
121
- line: token.line - 1 + numberOfLines - 1,
122
- character: token.stopIndex +
118
+ "range": {
119
+ "start": {
120
+ "line": token.line - 1,
121
+ "character": token.startIndex - offset
122
+ },
123
+ "end": {
124
+ "line": token.line - 1 + numberOfLines - 1,
125
+ "character": token.stopIndex +
123
126
  2 -
124
127
  (numberOfLines > 1 ? token.startIndex : offset) -
125
128
  lengthOfAllButLastLine -
126
129
  numberOfLines -
127
- colonAdjustment,
128
- },
129
- },
130
+ colonAdjustment
131
+ }
132
+ }
130
133
  });
131
134
  };
132
135
  for (let i = 0; i < tokens.size; i++) {
@@ -333,24 +336,24 @@ class DocumentHighlightWalker {
333
336
  rangeOf(pcx) {
334
337
  const stopToken = pcx.stop || pcx.start;
335
338
  return {
336
- start: {
337
- line: pcx.start.line - 1,
338
- character: pcx.start.charPositionInLine,
339
+ "start": {
340
+ "line": pcx.start.line - 1,
341
+ "character": pcx.start.charPositionInLine
339
342
  },
340
- end: {
341
- line: stopToken.line - 1,
342
- character: stopToken.stopIndex -
343
+ "end": {
344
+ "line": stopToken.line - 1,
345
+ "character": stopToken.stopIndex -
343
346
  (stopToken.startIndex - stopToken.charPositionInLine) +
344
- 1,
345
- },
347
+ 1
348
+ }
346
349
  };
347
350
  }
348
351
  enterExprFunc(pcx) {
349
352
  const id = pcx.id() || pcx.timeframe();
350
353
  if (id) {
351
354
  this.highlights.push({
352
- range: this.rangeOf(id),
353
- type: exports.HighlightType.Call.Function,
355
+ "range": this.rangeOf(id),
356
+ "type": exports.HighlightType.Call.Function
354
357
  });
355
358
  }
356
359
  }