@arcgis/coding-components 4.31.0-next.3 → 4.31.0-next.30
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/README.md +22 -3
- package/dist/arcgis-coding-components/arcgis-coding-components.esm.js +2 -2
- package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.ar.json +1 -1
- package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.bg.json +1 -1
- package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.bs.json +1 -1
- package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.ca.json +6 -6
- package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.cs.json +1 -1
- package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.da.json +1 -1
- package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.de.json +1 -1
- package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.el.json +1 -1
- package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.es.json +1 -1
- package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.et.json +1 -1
- package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.fi.json +1 -1
- package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.fr.json +1 -1
- package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.he.json +1 -1
- package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.hr.json +1 -1
- package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.id.json +1 -1
- package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.it.json +1 -1
- package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.ko.json +1 -1
- package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.nb.json +1 -1
- package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.nl.json +1 -1
- package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.pl.json +1 -1
- package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.pt-BR.json +1 -1
- package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.pt-PT.json +1 -1
- package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.ru.json +1 -1
- package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.sk.json +1 -1
- package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.sl.json +1 -1
- package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.sr.json +1 -1
- package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.sv.json +1 -1
- package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.th.json +1 -1
- package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.tr.json +1 -1
- package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.uk.json +5 -5
- package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.vi.json +1 -1
- package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.zh-CN.json +1 -1
- package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.zh-HK.json +1 -1
- package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.zh-TW.json +1 -1
- package/dist/arcgis-coding-components/assets/arcade-results/t9n/arcade-results.t9n.ca.json +2 -2
- package/dist/arcgis-coding-components/assets/arcade-results/t9n/arcade-results.t9n.de.json +1 -1
- package/dist/arcgis-coding-components/assets/arcade-results/t9n/arcade-results.t9n.he.json +1 -1
- package/dist/arcgis-coding-components/assets/arcade-variables/t9n/arcade-variables.t9n.ca.json +1 -1
- package/dist/arcgis-coding-components/assets/arcade-variables/t9n/arcade-variables.t9n.it.json +1 -1
- package/dist/arcgis-coding-components/assets/code-editor/sql-expr.worker.js +447 -7
- package/dist/arcgis-coding-components/assets/language-api-panel/t9n/language-api-panel.t9n.ca.json +1 -1
- package/dist/arcgis-coding-components/index.esm.js +2 -2
- package/dist/arcgis-coding-components/{p-42c8b545.js → p-1cec2132.js} +3 -3
- package/dist/arcgis-coding-components/{p-3ca5ba95.entry.js → p-2186676a.entry.js} +2 -2
- package/dist/arcgis-coding-components/{p-86106a9a.js → p-26f5a06d.js} +1 -1
- package/dist/arcgis-coding-components/p-3645c71d.entry.js +6 -0
- package/dist/arcgis-coding-components/{p-8b4298d5.js → p-4ce2a213.js} +2 -2
- package/dist/arcgis-coding-components/{p-111ba641.js → p-57bde3ee.js} +2 -2
- package/dist/arcgis-coding-components/p-57dbf777.js +7 -0
- package/dist/arcgis-coding-components/{p-9132bc9c.entry.js → p-639adfca.entry.js} +2 -2
- package/dist/arcgis-coding-components/p-71d639a6.js +6 -0
- package/dist/arcgis-coding-components/{p-6554a853.js → p-72266079.js} +1 -1
- package/dist/arcgis-coding-components/p-7e2ae261.js +6 -0
- package/dist/arcgis-coding-components/{p-5eb82abf.js → p-8897f806.js} +2 -2
- package/dist/arcgis-coding-components/p-91bb956b.js +6 -0
- package/dist/arcgis-coding-components/p-9b2002c3.js +6 -0
- package/dist/arcgis-coding-components/{p-7c6b3d40.js → p-9c411f13.js} +2 -2
- package/dist/arcgis-coding-components/{p-c4a5150e.js → p-bd309794.js} +3 -3
- package/dist/arcgis-coding-components/{p-4986aaf2.js → p-cc0edd81.js} +3 -3
- package/dist/arcgis-coding-components/{p-93d0e0cc.js → p-e295aee1.js} +12 -12
- package/dist/arcgis-coding-components/p-fe4ee070.js +6 -0
- package/dist/cjs/{app-globals-92c5b499.js → app-globals-e98febdb.js} +1 -1
- package/dist/cjs/arcade-defaults-c6ecbcbe.js +349 -0
- package/dist/cjs/arcade-language-features-eeb1f261.js +274 -0
- package/dist/cjs/{arcade-mode-dfd66b4b.js → arcade-mode-a2d05415.js} +6 -266
- package/dist/cjs/arcgis-arcade-editor_6.cjs.entry.js +20 -26
- package/dist/cjs/arcgis-coding-components.cjs.js +5 -5
- package/dist/cjs/arcgis-sql-expression-editor.cjs.entry.js +4 -4
- package/dist/cjs/arcgis-sql-expression-fields.cjs.entry.js +4 -4
- package/dist/cjs/{css-9b0053c3.js → css-1b37a5a3.js} +1 -1
- package/dist/cjs/{cssMode-62e53008.js → cssMode-e08a9e80.js} +2 -3
- package/dist/cjs/{html-3036e89e.js → html-b55754c8.js} +2 -3
- package/dist/cjs/{htmlMode-c37eee42.js → htmlMode-e335e2e0.js} +2 -3
- package/dist/cjs/{index-be6b2520.js → index-1e6c6daf.js} +43 -15
- package/dist/cjs/index.cjs.js +4 -4
- package/dist/cjs/{javascript-7276c023.js → javascript-5d6e0e2f.js} +3 -4
- package/dist/cjs/{jsonMode-baa295f0.js → jsonMode-5aeae11c.js} +2 -3
- package/dist/cjs/{language-defaults-base-5817af52.js → language-defaults-base-b33c98c5.js} +842 -1062
- package/dist/cjs/loader.cjs.js +4 -4
- package/dist/cjs/{sql-expr-defaults-746bbc5f.js → sql-expr-defaults-2fcbfae4.js} +101 -39
- package/dist/cjs/sql-expr-mode-72880fff.js +1171 -0
- package/dist/cjs/{tsMode-36398912.js → tsMode-5559948f.js} +2 -3
- package/dist/cjs/{typescript-608a420b.js → typescript-6dfdd308.js} +2 -3
- package/dist/components/arcade-defaults.js +238 -4
- package/dist/components/arcade-language-features.js +271 -0
- package/dist/components/arcade-mode.js +4 -264
- package/dist/components/arcade-results.js +3 -3
- package/dist/components/arcade-suggestions.js +2 -2
- package/dist/components/arcade-variables.js +2 -2
- package/dist/components/arcgis-arcade-editor.js +7 -6
- package/dist/components/arcgis-arcade-results.js +1 -1
- package/dist/components/arcgis-arcade-suggestions.js +1 -1
- package/dist/components/arcgis-arcade-variables.js +1 -1
- package/dist/components/arcgis-assets.d.ts +1 -1
- package/dist/components/arcgis-assets.js +1 -1
- package/dist/components/arcgis-code-editor.js +1 -1
- package/dist/components/arcgis-language-api-panel.js +1 -1
- package/dist/components/arcgis-sql-expression-editor.js +2 -2
- package/dist/components/arcgis-sql-expression-fields.js +1 -1
- package/dist/components/{chunk-6TARY3NN.js → chunk-EOMOY2EF.js} +12 -17
- package/dist/components/code-editor.js +16 -23
- package/dist/components/fields.js +22 -4
- package/dist/components/index.d.ts +18 -3
- package/dist/components/index.js +1 -1
- package/dist/components/index2.js +2 -2
- package/dist/components/language-api-panel.js +2 -2
- package/dist/components/language-defaults-base.js +81 -323
- package/dist/components/markdown.js +1 -1
- package/dist/components/sql-expr-defaults.js +89 -24
- package/dist/components/sql-expr-mode.js +1009 -24971
- package/dist/components/sql-expression-fields.js +2 -2
- package/dist/components/useT9n.js +2 -2
- package/dist/components/utilities.js +1 -1
- package/dist/esm/{app-globals-5e178541.js → app-globals-906d2920.js} +1 -1
- package/dist/esm/arcade-defaults-01c1778e.js +344 -0
- package/dist/esm/arcade-language-features-5d86df55.js +269 -0
- package/dist/esm/{arcade-mode-02336ce9.js → arcade-mode-ffa50b73.js} +3 -263
- package/dist/esm/arcgis-arcade-editor_6.entry.js +21 -27
- package/dist/esm/arcgis-coding-components.js +6 -6
- package/dist/esm/arcgis-sql-expression-editor.entry.js +4 -4
- package/dist/esm/arcgis-sql-expression-fields.entry.js +4 -4
- package/dist/esm/{css-e79f1ed1.js → css-e6d12b19.js} +1 -1
- package/dist/esm/{cssMode-cd007d02.js → cssMode-eda5bf61.js} +2 -3
- package/dist/esm/{html-d079d00d.js → html-b5f697d7.js} +2 -3
- package/dist/esm/{htmlMode-ff14e035.js → htmlMode-1b54015e.js} +2 -3
- package/dist/esm/{index-88fc341d.js → index-0ec9c3f1.js} +43 -15
- package/dist/esm/index.js +4 -4
- package/dist/esm/{javascript-69f7c282.js → javascript-f1c7843a.js} +3 -4
- package/dist/esm/{jsonMode-18ddadde.js → jsonMode-2277640b.js} +2 -3
- package/dist/esm/{language-defaults-base-6687d11a.js → language-defaults-base-b508c08f.js} +837 -1062
- package/dist/esm/loader.js +5 -5
- package/dist/esm/{sql-expr-defaults-2cdfe08a.js → sql-expr-defaults-715f6bad.js} +100 -40
- package/dist/esm/sql-expr-mode-3cd5df90.js +1167 -0
- package/dist/esm/{tsMode-c2e5d33a.js → tsMode-075abf4a.js} +2 -3
- package/dist/esm/{typescript-a0fbebf0.js → typescript-22cfacaa.js} +2 -3
- package/dist/loader/cdn.js +2 -3
- package/dist/loader/index.cjs.js +2 -3
- package/dist/loader/index.es2017.js +2 -3
- package/dist/loader/index.js +2 -3
- package/dist/types/components/arcade-editor/arcade-editor.d.ts +13 -3
- package/dist/types/components/arcade-results/arcade-results.d.ts +1 -1
- package/dist/types/components/arcade-suggestions/arcade-suggestions.d.ts +1 -1
- package/dist/types/components/arcade-variables/arcade-variables.d.ts +1 -1
- package/dist/types/components/code-editor/code-editor.d.ts +14 -4
- package/dist/types/components/language-api-panel/language-api-panel.d.ts +1 -1
- package/dist/types/components.d.ts +13 -13
- package/dist/types/data/actions-runner-1/_work/arcgis-web-components/arcgis-web-components/packages/coding-packages/coding-components/.stencil/stories/internal/arcade-editor/arcade-editor.stories.d.ts +8 -1
- package/dist/types/data/actions-runner-1/_work/arcgis-web-components/arcgis-web-components/packages/coding-packages/coding-components/.stencil/stories/internal/arcade-editor/editorContext.d.ts +5 -1
- package/dist/types/stencil-public-runtime.d.ts +3 -8
- package/dist/types/utils/arcade-monaco/arcade-language-features.d.ts +1 -0
- package/dist/types/utils/arcade-monaco/arcade-profile-strategy.d.ts +9 -0
- package/dist/types/utils/fields.d.ts +2 -2
- package/dist/types/utils/profile/editor-profile.d.ts +7 -6
- package/dist/types/utils/profile/types.d.ts +53 -65
- package/dist/types/utils/profile/utils.d.ts +9 -8
- package/dist/types/utils/sql-expr-monaco/sql-expr-completion.d.ts +3 -2
- package/dist/types/utils/sql-expr-monaco/sql-expr-constants.d.ts +45 -0
- package/dist/types/utils/sql-expr-monaco/sql-expr-contribution.d.ts +1 -11
- package/dist/types/utils/sql-expr-monaco/sql-expr-defaults.d.ts +0 -1
- package/dist/types/utils/sql-expr-monaco/sql-expr-language-features.d.ts +19 -520
- package/dist/types/utils/sql-expr-monaco/sql-expr-mode.d.ts +34 -1
- package/dist/types/utils/sql-expr-monaco/sql-expr-service-accessors.d.ts +19 -0
- package/dist/types/utils/sql-expr-monaco/sql-expr-validation-diagnostic-adapter.d.ts +0 -7
- package/dist/types/utils/sql-expr-monaco/sql-expr-validation-utils.d.ts +75 -77
- package/dist/types/utils/sql-expr-monaco/sql-expr-validation.d.ts +5 -6
- package/dist/types/utils/sql-expr-monaco/sql-expr-worker-manager.d.ts +2 -0
- package/dist/types/utils/sql-expr-monaco/sql-expr.worker.d.ts +9 -6
- package/dist/types/utils/sql-expr-monaco/sql-expression-profile-strategy.d.ts +13 -0
- package/dist/types/utils/sql-expr-monaco/types.d.ts +6 -12
- package/package.json +19 -19
- package/dist/arcgis-coding-components/p-0105cc95.js +0 -6
- package/dist/arcgis-coding-components/p-5e26a360.js +0 -6
- package/dist/arcgis-coding-components/p-9c7e0089.js +0 -7
- package/dist/arcgis-coding-components/p-b82e98f0.js +0 -6
- package/dist/arcgis-coding-components/p-d353f1ba.entry.js +0 -6
- package/dist/arcgis-coding-components/p-fe6ccfe0.js +0 -6
- package/dist/cjs/arcade-defaults-34e82ff5.js +0 -116
- package/dist/cjs/sql-expr-mode-a9f1b697.js +0 -25135
- package/dist/esm/arcade-defaults-6dac6b30.js +0 -111
- package/dist/esm/polyfills/core-js.js +0 -11
- package/dist/esm/polyfills/dom.js +0 -79
- package/dist/esm/polyfills/es5-html-element.js +0 -1
- package/dist/esm/polyfills/index.js +0 -34
- package/dist/esm/polyfills/system.js +0 -6
- package/dist/esm/sql-expr-mode-f10e5a43.js +0 -25132
- package/dist/types/utils/profile/predefined-profile.d.ts +0 -4
- package/dist/types/utils/sql-expr-monaco/DependentFiles/DateOnly.d.ts +0 -41
- package/dist/types/utils/sql-expr-monaco/DependentFiles/SqlInterval.d.ts +0 -16
- package/dist/types/utils/sql-expr-monaco/DependentFiles/SqlTimestampOffset.d.ts +0 -26
- package/dist/types/utils/sql-expr-monaco/DependentFiles/TimeOnly.d.ts +0 -37
- package/dist/types/utils/sql-expr-monaco/DependentFiles/UnknownTimeZone.d.ts +0 -11
- package/dist/types/utils/sql-expr-monaco/DependentFiles/WhereGrammar.d.ts +0 -122
- package/dist/types/utils/sql-expr-monaco/DependentFiles/sqlCompareUtils.d.ts +0 -5
- package/dist/types/utils/sql-expr-monaco/DependentFiles/sqlDateParsingUtils.d.ts +0 -18
- package/dist/types/utils/sql-expr-monaco/DependentFiles/sqlUtils.d.ts +0 -6
- package/dist/types/utils/sql-expr-monaco/DependentFiles/standardizedFunctions.d.ts +0 -156
- package/dist/types/utils/sql-expr-monaco/DependentFiles/support.d.ts +0 -150
- package/dist/types/utils/sql-expr-monaco/PeggyGrammar/sql92grammar.d.ts +0 -1397
- package/dist/types/utils/sql-expr-monaco/libraries/date/properties/index.d.ts +0 -59
- package/dist/types/utils/sql-expr-monaco/libraries/numeric/properties/index.d.ts +0 -295
- package/dist/types/utils/sql-expr-monaco/libraries/string/properties/index.d.ts +0 -135
- package/dist/types/utils/sql-expr-monaco/sql-expr-validation-adapter.d.ts +0 -3
- package/dist/types/utils/sql-expr-profile/predefined-profile.d.ts +0 -2
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
* See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
|
-
* v4.31.0-next.
|
|
4
|
+
* v4.31.0-next.30
|
|
5
5
|
*/
|
|
6
6
|
'use strict';
|
|
7
7
|
|
|
8
|
-
const languageDefaultsBase = require('./language-defaults-base-
|
|
9
|
-
require('./index-be6b2520.js');
|
|
8
|
+
const languageDefaultsBase = require('./language-defaults-base-b33c98c5.js');
|
|
10
9
|
|
|
11
10
|
/*!-----------------------------------------------------------------------------
|
|
12
11
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
* See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
|
-
* v4.31.0-next.
|
|
4
|
+
* v4.31.0-next.30
|
|
5
5
|
*/
|
|
6
6
|
'use strict';
|
|
7
7
|
|
|
8
|
-
const languageDefaultsBase = require('./language-defaults-base-
|
|
9
|
-
require('./index-be6b2520.js');
|
|
8
|
+
const languageDefaultsBase = require('./language-defaults-base-b33c98c5.js');
|
|
10
9
|
|
|
11
10
|
/*!-----------------------------------------------------------------------------
|
|
12
11
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
* See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
|
-
* v4.31.0-next.
|
|
4
|
+
* v4.31.0-next.30
|
|
5
5
|
*/
|
|
6
6
|
import { Uri } from 'monaco-editor';
|
|
7
|
-
import {
|
|
8
|
-
import { f as fetchT9nStringsBundle } from './index2.js';
|
|
7
|
+
import { f as fieldsToProfileValues, i as isPredefinedProfile, a as isFeatureSetCollectionDefinition, b as isFeatureSetDefinition, c as isFeatureDefinition, L as LanguageDefaultsBase, E as EditorProfile } from './language-defaults-base.js';
|
|
8
|
+
import { s as supportedLocales, f as fetchT9nStringsBundle } from './index2.js';
|
|
9
|
+
import { CompletionItemKind, InsertTextMode, InsertTextFormat } from 'vscode-languageserver-types';
|
|
9
10
|
import { getArcgisAssetPath as getAssetPath } from "./arcgis-assets.js";
|
|
10
11
|
|
|
11
12
|
/**
|
|
@@ -43,6 +44,239 @@ async function getMode() {
|
|
|
43
44
|
return await import('./arcade-mode.js');
|
|
44
45
|
}
|
|
45
46
|
|
|
47
|
+
// #region convert editor profile to apiProfile
|
|
48
|
+
/**
|
|
49
|
+
* Converts an editor profile to an api profile.
|
|
50
|
+
* The api profile is an optimized version of the editor profile designed for minimal data transfer between the main thread and the worker.
|
|
51
|
+
*/
|
|
52
|
+
async function arcadeEditorToApiProfile(editorProfile) {
|
|
53
|
+
const { apiVersion, bundles, hiddenApiItems } = editorProfile.toEditorProfileDefinition();
|
|
54
|
+
const variables = await variablesToLSVariable(editorProfile.dictionaryVariables);
|
|
55
|
+
return { apiVersion, bundles, variables, hiddenApiItems: hiddenApiItems?.map((s) => s.toLowerCase()) };
|
|
56
|
+
}
|
|
57
|
+
async function variablesToLSVariable(editorVariables, kind = CompletionItemKind.Variable) {
|
|
58
|
+
return await Promise.all(editorVariables.map(async (editorVariable) => {
|
|
59
|
+
switch (editorVariable.type) {
|
|
60
|
+
case "dictionary":
|
|
61
|
+
return await dictionaryToLSDictionary(editorVariable, kind);
|
|
62
|
+
case "feature":
|
|
63
|
+
return await featureToLSFeature(editorVariable, kind);
|
|
64
|
+
default:
|
|
65
|
+
return variableToLSVariable(editorVariable, kind);
|
|
66
|
+
}
|
|
67
|
+
}));
|
|
68
|
+
}
|
|
69
|
+
function variableToLSVariable(editorVariable, kind) {
|
|
70
|
+
const { name, type } = editorVariable;
|
|
71
|
+
const description = editorVariable.getDescription();
|
|
72
|
+
return {
|
|
73
|
+
name,
|
|
74
|
+
description,
|
|
75
|
+
type,
|
|
76
|
+
completion: {
|
|
77
|
+
label: name,
|
|
78
|
+
detail: name,
|
|
79
|
+
insertText: name,
|
|
80
|
+
insertTextMode: InsertTextMode.asIs,
|
|
81
|
+
insertTextFormat: InsertTextFormat.PlainText,
|
|
82
|
+
kind,
|
|
83
|
+
documentation: { kind: "markdown", value: description },
|
|
84
|
+
},
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
async function featureToLSFeature(editorFeature, kind) {
|
|
88
|
+
// Get the source for the definition
|
|
89
|
+
const source = await editorFeature.loadSource();
|
|
90
|
+
const { name } = editorFeature;
|
|
91
|
+
const description = editorFeature.getDescription();
|
|
92
|
+
const resultCompletion = {
|
|
93
|
+
label: name,
|
|
94
|
+
detail: name,
|
|
95
|
+
insertText: name,
|
|
96
|
+
insertTextMode: InsertTextMode.asIs,
|
|
97
|
+
insertTextFormat: InsertTextFormat.PlainText,
|
|
98
|
+
kind,
|
|
99
|
+
};
|
|
100
|
+
const result = {
|
|
101
|
+
name,
|
|
102
|
+
description,
|
|
103
|
+
type: "dictionary",
|
|
104
|
+
properties: [],
|
|
105
|
+
completion: resultCompletion,
|
|
106
|
+
};
|
|
107
|
+
// No source definition, then it will be a feature without any known fields
|
|
108
|
+
if (!source) {
|
|
109
|
+
return result;
|
|
110
|
+
}
|
|
111
|
+
// Create properties for the fields and the aliases
|
|
112
|
+
// Also improve the feature completion documentation
|
|
113
|
+
const [properties, featureCompletionDescription] = fieldsToProfileValues(source.fields, description, true);
|
|
114
|
+
result.properties = properties;
|
|
115
|
+
resultCompletion.documentation = { kind: "markdown", value: featureCompletionDescription };
|
|
116
|
+
return result;
|
|
117
|
+
}
|
|
118
|
+
async function dictionaryToLSDictionary(editorDictionary, kind) {
|
|
119
|
+
const { name, dictionaryVariables: variables } = editorDictionary;
|
|
120
|
+
const description = editorDictionary.getDescription();
|
|
121
|
+
const completionDescription = variables.reduce((previous, p) => {
|
|
122
|
+
if (previous !== "") {
|
|
123
|
+
previous += " \n \n";
|
|
124
|
+
}
|
|
125
|
+
previous += `**${p.name}** \n${p.type}`;
|
|
126
|
+
const description = p.getDescription();
|
|
127
|
+
if (description) {
|
|
128
|
+
previous += ` \n${description}`;
|
|
129
|
+
}
|
|
130
|
+
return previous;
|
|
131
|
+
}, description);
|
|
132
|
+
return {
|
|
133
|
+
name,
|
|
134
|
+
description,
|
|
135
|
+
type: "dictionary",
|
|
136
|
+
properties: await variablesToLSVariable(variables, CompletionItemKind.Field),
|
|
137
|
+
completion: {
|
|
138
|
+
label: name,
|
|
139
|
+
detail: name,
|
|
140
|
+
insertText: name,
|
|
141
|
+
insertTextMode: InsertTextMode.asIs,
|
|
142
|
+
insertTextFormat: InsertTextFormat.PlainText,
|
|
143
|
+
kind,
|
|
144
|
+
documentation: { kind: "markdown", value: completionDescription },
|
|
145
|
+
},
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
// #endregion
|
|
149
|
+
// #region predefined profile to editor profile definition
|
|
150
|
+
/**
|
|
151
|
+
* Get a PredefinedProfile for a locale. If not already loaded then fetch it.
|
|
152
|
+
* If the locale doesn't exist or the locale profile file doesn't exist then returns
|
|
153
|
+
* the english version of the profile.
|
|
154
|
+
*/
|
|
155
|
+
async function getSdkPredefinedProfiles(locale = "en") {
|
|
156
|
+
const profiles = sdkPredefinedProfilesMap.get(locale);
|
|
157
|
+
if (profiles) {
|
|
158
|
+
return profiles;
|
|
159
|
+
}
|
|
160
|
+
if (!supportedLocales.has(locale)) {
|
|
161
|
+
return await getSdkPredefinedProfiles("en");
|
|
162
|
+
}
|
|
163
|
+
try {
|
|
164
|
+
const response = await fetch(getAssetPath(`./assets/arcade-language/profiles/arcade-profiles.t9n.${locale}.json`));
|
|
165
|
+
if (response.ok) {
|
|
166
|
+
return cacheSdkPredefinedProfiles(locale, (await response.json()));
|
|
167
|
+
}
|
|
168
|
+
if (locale === "en") {
|
|
169
|
+
return null;
|
|
170
|
+
}
|
|
171
|
+
return await getSdkPredefinedProfiles("en");
|
|
172
|
+
}
|
|
173
|
+
catch {
|
|
174
|
+
return null;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
const sdkPredefinedProfilesMap = new Map();
|
|
178
|
+
/**
|
|
179
|
+
* Convert a stored profile into a PredefinedProfile and add it to the in-memory
|
|
180
|
+
* Map of profiles per locale.
|
|
181
|
+
*/
|
|
182
|
+
function cacheSdkPredefinedProfiles(locale, profiles) {
|
|
183
|
+
const map = new Map();
|
|
184
|
+
profiles.forEach((profile) => {
|
|
185
|
+
map.set(profile.id, profile);
|
|
186
|
+
});
|
|
187
|
+
sdkPredefinedProfilesMap.set(locale, map);
|
|
188
|
+
return map;
|
|
189
|
+
}
|
|
190
|
+
async function getSdkPredefinedProfile(id, locale = "en") {
|
|
191
|
+
const profiles = await getSdkPredefinedProfiles(locale);
|
|
192
|
+
return profiles?.get(id) ?? null;
|
|
193
|
+
}
|
|
194
|
+
function isExtendedPredefinedProfileDefinition(item) {
|
|
195
|
+
return !!item && typeof item === "object" && "additionalVariables" in item && Array.isArray(item.additionalVariables);
|
|
196
|
+
}
|
|
197
|
+
function convertApiVariables(variables) {
|
|
198
|
+
return variables?.map(convertApiVariable);
|
|
199
|
+
}
|
|
200
|
+
function convertApiVariable(variable) {
|
|
201
|
+
switch (variable.type) {
|
|
202
|
+
case "dictionary":
|
|
203
|
+
return {
|
|
204
|
+
...variable,
|
|
205
|
+
type: variable.type,
|
|
206
|
+
properties: convertApiVariables(variable.properties),
|
|
207
|
+
};
|
|
208
|
+
case "array": {
|
|
209
|
+
return {
|
|
210
|
+
...variable,
|
|
211
|
+
type: variable.type,
|
|
212
|
+
elementType: { type: "number", name: "number" },
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
default:
|
|
216
|
+
return { ...variable, type: variable.type };
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
async function convertToEditorProfileDefinition(predefinedProfile, locale = "en") {
|
|
220
|
+
if (!isPredefinedProfile(predefinedProfile)) {
|
|
221
|
+
return undefined;
|
|
222
|
+
}
|
|
223
|
+
const sdkPredefinedProfile = await getSdkPredefinedProfile(predefinedProfile.id, locale);
|
|
224
|
+
if (!sdkPredefinedProfile) {
|
|
225
|
+
return undefined;
|
|
226
|
+
}
|
|
227
|
+
const editorProfile = {
|
|
228
|
+
bundles: [...sdkPredefinedProfile.bundles],
|
|
229
|
+
variables: [],
|
|
230
|
+
hiddenApiItems: predefinedProfile.hiddenApiItems?.map((s) => s.toLowerCase()),
|
|
231
|
+
};
|
|
232
|
+
// Merge the SDK variables' definitions/properties with the predefined profile definitions.
|
|
233
|
+
sdkPredefinedProfile.variables.forEach((predefinedVariable) => {
|
|
234
|
+
// Don't include disabled variables
|
|
235
|
+
if (predefinedProfile.disabledVariables?.includes(predefinedVariable.name)) {
|
|
236
|
+
return;
|
|
237
|
+
}
|
|
238
|
+
// Try to get a definition from the predefined profile, for the variable that needs one.
|
|
239
|
+
const definition = predefinedProfile.definitions[predefinedVariable.name];
|
|
240
|
+
// Note: Something is weird with TS. The sdkVariables are being casted to the wrong type
|
|
241
|
+
// despite the type checking from the switch statement.
|
|
242
|
+
switch (predefinedVariable.type) {
|
|
243
|
+
case "dictionary": {
|
|
244
|
+
// For dictionary, we support properties overrride
|
|
245
|
+
return editorProfile.variables.push(convertApiVariable({
|
|
246
|
+
...predefinedVariable,
|
|
247
|
+
type: predefinedVariable.type,
|
|
248
|
+
properties: Array.isArray(definition) ? [...definition] : predefinedVariable.properties,
|
|
249
|
+
}));
|
|
250
|
+
}
|
|
251
|
+
case "feature":
|
|
252
|
+
// If the definition is not valid, then we don't include it.
|
|
253
|
+
if (!isFeatureDefinition(definition)) {
|
|
254
|
+
return;
|
|
255
|
+
}
|
|
256
|
+
return editorProfile.variables.push({ ...predefinedVariable, type: predefinedVariable.type, definition });
|
|
257
|
+
case "featureSet":
|
|
258
|
+
// If the definition is not valid, then we don't include it.
|
|
259
|
+
if (!isFeatureSetDefinition(definition)) {
|
|
260
|
+
return;
|
|
261
|
+
}
|
|
262
|
+
return editorProfile.variables.push({ ...predefinedVariable, type: predefinedVariable.type, definition });
|
|
263
|
+
case "featureSetCollection":
|
|
264
|
+
// If the definition is not valid, then we don't include it.
|
|
265
|
+
if (!isFeatureSetCollectionDefinition(definition)) {
|
|
266
|
+
return;
|
|
267
|
+
}
|
|
268
|
+
return editorProfile.variables.push({ ...predefinedVariable, type: predefinedVariable.type, definition });
|
|
269
|
+
default:
|
|
270
|
+
return editorProfile.variables.push(convertApiVariable(predefinedVariable));
|
|
271
|
+
}
|
|
272
|
+
});
|
|
273
|
+
if (isExtendedPredefinedProfileDefinition(predefinedProfile)) {
|
|
274
|
+
editorProfile.variables.push(...(predefinedProfile.additionalVariables ?? []));
|
|
275
|
+
}
|
|
276
|
+
return editorProfile;
|
|
277
|
+
}
|
|
278
|
+
// #endregion
|
|
279
|
+
|
|
46
280
|
const arcadeLanguageId = "arcade";
|
|
47
281
|
class ArcadeLanguageServiceDefaults extends LanguageDefaultsBase {
|
|
48
282
|
constructor() {
|
|
@@ -73,7 +307,7 @@ class ArcadeLanguageServiceDefaults extends LanguageDefaultsBase {
|
|
|
73
307
|
const key = this._getApiKey(modelId);
|
|
74
308
|
const editorProfile = new EditorProfile(definition, profileStrings);
|
|
75
309
|
this._profileMap.set(key, editorProfile);
|
|
76
|
-
const apiProfile = await editorProfile
|
|
310
|
+
const apiProfile = await arcadeEditorToApiProfile(editorProfile);
|
|
77
311
|
this.updateApiContextForModel(modelId, {
|
|
78
312
|
locale: apiContext.locale,
|
|
79
313
|
profile: apiProfile,
|
|
@@ -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.30
|
|
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 };
|