@arcgis/coding-components 4.30.0 → 4.31.0-next.10
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/arcgis-coding-components/arcgis-coding-components.esm.js +3 -3
- package/dist/arcgis-coding-components/assets/code-editor/arcade.worker.js +13 -13
- package/dist/arcgis-coding-components/assets/code-editor/css.worker.js +1 -1
- package/dist/arcgis-coding-components/assets/code-editor/html.worker.js +1 -1
- package/dist/arcgis-coding-components/assets/code-editor/json.worker.js +1 -1
- package/dist/arcgis-coding-components/assets/code-editor/sql-expr.worker.js +11 -0
- package/dist/arcgis-coding-components/assets/code-editor/ts.worker.js +1 -1
- package/dist/arcgis-coding-components/assets/sql-expression-editor/api/sql-expression-api.t9n.en.json +735 -0
- package/dist/arcgis-coding-components/index.esm.js +3 -3
- package/dist/arcgis-coding-components/p-025fda85.js +6 -0
- package/dist/arcgis-coding-components/{p-b7981062.js → p-02cae55d.js} +4 -4
- package/dist/arcgis-coding-components/p-193ac44f.js +6 -0
- package/dist/arcgis-coding-components/{p-ed5c78ce.js → p-22253750.js} +2 -2
- package/dist/arcgis-coding-components/p-4fc79a07.entry.js +6 -0
- package/dist/arcgis-coding-components/p-50484a4f.js +6 -0
- package/dist/arcgis-coding-components/p-6e28fd70.js +6 -0
- package/dist/arcgis-coding-components/p-7164c348.js +6 -0
- package/dist/arcgis-coding-components/p-767b17ee.entry.js +6 -0
- package/dist/arcgis-coding-components/{p-69ef969a.js → p-790067b1.js} +11 -11
- package/dist/arcgis-coding-components/{p-e9510c84.js → p-8196fa73.js} +3 -3
- package/dist/arcgis-coding-components/{p-f40fe9c5.js → p-8cf09bcc.js} +2 -2
- package/dist/arcgis-coding-components/{p-ca3f5530.js → p-923858b5.js} +3 -3
- package/dist/arcgis-coding-components/{p-ae0db715.js → p-960aa9dc.js} +3 -3
- package/dist/arcgis-coding-components/p-9956a574.js +6 -0
- package/dist/arcgis-coding-components/{p-9770fb37.js → p-ab78d6c4.js} +4 -4
- package/dist/arcgis-coding-components/{p-e37595ba.js → p-ad75160d.js} +4 -4
- package/dist/arcgis-coding-components/{p-24fb1d11.js → p-da9431ba.js} +3 -3
- package/dist/arcgis-coding-components/p-f452d4b8.entry.js +6 -0
- package/dist/cjs/{app-globals-18ba6880.js → app-globals-bade840e.js} +2 -2
- package/dist/cjs/arcade-defaults-8b8d6c07.js +116 -0
- package/dist/cjs/arcade-language-features-747fb1da.js +274 -0
- package/dist/cjs/arcade-mode-dce44622.js +336 -0
- package/dist/cjs/{arcgis-arcade-api_6.cjs.entry.js → arcgis-arcade-editor_6.cjs.entry.js} +3806 -5154
- package/dist/cjs/arcgis-coding-components.cjs.js +5 -5
- package/dist/cjs/arcgis-sql-expression-editor.cjs.entry.js +81 -0
- package/dist/cjs/arcgis-sql-expression-fields.cjs.entry.js +80 -0
- package/dist/cjs/{css-d8a65bb9.js → css-077ba0c5.js} +2 -2
- package/dist/cjs/{cssMode-07dbb853.js → cssMode-7f2030db.js} +5 -5
- package/dist/cjs/{html-bb10cced.js → html-e3a243e9.js} +5 -5
- package/dist/cjs/{htmlMode-7df0a09d.js → htmlMode-c273d6dc.js} +5 -5
- package/dist/cjs/{index-15bcce7e.js → index-37a86ff4.js} +12 -4
- package/dist/cjs/index.cjs.js +5 -4
- package/dist/cjs/{javascript-f0dbed11.js → javascript-7a33cca7.js} +5 -5
- package/dist/cjs/{jsonMode-9e54e9b7.js → jsonMode-6b4e0850.js} +5 -5
- package/dist/cjs/{arcade-defaults-d0931224.js → language-defaults-base-b32cb091.js} +88 -144
- package/dist/cjs/loader.cjs.js +5 -5
- package/dist/cjs/sql-expr-defaults-8a5834f3.js +1280 -0
- package/dist/cjs/sql-expr-mode-a72a1f92.js +21838 -0
- package/dist/cjs/{tsMode-ca28bc5f.js → tsMode-c2edcd57.js} +6 -6
- package/dist/cjs/{typescript-39540ed7.js → typescript-c50c5516.js} +5 -5
- package/dist/components/arcade-defaults.js +47 -1537
- package/dist/components/arcade-language-features.js +271 -0
- package/dist/components/arcade-mode.js +7 -267
- package/dist/components/arcade-results.js +7 -7
- package/dist/components/arcade-suggestions.js +8 -8
- package/dist/components/arcade-variables.js +7 -7
- package/dist/components/arcgis-arcade-editor.js +49 -50
- package/dist/components/arcgis-arcade-results.js +2 -2
- package/dist/components/arcgis-arcade-suggestions.js +2 -2
- package/dist/components/arcgis-arcade-variables.js +2 -2
- package/dist/components/arcgis-assets.d.ts +2 -2
- package/dist/components/arcgis-assets.js +3 -3
- package/dist/components/arcgis-code-editor.js +2 -2
- package/dist/components/arcgis-language-api-panel.d.ts +11 -0
- package/dist/components/arcgis-language-api-panel.js +11 -0
- package/dist/components/arcgis-sql-expression-editor.d.ts +11 -0
- package/dist/components/arcgis-sql-expression-editor.js +120 -0
- package/dist/components/arcgis-sql-expression-fields.d.ts +11 -0
- package/dist/components/arcgis-sql-expression-fields.js +11 -0
- package/dist/components/chunk-3IUJHIAA.js +1154 -0
- package/dist/components/code-editor.js +186 -17
- package/dist/components/fields.js +3 -3
- package/dist/components/index.js +2 -2
- package/dist/components/index2.js +31 -23
- package/dist/components/{arcade-api.js → language-api-panel.js} +29 -60
- package/dist/components/language-defaults-base.js +1535 -0
- package/dist/components/markdown.js +3 -3
- package/dist/components/sql-expr-defaults.js +131 -0
- package/dist/components/sql-expr-mode.js +21836 -0
- package/dist/components/sql-expression-fields.js +102 -0
- package/dist/components/useT9n.js +46 -9
- package/dist/components/utilities.js +2 -2
- package/dist/esm/{app-globals-2a0e9afb.js → app-globals-ed47e16d.js} +2 -2
- package/dist/esm/arcade-defaults-562fe19b.js +111 -0
- package/dist/esm/arcade-language-features-8edb3527.js +269 -0
- package/dist/esm/{arcade-mode-e9728a63.js → arcade-mode-ad036f46.js} +7 -266
- package/dist/esm/{arcgis-arcade-api_6.entry.js → arcgis-arcade-editor_6.entry.js} +3793 -5141
- package/dist/esm/arcgis-coding-components.js +6 -6
- package/dist/esm/arcgis-sql-expression-editor.entry.js +77 -0
- package/dist/esm/arcgis-sql-expression-fields.entry.js +76 -0
- package/dist/esm/{css-61c794c2.js → css-810518f1.js} +2 -2
- package/dist/esm/{cssMode-6e0ccd51.js → cssMode-a7208024.js} +4 -4
- package/dist/esm/{html-44ad432e.js → html-e187d7d8.js} +4 -4
- package/dist/esm/{htmlMode-fd336434.js → htmlMode-06b7bae2.js} +4 -4
- package/dist/esm/{index-0d124a57.js → index-3743d31f.js} +12 -4
- package/dist/esm/index.js +5 -4
- package/dist/esm/{javascript-ac057954.js → javascript-04a3f866.js} +5 -5
- package/dist/esm/{jsonMode-ea8fa529.js → jsonMode-ee8bb2ea.js} +4 -4
- package/dist/esm/{arcade-defaults-811bdd4d.js → language-defaults-base-52a397f5.js} +82 -142
- package/dist/esm/loader.js +6 -6
- package/dist/esm/sql-expr-defaults-f7c2d5ef.js +1274 -0
- package/dist/esm/sql-expr-mode-433b4a39.js +21835 -0
- package/dist/esm/{tsMode-af9c3001.js → tsMode-c80c462e.js} +4 -4
- package/dist/esm/{typescript-baec45d6.js → typescript-a9b8caa7.js} +4 -4
- package/dist/loader/cdn.js +2 -2
- package/dist/loader/index.cjs.js +2 -2
- package/dist/loader/index.es2017.js +2 -2
- package/dist/loader/index.js +2 -2
- package/dist/types/components/arcade-editor/arcade-editor.d.ts +45 -10
- package/dist/types/components/arcade-results/arcade-results.d.ts +43 -1
- package/dist/types/components/arcade-suggestions/arcade-suggestions.d.ts +22 -1
- package/dist/types/components/arcade-variables/arcade-variables.d.ts +28 -1
- package/dist/types/components/code-editor/code-editor.d.ts +16 -5
- package/dist/types/components/language-api-panel/language-api-panel.d.ts +73 -0
- package/dist/types/components/sql-expression-editor/sql-expression-editor.d.ts +24 -0
- package/dist/types/components/sql-expression-fields/sql-expression-fields.d.ts +32 -0
- package/dist/types/components.d.ts +148 -70
- package/dist/types/data/actions-runner-1/_work/arcgis-web-components/arcgis-web-components/packages/coding-packages/coding-components/.stencil/stories/internal/sql-expression-editor/sql-expression-editor.stories.d.ts +13 -0
- package/dist/types/dependencies.d.ts +21 -0
- package/dist/types/utils/arcade-monaco/arcade-contribution.d.ts +1 -24
- package/dist/types/utils/arcade-monaco/arcade-defaults.d.ts +12 -49
- package/dist/types/utils/arcade-monaco/arcade-language-features.d.ts +6 -4
- package/dist/types/utils/arcade-monaco/arcade-mode.d.ts +3 -2
- package/dist/types/utils/arcade-monaco/arcade-service-accessors.d.ts +31 -0
- package/dist/types/utils/arcade-monaco/arcade-worker-manager.d.ts +3 -2
- package/dist/types/utils/arcade-monaco/arcade.worker.d.ts +5 -5
- package/dist/types/utils/arcade-monaco/types.d.ts +6 -35
- package/dist/types/utils/language-defaults-base.d.ts +69 -0
- package/dist/types/utils/profile/predefined-profile.d.ts +3 -1
- package/dist/types/utils/profile/types.d.ts +29 -69
- package/dist/types/utils/profile/utils.d.ts +4 -7
- package/dist/types/utils/sql-expr-monaco/DependentFiles/DateOnly.d.ts +41 -0
- package/dist/types/utils/sql-expr-monaco/DependentFiles/SqlInterval.d.ts +16 -0
- package/dist/types/utils/sql-expr-monaco/DependentFiles/SqlTimestampOffset.d.ts +26 -0
- package/dist/types/utils/sql-expr-monaco/DependentFiles/TimeOnly.d.ts +37 -0
- package/dist/types/utils/sql-expr-monaco/DependentFiles/UnknownTimeZone.d.ts +11 -0
- package/dist/types/utils/sql-expr-monaco/DependentFiles/WhereGrammar.d.ts +122 -0
- package/dist/types/utils/sql-expr-monaco/DependentFiles/sqlCompareUtils.d.ts +5 -0
- package/dist/types/utils/sql-expr-monaco/DependentFiles/sqlDateParsingUtils.d.ts +18 -0
- package/dist/types/utils/sql-expr-monaco/DependentFiles/sqlUtils.d.ts +6 -0
- package/dist/types/utils/sql-expr-monaco/DependentFiles/standardizedFunctions.d.ts +156 -0
- package/dist/types/utils/sql-expr-monaco/DependentFiles/support.d.ts +150 -0
- package/dist/types/utils/sql-expr-monaco/PeggyGrammar/sql92grammar.d.ts +1397 -0
- package/dist/types/utils/sql-expr-monaco/libraries/date/properties/index.d.ts +59 -0
- package/dist/types/utils/sql-expr-monaco/libraries/numeric/properties/index.d.ts +295 -0
- package/dist/types/utils/sql-expr-monaco/libraries/string/properties/index.d.ts +135 -0
- package/dist/types/utils/sql-expr-monaco/sql-expr-completion.d.ts +6 -0
- package/dist/types/utils/sql-expr-monaco/sql-expr-contribution.d.ts +11 -0
- package/dist/types/utils/sql-expr-monaco/sql-expr-defaults.d.ts +22 -0
- package/dist/types/utils/sql-expr-monaco/sql-expr-language-features.d.ts +61 -0
- package/dist/types/utils/sql-expr-monaco/sql-expr-language-syntax.d.ts +8 -0
- package/dist/types/utils/sql-expr-monaco/sql-expr-mode.d.ts +10 -0
- package/dist/types/utils/sql-expr-monaco/sql-expr-validation-adapter.d.ts +3 -0
- package/dist/types/utils/sql-expr-monaco/sql-expr-validation-diagnostic-adapter.d.ts +41 -0
- package/dist/types/utils/sql-expr-monaco/sql-expr-validation-utils.d.ts +99 -0
- package/dist/types/utils/sql-expr-monaco/sql-expr-validation.d.ts +41 -0
- package/dist/types/utils/sql-expr-monaco/sql-expr-worker-manager.d.ts +15 -0
- package/dist/types/utils/sql-expr-monaco/sql-expr.worker.d.ts +21 -0
- package/dist/types/utils/sql-expr-monaco/types.d.ts +91 -0
- package/dist/types/utils/sql-expr-profile/predefined-profile.d.ts +2 -0
- package/package.json +23 -17
- package/dist/arcgis-coding-components/p-98cf909d.js +0 -6
- package/dist/arcgis-coding-components/p-bf047552.entry.js +0 -6
- package/dist/arcgis-coding-components/p-f602fc86.js +0 -6
- package/dist/cjs/arcade-mode-8424eafa.js +0 -595
- package/dist/components/arcade-contribution.js +0 -181
- package/dist/components/arcgis-arcade-api.d.ts +0 -11
- package/dist/components/arcgis-arcade-api.js +0 -11
- package/dist/components/chunk-2CDDVOQU.js +0 -1364
- package/dist/types/components/arcade-api/arcade-api.d.ts +0 -45
- package/dist/types/components/arcade-api/t9n-types.d.ts +0 -8
- package/dist/types/components/arcade-editor/t9n-types.d.ts +0 -8
- package/dist/types/components/arcade-results/t9n-types.d.ts +0 -13
- package/dist/types/components/arcade-suggestions/t9n-types.d.ts +0 -6
- package/dist/types/components/arcade-variables/t9n-types.d.ts +0 -8
- /package/dist/arcgis-coding-components/assets/{arcade-api/t9n/arcade-api.t9n.ar.json → language-api-panel/t9n/language-api-panel.t9n.ar.json} +0 -0
- /package/dist/arcgis-coding-components/assets/{arcade-api/t9n/arcade-api.t9n.bg.json → language-api-panel/t9n/language-api-panel.t9n.bg.json} +0 -0
- /package/dist/arcgis-coding-components/assets/{arcade-api/t9n/arcade-api.t9n.bs.json → language-api-panel/t9n/language-api-panel.t9n.bs.json} +0 -0
- /package/dist/arcgis-coding-components/assets/{arcade-api/t9n/arcade-api.t9n.ca.json → language-api-panel/t9n/language-api-panel.t9n.ca.json} +0 -0
- /package/dist/arcgis-coding-components/assets/{arcade-api/t9n/arcade-api.t9n.cs.json → language-api-panel/t9n/language-api-panel.t9n.cs.json} +0 -0
- /package/dist/arcgis-coding-components/assets/{arcade-api/t9n/arcade-api.t9n.da.json → language-api-panel/t9n/language-api-panel.t9n.da.json} +0 -0
- /package/dist/arcgis-coding-components/assets/{arcade-api/t9n/arcade-api.t9n.de.json → language-api-panel/t9n/language-api-panel.t9n.de.json} +0 -0
- /package/dist/arcgis-coding-components/assets/{arcade-api/t9n/arcade-api.t9n.el.json → language-api-panel/t9n/language-api-panel.t9n.el.json} +0 -0
- /package/dist/arcgis-coding-components/assets/{arcade-api/t9n/arcade-api.t9n.en.json → language-api-panel/t9n/language-api-panel.t9n.en.json} +0 -0
- /package/dist/arcgis-coding-components/assets/{arcade-api/t9n/arcade-api.t9n.es.json → language-api-panel/t9n/language-api-panel.t9n.es.json} +0 -0
- /package/dist/arcgis-coding-components/assets/{arcade-api/t9n/arcade-api.t9n.et.json → language-api-panel/t9n/language-api-panel.t9n.et.json} +0 -0
- /package/dist/arcgis-coding-components/assets/{arcade-api/t9n/arcade-api.t9n.fi.json → language-api-panel/t9n/language-api-panel.t9n.fi.json} +0 -0
- /package/dist/arcgis-coding-components/assets/{arcade-api/t9n/arcade-api.t9n.fr.json → language-api-panel/t9n/language-api-panel.t9n.fr.json} +0 -0
- /package/dist/arcgis-coding-components/assets/{arcade-api/t9n/arcade-api.t9n.he.json → language-api-panel/t9n/language-api-panel.t9n.he.json} +0 -0
- /package/dist/arcgis-coding-components/assets/{arcade-api/t9n/arcade-api.t9n.hr.json → language-api-panel/t9n/language-api-panel.t9n.hr.json} +0 -0
- /package/dist/arcgis-coding-components/assets/{arcade-api/t9n/arcade-api.t9n.hu.json → language-api-panel/t9n/language-api-panel.t9n.hu.json} +0 -0
- /package/dist/arcgis-coding-components/assets/{arcade-api/t9n/arcade-api.t9n.id.json → language-api-panel/t9n/language-api-panel.t9n.id.json} +0 -0
- /package/dist/arcgis-coding-components/assets/{arcade-api/t9n/arcade-api.t9n.it.json → language-api-panel/t9n/language-api-panel.t9n.it.json} +0 -0
- /package/dist/arcgis-coding-components/assets/{arcade-api/t9n/arcade-api.t9n.ja.json → language-api-panel/t9n/language-api-panel.t9n.ja.json} +0 -0
- /package/dist/arcgis-coding-components/assets/{arcade-api/t9n/arcade-api.t9n.ko.json → language-api-panel/t9n/language-api-panel.t9n.ko.json} +0 -0
- /package/dist/arcgis-coding-components/assets/{arcade-api/t9n/arcade-api.t9n.lt.json → language-api-panel/t9n/language-api-panel.t9n.lt.json} +0 -0
- /package/dist/arcgis-coding-components/assets/{arcade-api/t9n/arcade-api.t9n.lv.json → language-api-panel/t9n/language-api-panel.t9n.lv.json} +0 -0
- /package/dist/arcgis-coding-components/assets/{arcade-api/t9n/arcade-api.t9n.nb.json → language-api-panel/t9n/language-api-panel.t9n.nb.json} +0 -0
- /package/dist/arcgis-coding-components/assets/{arcade-api/t9n/arcade-api.t9n.nl.json → language-api-panel/t9n/language-api-panel.t9n.nl.json} +0 -0
- /package/dist/arcgis-coding-components/assets/{arcade-api/t9n/arcade-api.t9n.pl.json → language-api-panel/t9n/language-api-panel.t9n.pl.json} +0 -0
- /package/dist/arcgis-coding-components/assets/{arcade-api/t9n/arcade-api.t9n.pt-BR.json → language-api-panel/t9n/language-api-panel.t9n.pt-BR.json} +0 -0
- /package/dist/arcgis-coding-components/assets/{arcade-api/t9n/arcade-api.t9n.pt-PT.json → language-api-panel/t9n/language-api-panel.t9n.pt-PT.json} +0 -0
- /package/dist/arcgis-coding-components/assets/{arcade-api/t9n/arcade-api.t9n.ro.json → language-api-panel/t9n/language-api-panel.t9n.ro.json} +0 -0
- /package/dist/arcgis-coding-components/assets/{arcade-api/t9n/arcade-api.t9n.ru.json → language-api-panel/t9n/language-api-panel.t9n.ru.json} +0 -0
- /package/dist/arcgis-coding-components/assets/{arcade-api/t9n/arcade-api.t9n.sk.json → language-api-panel/t9n/language-api-panel.t9n.sk.json} +0 -0
- /package/dist/arcgis-coding-components/assets/{arcade-api/t9n/arcade-api.t9n.sl.json → language-api-panel/t9n/language-api-panel.t9n.sl.json} +0 -0
- /package/dist/arcgis-coding-components/assets/{arcade-api/t9n/arcade-api.t9n.sr.json → language-api-panel/t9n/language-api-panel.t9n.sr.json} +0 -0
- /package/dist/arcgis-coding-components/assets/{arcade-api/t9n/arcade-api.t9n.sv.json → language-api-panel/t9n/language-api-panel.t9n.sv.json} +0 -0
- /package/dist/arcgis-coding-components/assets/{arcade-api/t9n/arcade-api.t9n.th.json → language-api-panel/t9n/language-api-panel.t9n.th.json} +0 -0
- /package/dist/arcgis-coding-components/assets/{arcade-api/t9n/arcade-api.t9n.tr.json → language-api-panel/t9n/language-api-panel.t9n.tr.json} +0 -0
- /package/dist/arcgis-coding-components/assets/{arcade-api/t9n/arcade-api.t9n.uk.json → language-api-panel/t9n/language-api-panel.t9n.uk.json} +0 -0
- /package/dist/arcgis-coding-components/assets/{arcade-api/t9n/arcade-api.t9n.vi.json → language-api-panel/t9n/language-api-panel.t9n.vi.json} +0 -0
- /package/dist/arcgis-coding-components/assets/{arcade-api/t9n/arcade-api.t9n.zh-CN.json → language-api-panel/t9n/language-api-panel.t9n.zh-CN.json} +0 -0
- /package/dist/arcgis-coding-components/assets/{arcade-api/t9n/arcade-api.t9n.zh-HK.json → language-api-panel/t9n/language-api-panel.t9n.zh-HK.json} +0 -0
- /package/dist/arcgis-coding-components/assets/{arcade-api/t9n/arcade-api.t9n.zh-TW.json → language-api-panel/t9n/language-api-panel.t9n.zh-TW.json} +0 -0
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
* See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
|
+
* v4.31.0-next.10
|
|
5
|
+
*/
|
|
6
|
+
import { editor, MarkerSeverity, Range, languages } from 'monaco-editor';
|
|
7
|
+
import { DiagnosticSeverity, InsertTextFormat, CompletionItemKind } from 'vscode-languageserver-types';
|
|
8
|
+
import { t as debounce } from './index2.js';
|
|
9
|
+
|
|
10
|
+
//#region Diagnostic
|
|
11
|
+
class DiagnosticsAdapter {
|
|
12
|
+
constructor(_languageId, _worker, { defaults, diagnosticsService, }) {
|
|
13
|
+
this._languageId = _languageId;
|
|
14
|
+
this._worker = _worker;
|
|
15
|
+
this._disposables = [];
|
|
16
|
+
this._listener = new Map();
|
|
17
|
+
this._diagnosticsService = diagnosticsService;
|
|
18
|
+
this._defaults = defaults;
|
|
19
|
+
const onModelAdd = (model) => {
|
|
20
|
+
const languageId = model.getLanguageId();
|
|
21
|
+
if (languageId !== this._languageId) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
const debouncedValidate = debounce(() => {
|
|
25
|
+
this._doValidate(model, languageId).catch((err) => {
|
|
26
|
+
throw err;
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
this._listener.set(model.uri.toString(), model.onDidChangeContent(debouncedValidate));
|
|
30
|
+
this._doValidate(model, languageId).catch(console.error);
|
|
31
|
+
};
|
|
32
|
+
const onModelRemoved = (model) => {
|
|
33
|
+
const uriStr = model.uri.toString();
|
|
34
|
+
editor.setModelMarkers(model, this._languageId, []);
|
|
35
|
+
const listener = this._listener.get(uriStr);
|
|
36
|
+
if (listener) {
|
|
37
|
+
listener.dispose();
|
|
38
|
+
this._listener.delete(uriStr);
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
this._disposables.push(editor.onDidCreateModel(onModelAdd));
|
|
42
|
+
this._disposables.push(editor.onWillDisposeModel((model) => {
|
|
43
|
+
onModelRemoved(model);
|
|
44
|
+
}));
|
|
45
|
+
this._disposables.push(editor.onDidChangeModelLanguage((event) => {
|
|
46
|
+
onModelRemoved(event.model);
|
|
47
|
+
onModelAdd(event.model);
|
|
48
|
+
}));
|
|
49
|
+
this._disposables.push(defaults.onDidChange(() => {
|
|
50
|
+
editor.getModels().forEach((model) => {
|
|
51
|
+
if (model.getLanguageId() === this._languageId) {
|
|
52
|
+
onModelRemoved(model);
|
|
53
|
+
onModelAdd(model);
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
}));
|
|
57
|
+
this._disposables.push(defaults.onModelContextDidChange((key) => {
|
|
58
|
+
editor.getModels().forEach((model) => {
|
|
59
|
+
if (model.getLanguageId() === this._languageId && model.uri.toString() === key) {
|
|
60
|
+
this._doValidate(model, this._languageId).catch(console.error);
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
}));
|
|
64
|
+
this._disposables.push({
|
|
65
|
+
dispose: () => {
|
|
66
|
+
this._listener.forEach((value) => value.dispose());
|
|
67
|
+
this._listener.clear();
|
|
68
|
+
},
|
|
69
|
+
});
|
|
70
|
+
editor.getModels().forEach(onModelAdd);
|
|
71
|
+
}
|
|
72
|
+
dispose() {
|
|
73
|
+
this._disposables.forEach((d) => d.dispose());
|
|
74
|
+
this._disposables = [];
|
|
75
|
+
}
|
|
76
|
+
async _doValidate(model, languageId) {
|
|
77
|
+
if (!model.isAttachedToEditor()) {
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
try {
|
|
81
|
+
const workerProxy = await this._worker(model.uri);
|
|
82
|
+
const context = this._defaults.getApiContextForModel(model.uri);
|
|
83
|
+
const diagnostics = await workerProxy.doValidation(model.uri.toString(), context);
|
|
84
|
+
const markers = diagnostics.map((d) => toMarker(model.uri, d));
|
|
85
|
+
this._diagnosticsService.fireDiagnosticsChange(model.uri, diagnostics);
|
|
86
|
+
editor.setModelMarkers(model, languageId, markers);
|
|
87
|
+
}
|
|
88
|
+
catch (err) {
|
|
89
|
+
console.error(err);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
function toSeverity(languageServiceSeverity) {
|
|
94
|
+
switch (languageServiceSeverity) {
|
|
95
|
+
case DiagnosticSeverity.Error:
|
|
96
|
+
return MarkerSeverity.Error;
|
|
97
|
+
case DiagnosticSeverity.Warning:
|
|
98
|
+
return MarkerSeverity.Warning;
|
|
99
|
+
case DiagnosticSeverity.Information:
|
|
100
|
+
return MarkerSeverity.Info;
|
|
101
|
+
case DiagnosticSeverity.Hint:
|
|
102
|
+
return MarkerSeverity.Hint;
|
|
103
|
+
default:
|
|
104
|
+
return MarkerSeverity.Info;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
function toMarker(_resource, diag) {
|
|
108
|
+
// Diagnostics positions are zero-based, MarkerData are 1-based
|
|
109
|
+
return {
|
|
110
|
+
severity: toSeverity(diag.severity),
|
|
111
|
+
startLineNumber: diag.range.start.line + 1,
|
|
112
|
+
startColumn: diag.range.start.character + 1,
|
|
113
|
+
endLineNumber: diag.range.end.line + 1,
|
|
114
|
+
endColumn: diag.range.end.character + 1,
|
|
115
|
+
message: diag.message,
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
//#endregion
|
|
119
|
+
//#region Completion
|
|
120
|
+
function fromPosition(position) {
|
|
121
|
+
// Language service is zero based
|
|
122
|
+
return { character: position.column - 1, line: position.lineNumber - 1 };
|
|
123
|
+
}
|
|
124
|
+
function toRange(range) {
|
|
125
|
+
return new Range(range.start.line + 1, range.start.character + 1, range.end.line + 1, range.end.character + 1);
|
|
126
|
+
}
|
|
127
|
+
function toTextEdit(textEdit) {
|
|
128
|
+
return {
|
|
129
|
+
range: toRange(textEdit.range),
|
|
130
|
+
text: textEdit.newText,
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
function isInsertReplaceEdit(edit) {
|
|
134
|
+
return (typeof edit.insert !== "undefined" &&
|
|
135
|
+
typeof edit.replace !== "undefined");
|
|
136
|
+
}
|
|
137
|
+
// TODO: extract this function to common util
|
|
138
|
+
function toCompletionItemKind(kind) {
|
|
139
|
+
const mItemKind = languages.CompletionItemKind;
|
|
140
|
+
switch (kind) {
|
|
141
|
+
case CompletionItemKind.Text:
|
|
142
|
+
return mItemKind.Text;
|
|
143
|
+
case CompletionItemKind.Method:
|
|
144
|
+
return mItemKind.Method;
|
|
145
|
+
case CompletionItemKind.Function:
|
|
146
|
+
return mItemKind.Function;
|
|
147
|
+
case CompletionItemKind.Constructor:
|
|
148
|
+
return mItemKind.Constructor;
|
|
149
|
+
case CompletionItemKind.Field:
|
|
150
|
+
return mItemKind.Field;
|
|
151
|
+
case CompletionItemKind.Variable:
|
|
152
|
+
return mItemKind.Variable;
|
|
153
|
+
case CompletionItemKind.Class:
|
|
154
|
+
return mItemKind.Class;
|
|
155
|
+
case CompletionItemKind.Interface:
|
|
156
|
+
return mItemKind.Interface;
|
|
157
|
+
case CompletionItemKind.Module:
|
|
158
|
+
return mItemKind.Module;
|
|
159
|
+
case CompletionItemKind.Property:
|
|
160
|
+
return mItemKind.Property;
|
|
161
|
+
case CompletionItemKind.Unit:
|
|
162
|
+
return mItemKind.Unit;
|
|
163
|
+
case CompletionItemKind.Value:
|
|
164
|
+
return mItemKind.Value;
|
|
165
|
+
case CompletionItemKind.Enum:
|
|
166
|
+
return mItemKind.Enum;
|
|
167
|
+
case CompletionItemKind.Keyword:
|
|
168
|
+
return mItemKind.Keyword;
|
|
169
|
+
case CompletionItemKind.Snippet:
|
|
170
|
+
return mItemKind.Snippet;
|
|
171
|
+
case CompletionItemKind.Color:
|
|
172
|
+
return mItemKind.Color;
|
|
173
|
+
case CompletionItemKind.File:
|
|
174
|
+
return mItemKind.File;
|
|
175
|
+
case CompletionItemKind.Reference:
|
|
176
|
+
return mItemKind.Reference;
|
|
177
|
+
case CompletionItemKind.Folder:
|
|
178
|
+
return mItemKind.Folder;
|
|
179
|
+
case CompletionItemKind.EnumMember:
|
|
180
|
+
return mItemKind.EnumMember;
|
|
181
|
+
case CompletionItemKind.Constant:
|
|
182
|
+
return mItemKind.Constant;
|
|
183
|
+
case CompletionItemKind.Struct:
|
|
184
|
+
return mItemKind.Struct;
|
|
185
|
+
case CompletionItemKind.Event:
|
|
186
|
+
return mItemKind.Event;
|
|
187
|
+
case CompletionItemKind.Operator:
|
|
188
|
+
return mItemKind.Operator;
|
|
189
|
+
case CompletionItemKind.TypeParameter:
|
|
190
|
+
return mItemKind.TypeParameter;
|
|
191
|
+
default:
|
|
192
|
+
return mItemKind.Property;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
class CompletionProvider {
|
|
196
|
+
constructor(_worker, _defaults) {
|
|
197
|
+
this._worker = _worker;
|
|
198
|
+
this._defaults = _defaults;
|
|
199
|
+
this.triggerCharacters = [".", "("];
|
|
200
|
+
}
|
|
201
|
+
async provideCompletionItems(model, position) {
|
|
202
|
+
const worker = await this._worker(model.uri);
|
|
203
|
+
const context = this._defaults.getApiContextForModel(model.uri);
|
|
204
|
+
const completionList = await worker.doComplete(model.uri.toString(), fromPosition(position), context);
|
|
205
|
+
const wordInfo = model.getWordUntilPosition(position);
|
|
206
|
+
const wordRange = new Range(position.lineNumber, wordInfo.startColumn, position.lineNumber, wordInfo.endColumn);
|
|
207
|
+
const items = completionList.items.map((entry) => {
|
|
208
|
+
const item = {
|
|
209
|
+
label: entry.label,
|
|
210
|
+
insertText: entry.insertText || entry.label,
|
|
211
|
+
sortText: entry.sortText,
|
|
212
|
+
filterText: entry.filterText,
|
|
213
|
+
detail: entry.detail,
|
|
214
|
+
range: wordRange,
|
|
215
|
+
kind: toCompletionItemKind(entry.kind),
|
|
216
|
+
};
|
|
217
|
+
if (entry.textEdit) {
|
|
218
|
+
if (isInsertReplaceEdit(entry.textEdit)) {
|
|
219
|
+
item.range = {
|
|
220
|
+
insert: toRange(entry.textEdit.insert),
|
|
221
|
+
replace: toRange(entry.textEdit.replace),
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
else {
|
|
225
|
+
item.range = toRange(entry.textEdit.range);
|
|
226
|
+
}
|
|
227
|
+
item.insertText = entry.textEdit.newText;
|
|
228
|
+
}
|
|
229
|
+
if (entry.additionalTextEdits) {
|
|
230
|
+
item.additionalTextEdits = entry.additionalTextEdits.map(toTextEdit);
|
|
231
|
+
}
|
|
232
|
+
if (entry.insertTextFormat === InsertTextFormat.Snippet) {
|
|
233
|
+
item.insertTextRules = languages.CompletionItemInsertTextRule.InsertAsSnippet;
|
|
234
|
+
}
|
|
235
|
+
if (entry.documentation) {
|
|
236
|
+
if (typeof entry.documentation === "string") {
|
|
237
|
+
item.documentation = entry.documentation;
|
|
238
|
+
}
|
|
239
|
+
else {
|
|
240
|
+
item.documentation = {
|
|
241
|
+
supportThemeIcons: false,
|
|
242
|
+
value: entry.documentation.value,
|
|
243
|
+
supportHtml: true,
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
return item;
|
|
248
|
+
});
|
|
249
|
+
return {
|
|
250
|
+
incomplete: completionList.isIncomplete,
|
|
251
|
+
suggestions: items,
|
|
252
|
+
};
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
//#endregion
|
|
256
|
+
//#region Formatter
|
|
257
|
+
class FormattingProvider {
|
|
258
|
+
constructor(_worker, _defaults) {
|
|
259
|
+
this._worker = _worker;
|
|
260
|
+
this._defaults = _defaults;
|
|
261
|
+
}
|
|
262
|
+
async provideDocumentFormattingEdits(model) {
|
|
263
|
+
const worker = await this._worker(model.uri);
|
|
264
|
+
const context = this._defaults.getApiContextForModel(model.uri.toString());
|
|
265
|
+
const edits = await worker.doFormat(model.uri.toString(), context);
|
|
266
|
+
return edits.map((e) => ({ range: toRange(e.range), text: e.newText }));
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
//#endregion
|
|
270
|
+
|
|
271
|
+
export { CompletionProvider as C, DiagnosticsAdapter as D, FormattingProvider as F, toCompletionItemKind as t };
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
|
-
* See https://js.arcgis.com/4.
|
|
4
|
-
* v4.
|
|
3
|
+
* See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
|
+
* v4.31.0-next.10
|
|
5
5
|
*/
|
|
6
|
-
import { editor,
|
|
7
|
-
import { CompletionItemKind
|
|
8
|
-
import {
|
|
6
|
+
import { editor, languages, Emitter } from 'monaco-editor';
|
|
7
|
+
import { CompletionItemKind } from 'vscode-languageserver-types';
|
|
8
|
+
import { C as CompletionProvider, F as FormattingProvider, D as DiagnosticsAdapter } from './arcade-language-features.js';
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var V={False:"false",Null:"null",True:"true"},f={Break:"break",Continue:"continue",Else:"else",For:"for",From:"from",Function:"function",If:"if",Import:"import",Export:"export",In:"in",Return:"return",Var:"var",While:"while"},Ee=["++","--"],Je=["-","+","!","~"],Qe=["=","/=","*=","%=","+=","-="],Ze=["||","&&"],Lt=["|","&",">>","<<",">>>","^","==","!=","<","<=",">",">=","+","-","*","/","%"];var U=[[],[],[]];Ee.forEach(t=>U[t.length-1]?.push(t));Je.forEach(t=>U[t.length-1]?.push(t));Ze.forEach(t=>U[t.length-1]?.push(t));Qe.forEach(t=>U[t.length-1]?.push(t));Lt.forEach(t=>U[t.length-1]?.push(t));var ft=Object.values(f),gt=Object.values(V);gt.map(t=>({label:t,kind:CompletionItemKind.Constant}));ft.map(t=>({label:t,kind:CompletionItemKind.Keyword}));
|
|
11
11
|
|
|
12
12
|
const operators = [
|
|
13
13
|
"<=",
|
|
@@ -82,7 +82,7 @@ const arcadeMonarchLanguage = {
|
|
|
82
82
|
// builtinFunctions: [...arcadeService.FunctionNames],
|
|
83
83
|
// Arcade keywords. 'from' is a special case as we want to treat it as a keyword in
|
|
84
84
|
// import statement but as an identifer in var statement.
|
|
85
|
-
keywords:
|
|
85
|
+
keywords: ft.filter((k) => k !== "from"),
|
|
86
86
|
operators,
|
|
87
87
|
constants: ["true", "false", "null"],
|
|
88
88
|
// we include these common regular expressions
|
|
@@ -217,266 +217,6 @@ const arcadeMonarchLanguage = {
|
|
|
217
217
|
},
|
|
218
218
|
};
|
|
219
219
|
|
|
220
|
-
//#region Diagnostic
|
|
221
|
-
class DiagnosticsAdapter {
|
|
222
|
-
constructor(_languageId, _worker, { defaults, diagnosticsService, }) {
|
|
223
|
-
this._languageId = _languageId;
|
|
224
|
-
this._worker = _worker;
|
|
225
|
-
this._disposables = [];
|
|
226
|
-
this._listener = new Map();
|
|
227
|
-
this._diagnosticsService = diagnosticsService;
|
|
228
|
-
this._defaults = defaults;
|
|
229
|
-
const onModelAdd = (model) => {
|
|
230
|
-
const languageId = model.getLanguageId();
|
|
231
|
-
if (languageId !== this._languageId) {
|
|
232
|
-
return;
|
|
233
|
-
}
|
|
234
|
-
const debouncedValidate = debounce(() => {
|
|
235
|
-
this._doValidate(model, languageId).catch((err) => {
|
|
236
|
-
throw err;
|
|
237
|
-
});
|
|
238
|
-
});
|
|
239
|
-
this._listener.set(model.uri.toString(), model.onDidChangeContent(debouncedValidate));
|
|
240
|
-
this._doValidate(model, languageId).catch(console.error);
|
|
241
|
-
};
|
|
242
|
-
const onModelRemoved = (model) => {
|
|
243
|
-
const uriStr = model.uri.toString();
|
|
244
|
-
editor.setModelMarkers(model, this._languageId, []);
|
|
245
|
-
const listener = this._listener.get(uriStr);
|
|
246
|
-
if (listener) {
|
|
247
|
-
listener.dispose();
|
|
248
|
-
this._listener.delete(uriStr);
|
|
249
|
-
}
|
|
250
|
-
};
|
|
251
|
-
this._disposables.push(editor.onDidCreateModel(onModelAdd));
|
|
252
|
-
this._disposables.push(editor.onWillDisposeModel((model) => {
|
|
253
|
-
onModelRemoved(model);
|
|
254
|
-
}));
|
|
255
|
-
this._disposables.push(editor.onDidChangeModelLanguage((event) => {
|
|
256
|
-
onModelRemoved(event.model);
|
|
257
|
-
onModelAdd(event.model);
|
|
258
|
-
}));
|
|
259
|
-
this._disposables.push(defaults.onDidChange(() => {
|
|
260
|
-
editor.getModels().forEach((model) => {
|
|
261
|
-
if (model.getLanguageId() === this._languageId) {
|
|
262
|
-
onModelRemoved(model);
|
|
263
|
-
onModelAdd(model);
|
|
264
|
-
}
|
|
265
|
-
});
|
|
266
|
-
}));
|
|
267
|
-
this._disposables.push(defaults.onModelContextDidChange((key) => {
|
|
268
|
-
editor.getModels().forEach((model) => {
|
|
269
|
-
if (model.getLanguageId() === this._languageId && model.uri.toString() === key) {
|
|
270
|
-
this._doValidate(model, this._languageId).catch(console.error);
|
|
271
|
-
}
|
|
272
|
-
});
|
|
273
|
-
}));
|
|
274
|
-
this._disposables.push({
|
|
275
|
-
dispose: () => {
|
|
276
|
-
this._listener.forEach((value) => value.dispose());
|
|
277
|
-
this._listener.clear();
|
|
278
|
-
},
|
|
279
|
-
});
|
|
280
|
-
editor.getModels().forEach(onModelAdd);
|
|
281
|
-
}
|
|
282
|
-
dispose() {
|
|
283
|
-
this._disposables.forEach((d) => d.dispose());
|
|
284
|
-
this._disposables = [];
|
|
285
|
-
}
|
|
286
|
-
async _doValidate(model, languageId) {
|
|
287
|
-
if (!model.isAttachedToEditor()) {
|
|
288
|
-
return;
|
|
289
|
-
}
|
|
290
|
-
try {
|
|
291
|
-
const workerProxy = await this._worker(model.uri);
|
|
292
|
-
const context = this._defaults.getApiContextForModel(model.uri);
|
|
293
|
-
const diagnostics = await workerProxy.doValidation(model.uri.toString(), context);
|
|
294
|
-
const markers = diagnostics.map((d) => toMarker(model.uri, d));
|
|
295
|
-
this._diagnosticsService.fireDiagnosticsChange(model.uri, diagnostics);
|
|
296
|
-
editor.setModelMarkers(model, languageId, markers);
|
|
297
|
-
}
|
|
298
|
-
catch (err) {
|
|
299
|
-
console.error(err);
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
function toSeverity(languageServiceSeverity) {
|
|
304
|
-
switch (languageServiceSeverity) {
|
|
305
|
-
case DiagnosticSeverity.Error:
|
|
306
|
-
return MarkerSeverity.Error;
|
|
307
|
-
case DiagnosticSeverity.Warning:
|
|
308
|
-
return MarkerSeverity.Warning;
|
|
309
|
-
case DiagnosticSeverity.Information:
|
|
310
|
-
return MarkerSeverity.Info;
|
|
311
|
-
case DiagnosticSeverity.Hint:
|
|
312
|
-
return MarkerSeverity.Hint;
|
|
313
|
-
default:
|
|
314
|
-
return MarkerSeverity.Info;
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
function toMarker(_resource, diag) {
|
|
318
|
-
// Diagnostics positions are zero-based, MarkerData are 1-based
|
|
319
|
-
return {
|
|
320
|
-
severity: toSeverity(diag.severity),
|
|
321
|
-
startLineNumber: diag.range.start.line + 1,
|
|
322
|
-
startColumn: diag.range.start.character + 1,
|
|
323
|
-
endLineNumber: diag.range.end.line + 1,
|
|
324
|
-
endColumn: diag.range.end.character + 1,
|
|
325
|
-
message: diag.message,
|
|
326
|
-
};
|
|
327
|
-
}
|
|
328
|
-
//#endregion
|
|
329
|
-
//#region Completion
|
|
330
|
-
function fromPosition(position) {
|
|
331
|
-
// Language service is zero based
|
|
332
|
-
return { character: position.column - 1, line: position.lineNumber - 1 };
|
|
333
|
-
}
|
|
334
|
-
function toRange(range) {
|
|
335
|
-
return new Range(range.start.line + 1, range.start.character + 1, range.end.line + 1, range.end.character + 1);
|
|
336
|
-
}
|
|
337
|
-
function toTextEdit(textEdit) {
|
|
338
|
-
return {
|
|
339
|
-
range: toRange(textEdit.range),
|
|
340
|
-
text: textEdit.newText,
|
|
341
|
-
};
|
|
342
|
-
}
|
|
343
|
-
function isInsertReplaceEdit(edit) {
|
|
344
|
-
return (typeof edit.insert !== "undefined" &&
|
|
345
|
-
typeof edit.replace !== "undefined");
|
|
346
|
-
}
|
|
347
|
-
function toCompletionItemKind(kind) {
|
|
348
|
-
const mItemKind = languages.CompletionItemKind;
|
|
349
|
-
switch (kind) {
|
|
350
|
-
case CompletionItemKind.Text:
|
|
351
|
-
return mItemKind.Text;
|
|
352
|
-
case CompletionItemKind.Method:
|
|
353
|
-
return mItemKind.Method;
|
|
354
|
-
case CompletionItemKind.Function:
|
|
355
|
-
return mItemKind.Function;
|
|
356
|
-
case CompletionItemKind.Constructor:
|
|
357
|
-
return mItemKind.Constructor;
|
|
358
|
-
case CompletionItemKind.Field:
|
|
359
|
-
return mItemKind.Field;
|
|
360
|
-
case CompletionItemKind.Variable:
|
|
361
|
-
return mItemKind.Variable;
|
|
362
|
-
case CompletionItemKind.Class:
|
|
363
|
-
return mItemKind.Class;
|
|
364
|
-
case CompletionItemKind.Interface:
|
|
365
|
-
return mItemKind.Interface;
|
|
366
|
-
case CompletionItemKind.Module:
|
|
367
|
-
return mItemKind.Module;
|
|
368
|
-
case CompletionItemKind.Property:
|
|
369
|
-
return mItemKind.Property;
|
|
370
|
-
case CompletionItemKind.Unit:
|
|
371
|
-
return mItemKind.Unit;
|
|
372
|
-
case CompletionItemKind.Value:
|
|
373
|
-
return mItemKind.Value;
|
|
374
|
-
case CompletionItemKind.Enum:
|
|
375
|
-
return mItemKind.Enum;
|
|
376
|
-
case CompletionItemKind.Keyword:
|
|
377
|
-
return mItemKind.Keyword;
|
|
378
|
-
case CompletionItemKind.Snippet:
|
|
379
|
-
return mItemKind.Snippet;
|
|
380
|
-
case CompletionItemKind.Color:
|
|
381
|
-
return mItemKind.Color;
|
|
382
|
-
case CompletionItemKind.File:
|
|
383
|
-
return mItemKind.File;
|
|
384
|
-
case CompletionItemKind.Reference:
|
|
385
|
-
return mItemKind.Reference;
|
|
386
|
-
case CompletionItemKind.Folder:
|
|
387
|
-
return mItemKind.Folder;
|
|
388
|
-
case CompletionItemKind.EnumMember:
|
|
389
|
-
return mItemKind.EnumMember;
|
|
390
|
-
case CompletionItemKind.Constant:
|
|
391
|
-
return mItemKind.Constant;
|
|
392
|
-
case CompletionItemKind.Struct:
|
|
393
|
-
return mItemKind.Struct;
|
|
394
|
-
case CompletionItemKind.Event:
|
|
395
|
-
return mItemKind.Event;
|
|
396
|
-
case CompletionItemKind.Operator:
|
|
397
|
-
return mItemKind.Operator;
|
|
398
|
-
case CompletionItemKind.TypeParameter:
|
|
399
|
-
return mItemKind.TypeParameter;
|
|
400
|
-
default:
|
|
401
|
-
return mItemKind.Property;
|
|
402
|
-
}
|
|
403
|
-
}
|
|
404
|
-
class CompletionProvider {
|
|
405
|
-
constructor(_worker, _defaults) {
|
|
406
|
-
this._worker = _worker;
|
|
407
|
-
this._defaults = _defaults;
|
|
408
|
-
this.triggerCharacters = [".", "("];
|
|
409
|
-
}
|
|
410
|
-
async provideCompletionItems(model, position) {
|
|
411
|
-
const worker = await this._worker(model.uri);
|
|
412
|
-
const context = this._defaults.getApiContextForModel(model.uri);
|
|
413
|
-
const completionList = await worker.doComplete(model.uri.toString(), fromPosition(position), context);
|
|
414
|
-
const wordInfo = model.getWordUntilPosition(position);
|
|
415
|
-
const wordRange = new Range(position.lineNumber, wordInfo.startColumn, position.lineNumber, wordInfo.endColumn);
|
|
416
|
-
const items = completionList.items.map((entry) => {
|
|
417
|
-
const item = {
|
|
418
|
-
label: entry.label,
|
|
419
|
-
insertText: entry.insertText || entry.label,
|
|
420
|
-
sortText: entry.sortText,
|
|
421
|
-
filterText: entry.filterText,
|
|
422
|
-
detail: entry.detail,
|
|
423
|
-
range: wordRange,
|
|
424
|
-
kind: toCompletionItemKind(entry.kind),
|
|
425
|
-
};
|
|
426
|
-
if (entry.textEdit) {
|
|
427
|
-
if (isInsertReplaceEdit(entry.textEdit)) {
|
|
428
|
-
item.range = {
|
|
429
|
-
insert: toRange(entry.textEdit.insert),
|
|
430
|
-
replace: toRange(entry.textEdit.replace),
|
|
431
|
-
};
|
|
432
|
-
}
|
|
433
|
-
else {
|
|
434
|
-
item.range = toRange(entry.textEdit.range);
|
|
435
|
-
}
|
|
436
|
-
item.insertText = entry.textEdit.newText;
|
|
437
|
-
}
|
|
438
|
-
if (entry.additionalTextEdits) {
|
|
439
|
-
item.additionalTextEdits = entry.additionalTextEdits.map(toTextEdit);
|
|
440
|
-
}
|
|
441
|
-
if (entry.insertTextFormat === InsertTextFormat.Snippet) {
|
|
442
|
-
item.insertTextRules = languages.CompletionItemInsertTextRule.InsertAsSnippet;
|
|
443
|
-
}
|
|
444
|
-
if (entry.documentation) {
|
|
445
|
-
if (typeof entry.documentation === "string") {
|
|
446
|
-
item.documentation = entry.documentation;
|
|
447
|
-
}
|
|
448
|
-
else {
|
|
449
|
-
item.documentation = {
|
|
450
|
-
supportThemeIcons: false,
|
|
451
|
-
value: entry.documentation.value,
|
|
452
|
-
supportHtml: true,
|
|
453
|
-
};
|
|
454
|
-
}
|
|
455
|
-
}
|
|
456
|
-
return item;
|
|
457
|
-
});
|
|
458
|
-
return {
|
|
459
|
-
incomplete: completionList.isIncomplete,
|
|
460
|
-
suggestions: items,
|
|
461
|
-
};
|
|
462
|
-
}
|
|
463
|
-
}
|
|
464
|
-
//#endregion
|
|
465
|
-
//#region Formatter
|
|
466
|
-
class FormattingProvider {
|
|
467
|
-
constructor(_worker, _defaults) {
|
|
468
|
-
this._worker = _worker;
|
|
469
|
-
this._defaults = _defaults;
|
|
470
|
-
}
|
|
471
|
-
async provideDocumentFormattingEdits(model) {
|
|
472
|
-
const worker = await this._worker(model.uri);
|
|
473
|
-
const context = this._defaults.getApiContextForModel(model.uri.toString());
|
|
474
|
-
const edits = await worker.doFormat(model.uri.toString(), context);
|
|
475
|
-
return edits.map((e) => ({ range: toRange(e.range), text: e.newText }));
|
|
476
|
-
}
|
|
477
|
-
}
|
|
478
|
-
//#endregion
|
|
479
|
-
|
|
480
220
|
/**
|
|
481
221
|
* Manager to create our arcade worker and client proxy
|
|
482
222
|
*/
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
|
-
* See https://js.arcgis.com/4.
|
|
4
|
-
* v4.
|
|
3
|
+
* See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
|
+
* v4.31.0-next.10
|
|
5
5
|
*/
|
|
6
|
-
import { proxyCustomElement, HTMLElement, createEvent,
|
|
6
|
+
import { proxyCustomElement, HTMLElement, createEvent, h, Fragment, Host, forceUpdate } from '@stencil/core/internal/client';
|
|
7
7
|
import { g as importArcade, s as supportedFields } from './fields.js';
|
|
8
|
-
import { u as useControllerManager } from './chunk-
|
|
9
|
-
import { s as setValuesInString,
|
|
8
|
+
import { u as useControllerManager } from './chunk-3IUJHIAA.js';
|
|
9
|
+
import { s as setValuesInString, q as quoteString } from './index2.js';
|
|
10
10
|
import { u as useT9n } from './useT9n.js';
|
|
11
11
|
import "@esri/calcite-components/dist/components/calcite-tree.js";
|
|
12
12
|
import "@esri/calcite-components/dist/components/calcite-tree-item.js";
|
|
@@ -372,7 +372,7 @@ this.constructor.__registerControllers = ()=>__cmpMeta[2]??{};
|
|
|
372
372
|
unit: "millisecond",
|
|
373
373
|
maximumFractionDigits: 2,
|
|
374
374
|
}).format(this.result.executionTime ?? 0),
|
|
375
|
-
}) }, h("calcite-icon", { slot: "content-start", icon: "information", scale: "s", class: iconClass })))) : (h("calcite-list-item", { label: this.messages.runscriptmessage
|
|
375
|
+
}) }, h("calcite-icon", { slot: "content-start", icon: "information", scale: "s", class: iconClass })))) : (h("calcite-list-item", { label: this.messages.runscriptmessage }, h("calcite-icon", { slot: "content-start", icon: "information", scale: "s", class: "color-info" })))));
|
|
376
376
|
}
|
|
377
377
|
renderOutputPanel() {
|
|
378
378
|
if (this.openedResultPanel !== "output") {
|
|
@@ -471,7 +471,7 @@ this.constructor.__registerControllers = ()=>__cmpMeta[2]??{};
|
|
|
471
471
|
}))) : null));
|
|
472
472
|
}
|
|
473
473
|
render() {
|
|
474
|
-
return (h(Host, { key: '
|
|
474
|
+
return (h(Host, { key: 'a9686019caaf1b001b0500d36539817f5de98bde' }, h("header", { key: 'ab5192ba30c67df933b0b61d8ab1875278aef3a5', class: "flex-row" }, h("calcite-action-bar", { key: '6ed2b45b6d1257c1d0d21bcb7158485e3133035a', class: "flex-adjustable", layout: "horizontal", scale: "s", expanded: true, "expand-disabled": true }, h("calcite-action-group", { key: '85fccd7ecd4d87f1d83e19c561b8020008ffe323', scale: "s" }, h("calcite-action", { key: 'c6e8663a817c53f7c9864cd4acaa734f4d80b1c5', active: this.openedResultPanel === "output", text: this.messages.output ?? "", textEnabled: true, scale: "s", icon: "list-show-all", iconFlipRtl: true, onClick: this._switchResultPanel, "data-panel-name": "output" }), h("calcite-action", { key: 'b38da4019d3f2acde28e4c528be9fcdc8db04728', active: this.openedResultPanel === "console", text: this.messages.console ?? "", textEnabled: true, scale: "s", icon: "console", iconFlipRtl: true, onClick: this._switchResultPanel, "data-panel-name": "console" }), h("calcite-action", { key: 'da45ab9baa6cab3d1ad88dc15547395e86cb3f08', active: this.openedResultPanel === "log", text: this.messages.log ?? "", textEnabled: true, scale: "s", icon: "list", iconFlipRtl: true, onClick: this._switchResultPanel, "data-panel-name": "log" }))), h("calcite-action", { key: '0110dc0164551a5b3f560fbd4ddac4c73109707b', scale: "s", icon: "x", text: this.messages.close ?? "", onClick: this._emitClose })), h("article", { key: 'fb31b6f32eae1d7ee0ff5ea78e057f79c95ea8d2', class: "flex-adjustable" }, this.loading ? (h("calcite-loader", { scale: "s", type: "indeterminate", label: "" })) : (h("div", { class: "flex-column y-scrollable-container" }, this.renderOutputPanel(), this.renderConsolePanel(), this.renderLogPanel())))));
|
|
475
475
|
}
|
|
476
476
|
static get assetsDirs() { return ["assets"]; }
|
|
477
477
|
get el() { return this; }
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
|
-
* See https://js.arcgis.com/4.
|
|
4
|
-
* v4.
|
|
3
|
+
* See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
|
+
* v4.31.0-next.10
|
|
5
5
|
*/
|
|
6
6
|
import { proxyCustomElement, HTMLElement, createEvent, forceUpdate, h, Host } from '@stencil/core/internal/client';
|
|
7
|
-
import { g as generateColorizeStyles, o as onColorizeThemeChanged, c as convertMarkdownString,
|
|
7
|
+
import { g as generateColorizeStyles, o as onColorizeThemeChanged, c as convertMarkdownString, a as colorizeCodeElement } from './markdown.js';
|
|
8
8
|
import { f as filterCollection } from './utilities.js';
|
|
9
|
-
import { u as useControllerManager } from './chunk-
|
|
10
|
-
import {
|
|
9
|
+
import { u as useControllerManager } from './chunk-3IUJHIAA.js';
|
|
10
|
+
import { r as setFocusOnElement } from './index2.js';
|
|
11
11
|
import { u as useT9n } from './useT9n.js';
|
|
12
12
|
import "@esri/calcite-components/dist/components/calcite-list-item-group.js";
|
|
13
13
|
import "@esri/calcite-components/dist/components/calcite-list-item.js";
|
|
@@ -125,7 +125,7 @@ this.constructor.__registerControllers = ()=>__cmpMeta[2]??{};
|
|
|
125
125
|
renderSuggestionListItems(suggestions) {
|
|
126
126
|
suggestions = filterCollection(suggestions, "label", this._filterValue);
|
|
127
127
|
if (!suggestions.length) {
|
|
128
|
-
return h("div", { class: "notice-container" }, this.messages.noitems
|
|
128
|
+
return h("div", { class: "notice-container" }, this.messages.noitems);
|
|
129
129
|
}
|
|
130
130
|
return suggestions.map((suggestion) => (h("calcite-list-item", { label: suggestion.label, description: suggestion.description, onCalciteListItemSelect: this._emitItemSelected, onKeyPress: this._emitItemSelected, "data-item": suggestion }, h("calcite-action", { slot: "actions-end", text: this.messages.expand ?? "", scale: "s", icon: "chevron-right", iconFlipRtl: true, onClick: this._showSuggestionDetail, "data-item": suggestion }))));
|
|
131
131
|
}
|
|
@@ -134,10 +134,10 @@ this.constructor.__registerControllers = ()=>__cmpMeta[2]??{};
|
|
|
134
134
|
if (!suggestion) {
|
|
135
135
|
return null;
|
|
136
136
|
}
|
|
137
|
-
return (h("calcite-flow-item", { heading: this.messages.suggestions, closable: true, onCalciteFlowItemClose: this._emitClose, beforeBack: this._beforeBack }, h("calcite-button", { width: "half", slot: "footer", appearance: "outline", kind: "brand",
|
|
137
|
+
return (h("calcite-flow-item", { heading: this.messages.suggestions, closable: true, onCalciteFlowItemClose: this._emitClose, beforeBack: this._beforeBack }, h("calcite-button", { width: "half", slot: "footer", appearance: "outline", kind: "brand", iconStart: "code", scale: "s", onClick: this._emitItemSelected, ref: (e) => void e?.setFocus(), "data-item": suggestion }, this.messages.insert), h("calcite-block", { open: true, heading: suggestion.label, description: suggestion.description }, h("div", { innerHTML: convertMarkdownString(suggestion.documentation) }), h("pre", null, h("code", { ref: (e) => e === undefined ? undefined : void colorizeCodeElement(e, suggestion.code).catch(console.error) })))));
|
|
138
138
|
}
|
|
139
139
|
render() {
|
|
140
|
-
return (h(Host, { key: '
|
|
140
|
+
return (h(Host, { key: 'fc55be12efad3be68c0612c086f468826a9b13b7' }, h("style", { key: '5274396deaed7ea9f9275773bb9a2090f6713ad8' }, this._colorizeStyle), h("calcite-flow", { key: '94643eecc38f1cea329db6e2b4c4ec6477e6a081', ref: (ref) => this.flowFocusHandler(ref) }, h("calcite-flow-item", { key: '9fd69601bbeb818527bb521cc288706a5cebc4b2', heading: this.messages.suggestions, closable: true, onCalciteFlowItemClose: this._emitClose }, h("calcite-input", { key: 'd95ed08a58313c952e397e641d6d9d55a1d5d3d9', value: this._filterValue, icon: "magnifying-glass", clearable: true, onCalciteInputInput: this._updateFilterValue, class: "sticky", scale: "m" }), h("calcite-list", { key: 'c63c404469b5c21f867e763a3865f60104e0c23c' }, this.renderSuggestionGroups())), this.renderSuggestionFlowItem())));
|
|
141
141
|
}
|
|
142
142
|
static get assetsDirs() { return ["assets"]; }
|
|
143
143
|
get el() { return this; }
|