From a9a214192841e85f0b2a0b70021e8bfce8102b3a Mon Sep 17 00:00:00 2001 From: mr25mr <100434800+mr25mr@users.noreply.github.com> Date: Fri, 5 Jan 2024 17:24:25 +0100 Subject: [PATCH] fix: use logger instead of console.log (#683) * fix: use logger instead of console.log * fix: change set * fix: add dependency * fix: cyclic dependencies * fix: change set * fix: sonar * fix: failing tests * fix: add new package to tsconfig.json * fix: remove duplicate --- .changeset/odd-lies-grab.md | 17 + jest.config.js | 2 - jest.setup.js | 3 +- packages/binding/jest.config.js | 1 - packages/binding/jest.setup.js | 5 - packages/binding/package.json | 1 + packages/binding/src/constant.ts | 1 + packages/binding/src/utils/logger.ts | 24 +- .../__snapshots__/definition.test.ts.snap | 120 +-- .../aggregation-binding.test.ts.snap | 176 ++-- .../property-binding-info.test.ts.snap | 30 +- .../hover/__snapshots__/hover.test.ts.snap | 24 +- packages/context/package.json | 1 + packages/context/src/constant.ts | 1 + packages/context/src/ui5-model.ts | 8 +- packages/context/src/utils/fileUtils.ts | 2 +- packages/context/src/utils/logger.ts | 24 +- packages/context/src/utils/project.ts | 2 +- packages/context/src/utils/ui5.ts | 2 +- packages/context/test/unit/manifest.test.ts | 4 +- packages/context/test/unit/ui5-model.test.ts | 22 - .../completion/providers/filter-bar.test.ts | 2 +- packages/language-server/package.json | 1 + packages/language-server/src/constant.ts | 1 + packages/language-server/src/logger.ts | 20 +- packages/logger/CONTRIBUTING.md | 4 + packages/logger/README.md | 32 + packages/logger/api.d.ts | 7 + packages/logger/jest.config.js | 15 + packages/logger/package.json | 34 + .../src/utils/logger.ts => logger/src/api.ts} | 0 .../test/unit/api.test.ts} | 22 +- packages/logger/tsconfig-test.json | 4 + packages/logger/tsconfig.json | 9 + packages/logic-utils/api.d.ts | 5 - packages/logic-utils/package.json | 2 - packages/logic-utils/src/api.ts | 8 - packages/semantic-model/jest.config.js | 1 - packages/semantic-model/jest.setup.js | 5 - packages/semantic-model/package.json | 1 + packages/semantic-model/src/constant.ts | 1 + packages/semantic-model/src/logger.ts | 6 + packages/semantic-model/src/utils.ts | 3 +- .../xml-views-validation/test/unit/helper.ts | 45 + .../unknown-tag-name.test.ts.snap | 306 ++++++ .../element/unknown-tag-name.test.ts | 915 ++++++++---------- sonar-project.properties | 2 + test-packages/framework/jest.config.js | 54 +- test-packages/framework/jest.setup.js | 5 - .../app/manage_travels/webapp/manifest.json | 2 +- .../projects/ts-free-style/src/manifest.json | 2 +- .../src/utils/download-ui5-resources.ts | 4 +- .../src/utils/semantic-model-provider.ts | 2 +- tsconfig.json | 3 + 54 files changed, 1101 insertions(+), 892 deletions(-) create mode 100644 .changeset/odd-lies-grab.md delete mode 100644 packages/binding/jest.setup.js create mode 100644 packages/context/src/constant.ts create mode 100644 packages/language-server/src/constant.ts create mode 100644 packages/logger/CONTRIBUTING.md create mode 100644 packages/logger/README.md create mode 100644 packages/logger/api.d.ts create mode 100644 packages/logger/jest.config.js create mode 100644 packages/logger/package.json rename packages/{logic-utils/src/utils/logger.ts => logger/src/api.ts} (100%) rename packages/{logic-utils/test/unit/logger.test.ts => logger/test/unit/api.test.ts} (69%) create mode 100644 packages/logger/tsconfig-test.json create mode 100644 packages/logger/tsconfig.json delete mode 100644 packages/semantic-model/jest.setup.js create mode 100644 packages/semantic-model/src/constant.ts create mode 100644 packages/semantic-model/src/logger.ts create mode 100644 packages/xml-views-validation/test/unit/helper.ts create mode 100644 packages/xml-views-validation/test/unit/validators/element/__snapshots__/unknown-tag-name.test.ts.snap delete mode 100644 test-packages/framework/jest.setup.js diff --git a/.changeset/odd-lies-grab.md b/.changeset/odd-lies-grab.md new file mode 100644 index 000000000..f29404e29 --- /dev/null +++ b/.changeset/odd-lies-grab.md @@ -0,0 +1,17 @@ +--- +"@ui5-language-assistant/vscode-ui5-language-assistant-bas-ext": patch +"vscode-ui5-language-assistant": patch +"@ui5-language-assistant/language-server": patch +"@ui5-language-assistant/semantic-model": patch +"@ui5-language-assistant/logic-utils": patch +"@ui5-language-assistant/binding": patch +"@ui5-language-assistant/context": patch +"@ui5-language-assistant/xml-views-completion": patch +"@ui5-language-assistant/xml-views-validation": patch +"@ui5-language-assistant/xml-views-tooltip": patch +"@ui5-language-assistant/fe": patch +"@ui5-language-assistant/test-utils": patch +"@ui5-language-assistant/test-framework": patch +--- + +Add logger package diff --git a/jest.config.js b/jest.config.js index a8d7b330a..9dbb57f90 100644 --- a/jest.config.js +++ b/jest.config.js @@ -1,5 +1,3 @@ -const { join } = require("path"); - module.exports = { preset: "ts-jest", testEnvironment: "node", diff --git a/jest.setup.js b/jest.setup.js index bf6ed0d5c..9410c3a68 100644 --- a/jest.setup.js +++ b/jest.setup.js @@ -1,5 +1,4 @@ -jest.setTimeout(120000); // 2 min - +jest.setTimeout(420000); // 7 min // add all jest-extended matchers const matchers = require("jest-extended"); expect.extend(matchers); diff --git a/packages/binding/jest.config.js b/packages/binding/jest.config.js index eed72053f..406cef575 100644 --- a/packages/binding/jest.config.js +++ b/packages/binding/jest.config.js @@ -3,7 +3,6 @@ const defaultConfig = require("../../jest.config"); module.exports = { ...defaultConfig, - setupFilesAfterEnv: ["./jest.setup.js"], globals: { "ts-jest": { tsconfig: join(__dirname, "tsconfig-test.json"), diff --git a/packages/binding/jest.setup.js b/packages/binding/jest.setup.js deleted file mode 100644 index 02cb14f42..000000000 --- a/packages/binding/jest.setup.js +++ /dev/null @@ -1,5 +0,0 @@ -jest.setTimeout(420000); // 7 min - -// add all jest-extended matchers -const matchers = require("jest-extended"); -expect.extend(matchers); diff --git a/packages/binding/package.json b/packages/binding/package.json index bbd6b36ab..b49ad540e 100644 --- a/packages/binding/package.json +++ b/packages/binding/package.json @@ -16,6 +16,7 @@ "license": "Apache-2.0", "dependencies": { "@ui5-language-assistant/binding-parser": "1.0.6", + "@ui5-language-assistant/logger": "0.0.1", "@ui5-language-assistant/context": "4.0.21", "@ui5-language-assistant/logic-utils": "4.0.15", "@ui5-language-assistant/xml-views-completion": "4.0.21", diff --git a/packages/binding/src/constant.ts b/packages/binding/src/constant.ts index 5ec7387d3..a74233314 100644 --- a/packages/binding/src/constant.ts +++ b/packages/binding/src/constant.ts @@ -6,3 +6,4 @@ export const AGGREGATION_BINDING_INFO = export const Binding_Mode = "sap.ui.model.BindingMode"; export const PARTS = "parts"; export const FILTER_OPERATOR = "FilterOperator"; +export const PACKAGE_NAME = "@ui5-language-assistant/binding"; diff --git a/packages/binding/src/utils/logger.ts b/packages/binding/src/utils/logger.ts index d7508e1a9..2d700809d 100644 --- a/packages/binding/src/utils/logger.ts +++ b/packages/binding/src/utils/logger.ts @@ -1,24 +1,6 @@ -import { - getLogger as logger, - ILogger, -} from "@ui5-language-assistant/logic-utils"; - -const getPackageName = (): string => { - let meta: { name: string }; - try { - meta = require("../../package.json"); - } catch (e) { - meta = require("../../../package.json"); - } - - if (!meta) { - return ""; - } - // eslint-disable-next-line @typescript-eslint/no-var-requires -- Using `require` for .json file as this gets bundled with webpack correctly. - return meta.name; -}; +import { getLogger as logger, ILogger } from "@ui5-language-assistant/logger"; +import { PACKAGE_NAME } from "../constant"; export const getLogger = (): ILogger => { - const name = getPackageName(); - return logger(name); + return logger(PACKAGE_NAME); }; diff --git a/packages/binding/test/unit/definition/__snapshots__/definition.test.ts.snap b/packages/binding/test/unit/definition/__snapshots__/definition.test.ts.snap index b0977ad98..e6a5e0480 100644 --- a/packages/binding/test/unit/definition/__snapshots__/definition.test.ts.snap +++ b/packages/binding/test/unit/definition/__snapshots__/definition.test.ts.snap @@ -997,7 +997,7 @@ Array [ **Optional:** false -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.base.ManagedObject.AggregationBindingInfo)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.base.ManagedObject.AggregationBindingInfo)", }, "name": "path", "required": true, @@ -1028,7 +1028,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.base.ManagedObject.AggregationBindingInfo)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.base.ManagedObject.AggregationBindingInfo)", }, "name": "model", "type": Array [ @@ -1058,7 +1058,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.base.ManagedObject.AggregationBindingInfo)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.base.ManagedObject.AggregationBindingInfo)", }, "name": "template", "type": Array [ @@ -1616,6 +1616,7 @@ Array [ "sap.me.ProgressIndicator", "sap.me.TabContainer", "sap.ndc.BarcodeScannerButton", + "sap.ovp.app.Component", "sap.rules.ui.DecisionTableConfiguration", "sap.rules.ui.RuleBuilder", "sap.rules.ui.services.AstExpressionLanguage", @@ -1744,6 +1745,7 @@ Array [ "sap.suite.ui.commons.UnifiedThingInspector", "sap.suite.ui.commons.VerticalNavigationBar", "sap.suite.ui.commons.ViewRepeater", + "sap.suite.ui.generic.template.lib.AppComponent", "sap.suite.ui.microchart.AreaMicroChart", "sap.suite.ui.microchart.AreaMicroChartItem", "sap.suite.ui.microchart.AreaMicroChartLabel", @@ -2712,7 +2714,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.base.ManagedObject.AggregationBindingInfo)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.base.ManagedObject.AggregationBindingInfo)", }, "name": "templateShareable", "type": Array [ @@ -2742,7 +2744,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.base.ManagedObject.AggregationBindingInfo)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.base.ManagedObject.AggregationBindingInfo)", }, "name": "factory", "type": Array [ @@ -2772,7 +2774,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.base.ManagedObject.AggregationBindingInfo)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.base.ManagedObject.AggregationBindingInfo)", }, "name": "suspended", "type": Array [ @@ -2802,7 +2804,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.base.ManagedObject.AggregationBindingInfo)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.base.ManagedObject.AggregationBindingInfo)", }, "name": "startIndex", "type": Array [ @@ -2832,7 +2834,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.base.ManagedObject.AggregationBindingInfo)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.base.ManagedObject.AggregationBindingInfo)", }, "name": "length", "type": Array [ @@ -2862,7 +2864,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.base.ManagedObject.AggregationBindingInfo)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.base.ManagedObject.AggregationBindingInfo)", }, "name": "sorter", "type": Array [ @@ -2885,7 +2887,7 @@ Array [ **Optional:** false -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.model.Sorter)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.model.Sorter)", }, "name": "path", "required": true, @@ -2916,7 +2918,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.model.Sorter)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.model.Sorter)", }, "name": "descending", "required": false, @@ -2947,7 +2949,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.model.Sorter)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.model.Sorter)", }, "name": "group", "required": false, @@ -2989,7 +2991,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.model.Sorter)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.model.Sorter)", }, "name": "comparator", "required": false, @@ -3033,7 +3035,7 @@ Array [ **Optional:** false -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.model.Sorter)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.model.Sorter)", }, "name": "path", "required": true, @@ -3064,7 +3066,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.model.Sorter)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.model.Sorter)", }, "name": "descending", "required": false, @@ -3095,7 +3097,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.model.Sorter)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.model.Sorter)", }, "name": "group", "required": false, @@ -3137,7 +3139,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.model.Sorter)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.model.Sorter)", }, "name": "comparator", "required": false, @@ -3177,7 +3179,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.base.ManagedObject.AggregationBindingInfo)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.base.ManagedObject.AggregationBindingInfo)", }, "name": "filters", "type": Array [ @@ -3200,7 +3202,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.model.Filter)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.model.Filter)", }, "name": "path", "required": false, @@ -3231,7 +3233,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.model.Filter)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.model.Filter)", }, "name": "test", "required": false, @@ -3262,7 +3264,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.model.Filter)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.model.Filter)", }, "name": "comparator", "required": false, @@ -3293,7 +3295,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.model.Filter)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.model.Filter)", }, "name": "operator", "required": false, @@ -3341,7 +3343,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.model.Filter)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.model.Filter)", }, "name": "value1", "required": false, @@ -3368,7 +3370,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.model.Filter)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.model.Filter)", }, "name": "value2", "required": false, @@ -3395,7 +3397,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.model.Filter)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.model.Filter)", }, "name": "variable", "required": false, @@ -3426,7 +3428,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.model.Filter)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.model.Filter)", }, "name": "condition", "required": false, @@ -3458,7 +3460,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.model.Filter)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.model.Filter)", }, "name": "filters", "required": false, @@ -3490,7 +3492,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.model.Filter)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.model.Filter)", }, "name": "and", "required": false, @@ -3521,7 +3523,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.model.Filter)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.model.Filter)", }, "name": "caseSensitive", "required": false, @@ -3565,7 +3567,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.model.Filter)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.model.Filter)", }, "name": "path", "required": false, @@ -3596,7 +3598,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.model.Filter)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.model.Filter)", }, "name": "test", "required": false, @@ -3627,7 +3629,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.model.Filter)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.model.Filter)", }, "name": "comparator", "required": false, @@ -3658,7 +3660,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.model.Filter)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.model.Filter)", }, "name": "operator", "required": false, @@ -3706,7 +3708,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.model.Filter)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.model.Filter)", }, "name": "value1", "required": false, @@ -3733,7 +3735,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.model.Filter)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.model.Filter)", }, "name": "value2", "required": false, @@ -3760,7 +3762,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.model.Filter)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.model.Filter)", }, "name": "variable", "required": false, @@ -3791,7 +3793,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.model.Filter)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.model.Filter)", }, "name": "condition", "required": false, @@ -3823,7 +3825,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.model.Filter)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.model.Filter)", }, "name": "filters", "required": false, @@ -3855,7 +3857,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.model.Filter)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.model.Filter)", }, "name": "and", "required": false, @@ -3886,7 +3888,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.model.Filter)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.model.Filter)", }, "name": "caseSensitive", "required": false, @@ -3926,7 +3928,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.base.ManagedObject.AggregationBindingInfo)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.base.ManagedObject.AggregationBindingInfo)", }, "name": "key", "type": Array [ @@ -3967,7 +3969,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.base.ManagedObject.AggregationBindingInfo)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.base.ManagedObject.AggregationBindingInfo)", }, "name": "parameters", "type": Array [ @@ -3997,7 +3999,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.base.ManagedObject.AggregationBindingInfo)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.base.ManagedObject.AggregationBindingInfo)", }, "name": "groupHeaderFactory", "type": Array [ @@ -4027,7 +4029,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.base.ManagedObject.AggregationBindingInfo)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.base.ManagedObject.AggregationBindingInfo)", }, "name": "events", "type": Array [ @@ -4062,7 +4064,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.base.ManagedObject.PropertyBindingInfo)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.base.ManagedObject.PropertyBindingInfo)", }, "name": "path", "type": Array [ @@ -4095,7 +4097,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.base.ManagedObject.PropertyBindingInfo)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.base.ManagedObject.PropertyBindingInfo)", }, "name": "value", "type": Array [ @@ -4128,7 +4130,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.base.ManagedObject.PropertyBindingInfo)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.base.ManagedObject.PropertyBindingInfo)", }, "name": "model", "type": Array [ @@ -4158,7 +4160,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.base.ManagedObject.PropertyBindingInfo)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.base.ManagedObject.PropertyBindingInfo)", }, "name": "suspended", "type": Array [ @@ -4191,7 +4193,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.base.ManagedObject.PropertyBindingInfo)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.base.ManagedObject.PropertyBindingInfo)", }, "name": "formatter", "type": Array [ @@ -4223,7 +4225,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.base.ManagedObject.PropertyBindingInfo)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.base.ManagedObject.PropertyBindingInfo)", }, "name": "useRawValues", "type": Array [ @@ -4258,7 +4260,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.base.ManagedObject.PropertyBindingInfo)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.base.ManagedObject.PropertyBindingInfo)", }, "name": "useInternalValues", "type": Array [ @@ -4291,7 +4293,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.base.ManagedObject.PropertyBindingInfo)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.base.ManagedObject.PropertyBindingInfo)", }, "name": "type", "type": Array [ @@ -4371,7 +4373,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.base.ManagedObject.PropertyBindingInfo)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.base.ManagedObject.PropertyBindingInfo)", }, "name": "targetType", "type": Array [ @@ -4401,7 +4403,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.base.ManagedObject.PropertyBindingInfo)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.base.ManagedObject.PropertyBindingInfo)", }, "name": "formatOptions", "type": Array [ @@ -4442,7 +4444,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.base.ManagedObject.PropertyBindingInfo)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.base.ManagedObject.PropertyBindingInfo)", }, "name": "constraints", "type": Array [ @@ -4483,7 +4485,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.base.ManagedObject.PropertyBindingInfo)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.base.ManagedObject.PropertyBindingInfo)", }, "name": "mode", "type": Array [ @@ -4518,7 +4520,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.base.ManagedObject.PropertyBindingInfo)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.base.ManagedObject.PropertyBindingInfo)", }, "name": "parameters", "type": Array [ @@ -4548,7 +4550,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.base.ManagedObject.PropertyBindingInfo)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.base.ManagedObject.PropertyBindingInfo)", }, "name": "events", "type": Array [ @@ -4582,7 +4584,7 @@ If a part is not specified as a binding info object but as a simple string, a bi **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.base.ManagedObject.PropertyBindingInfo)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.base.ManagedObject.PropertyBindingInfo)", }, "name": "parts", "type": Array [ diff --git a/packages/binding/test/unit/services/completion/__snapshots__/aggregation-binding.test.ts.snap b/packages/binding/test/unit/services/completion/__snapshots__/aggregation-binding.test.ts.snap index 7f3b83c0c..f1dbd27d4 100644 --- a/packages/binding/test/unit/services/completion/__snapshots__/aggregation-binding.test.ts.snap +++ b/packages/binding/test/unit/services/completion/__snapshots__/aggregation-binding.test.ts.snap @@ -15,7 +15,7 @@ Array [ **Optional:** false -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.base.ManagedObject.AggregationBindingInfo)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.base.ManagedObject.AggregationBindingInfo)", }, "insertText": "path: '$0'", "insertTextFormat": 2, @@ -35,7 +35,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.base.ManagedObject.AggregationBindingInfo)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.base.ManagedObject.AggregationBindingInfo)", }, "insertText": "model: '$0'", "insertTextFormat": 2, @@ -55,7 +55,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.base.ManagedObject.AggregationBindingInfo)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.base.ManagedObject.AggregationBindingInfo)", }, "insertText": "template: '$0'", "insertTextFormat": 2, @@ -75,7 +75,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.base.ManagedObject.AggregationBindingInfo)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.base.ManagedObject.AggregationBindingInfo)", }, "insertText": "templateShareable: $0", "insertTextFormat": 2, @@ -95,7 +95,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.base.ManagedObject.AggregationBindingInfo)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.base.ManagedObject.AggregationBindingInfo)", }, "insertText": "factory: '$0'", "insertTextFormat": 2, @@ -115,7 +115,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.base.ManagedObject.AggregationBindingInfo)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.base.ManagedObject.AggregationBindingInfo)", }, "insertText": "suspended: $0", "insertTextFormat": 2, @@ -135,7 +135,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.base.ManagedObject.AggregationBindingInfo)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.base.ManagedObject.AggregationBindingInfo)", }, "insertText": "startIndex: $0", "insertTextFormat": 2, @@ -155,7 +155,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.base.ManagedObject.AggregationBindingInfo)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.base.ManagedObject.AggregationBindingInfo)", }, "insertText": "length: $0", "insertTextFormat": 2, @@ -175,7 +175,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.base.ManagedObject.AggregationBindingInfo)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.base.ManagedObject.AggregationBindingInfo)", }, "insertText": "sorter: $0", "insertTextFormat": 2, @@ -195,7 +195,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.base.ManagedObject.AggregationBindingInfo)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.base.ManagedObject.AggregationBindingInfo)", }, "insertText": "filters: $0", "insertTextFormat": 2, @@ -215,7 +215,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.base.ManagedObject.AggregationBindingInfo)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.base.ManagedObject.AggregationBindingInfo)", }, "insertText": "key: $0", "insertTextFormat": 2, @@ -235,7 +235,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.base.ManagedObject.AggregationBindingInfo)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.base.ManagedObject.AggregationBindingInfo)", }, "insertText": "parameters: {$0}", "insertTextFormat": 2, @@ -255,7 +255,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.base.ManagedObject.AggregationBindingInfo)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.base.ManagedObject.AggregationBindingInfo)", }, "insertText": "groupHeaderFactory: '$0'", "insertTextFormat": 2, @@ -275,7 +275,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.base.ManagedObject.AggregationBindingInfo)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.base.ManagedObject.AggregationBindingInfo)", }, "insertText": "events: {$0}", "insertTextFormat": 2, @@ -300,7 +300,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.model.Filter)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.model.Filter)", }, "insertText": "path: '$0'", "insertTextFormat": 2, @@ -320,7 +320,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.model.Filter)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.model.Filter)", }, "insertText": "test: '$0'", "insertTextFormat": 2, @@ -340,7 +340,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.model.Filter)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.model.Filter)", }, "insertText": "comparator: '$0'", "insertTextFormat": 2, @@ -360,7 +360,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.model.Filter)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.model.Filter)", }, "insertText": "operator: '$0'", "insertTextFormat": 2, @@ -380,7 +380,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.model.Filter)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.model.Filter)", }, "insertText": "value1: $0", "insertTextFormat": 2, @@ -400,7 +400,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.model.Filter)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.model.Filter)", }, "insertText": "value2: $0", "insertTextFormat": 2, @@ -420,7 +420,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.model.Filter)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.model.Filter)", }, "insertText": "variable: '$0'", "insertTextFormat": 2, @@ -440,7 +440,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.model.Filter)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.model.Filter)", }, "insertText": "condition: {$0}", "insertTextFormat": 2, @@ -460,7 +460,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.model.Filter)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.model.Filter)", }, "insertText": "filters: [{$0}]", "insertTextFormat": 2, @@ -480,7 +480,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.model.Filter)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.model.Filter)", }, "insertText": "and: $0", "insertTextFormat": 2, @@ -500,7 +500,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.model.Filter)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.model.Filter)", }, "insertText": "caseSensitive: $0", "insertTextFormat": 2, @@ -525,7 +525,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.model.Filter)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.model.Filter)", }, "insertText": "path: '$0'", "insertTextFormat": 2, @@ -545,7 +545,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.model.Filter)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.model.Filter)", }, "insertText": "test: '$0'", "insertTextFormat": 2, @@ -565,7 +565,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.model.Filter)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.model.Filter)", }, "insertText": "comparator: '$0'", "insertTextFormat": 2, @@ -585,7 +585,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.model.Filter)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.model.Filter)", }, "insertText": "operator: '$0'", "insertTextFormat": 2, @@ -605,7 +605,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.model.Filter)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.model.Filter)", }, "insertText": "value1: $0", "insertTextFormat": 2, @@ -625,7 +625,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.model.Filter)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.model.Filter)", }, "insertText": "value2: $0", "insertTextFormat": 2, @@ -645,7 +645,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.model.Filter)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.model.Filter)", }, "insertText": "variable: '$0'", "insertTextFormat": 2, @@ -665,7 +665,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.model.Filter)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.model.Filter)", }, "insertText": "condition: {$0}", "insertTextFormat": 2, @@ -685,7 +685,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.model.Filter)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.model.Filter)", }, "insertText": "filters: [{$0}]", "insertTextFormat": 2, @@ -705,7 +705,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.model.Filter)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.model.Filter)", }, "insertText": "and: $0", "insertTextFormat": 2, @@ -725,7 +725,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.model.Filter)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.model.Filter)", }, "insertText": "caseSensitive: $0", "insertTextFormat": 2, @@ -750,7 +750,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.model.Filter)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.model.Filter)", }, "insertText": "path: '$0'", "insertTextFormat": 2, @@ -770,7 +770,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.model.Filter)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.model.Filter)", }, "insertText": "test: '$0'", "insertTextFormat": 2, @@ -790,7 +790,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.model.Filter)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.model.Filter)", }, "insertText": "comparator: '$0'", "insertTextFormat": 2, @@ -810,7 +810,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.model.Filter)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.model.Filter)", }, "insertText": "operator: '$0'", "insertTextFormat": 2, @@ -830,7 +830,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.model.Filter)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.model.Filter)", }, "insertText": "value1: $0", "insertTextFormat": 2, @@ -850,7 +850,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.model.Filter)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.model.Filter)", }, "insertText": "value2: $0", "insertTextFormat": 2, @@ -870,7 +870,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.model.Filter)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.model.Filter)", }, "insertText": "variable: '$0'", "insertTextFormat": 2, @@ -890,7 +890,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.model.Filter)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.model.Filter)", }, "insertText": "condition: {$0}", "insertTextFormat": 2, @@ -910,7 +910,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.model.Filter)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.model.Filter)", }, "insertText": "filters: [{$0}]", "insertTextFormat": 2, @@ -930,7 +930,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.model.Filter)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.model.Filter)", }, "insertText": "and: $0", "insertTextFormat": 2, @@ -950,7 +950,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.model.Filter)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.model.Filter)", }, "insertText": "caseSensitive: $0", "insertTextFormat": 2, @@ -975,7 +975,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.model.Filter)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.model.Filter)", }, "insertText": "path: '$0'", "insertTextFormat": 2, @@ -995,7 +995,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.model.Filter)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.model.Filter)", }, "insertText": "test: '$0'", "insertTextFormat": 2, @@ -1015,7 +1015,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.model.Filter)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.model.Filter)", }, "insertText": "comparator: '$0'", "insertTextFormat": 2, @@ -1035,7 +1035,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.model.Filter)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.model.Filter)", }, "insertText": "operator: '$0'", "insertTextFormat": 2, @@ -1055,7 +1055,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.model.Filter)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.model.Filter)", }, "insertText": "value1: $0", "insertTextFormat": 2, @@ -1075,7 +1075,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.model.Filter)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.model.Filter)", }, "insertText": "value2: $0", "insertTextFormat": 2, @@ -1095,7 +1095,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.model.Filter)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.model.Filter)", }, "insertText": "variable: '$0'", "insertTextFormat": 2, @@ -1115,7 +1115,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.model.Filter)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.model.Filter)", }, "insertText": "condition: {$0}", "insertTextFormat": 2, @@ -1135,7 +1135,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.model.Filter)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.model.Filter)", }, "insertText": "filters: [{$0}]", "insertTextFormat": 2, @@ -1155,7 +1155,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.model.Filter)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.model.Filter)", }, "insertText": "and: $0", "insertTextFormat": 2, @@ -1175,7 +1175,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.model.Filter)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.model.Filter)", }, "insertText": "caseSensitive: $0", "insertTextFormat": 2, @@ -1509,7 +1509,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.model.Filter)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.model.Filter)", }, "insertText": "path: '$0'", "insertTextFormat": 2, @@ -1529,7 +1529,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.model.Filter)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.model.Filter)", }, "insertText": "test: '$0'", "insertTextFormat": 2, @@ -1549,7 +1549,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.model.Filter)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.model.Filter)", }, "insertText": "comparator: '$0'", "insertTextFormat": 2, @@ -1569,7 +1569,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.model.Filter)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.model.Filter)", }, "insertText": "operator: '$0'", "insertTextFormat": 2, @@ -1589,7 +1589,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.model.Filter)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.model.Filter)", }, "insertText": "value1: $0", "insertTextFormat": 2, @@ -1609,7 +1609,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.model.Filter)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.model.Filter)", }, "insertText": "value2: $0", "insertTextFormat": 2, @@ -1629,7 +1629,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.model.Filter)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.model.Filter)", }, "insertText": "variable: '$0'", "insertTextFormat": 2, @@ -1649,7 +1649,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.model.Filter)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.model.Filter)", }, "insertText": "condition: {$0}", "insertTextFormat": 2, @@ -1669,7 +1669,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.model.Filter)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.model.Filter)", }, "insertText": "filters: [{$0}]", "insertTextFormat": 2, @@ -1689,7 +1689,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.model.Filter)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.model.Filter)", }, "insertText": "and: $0", "insertTextFormat": 2, @@ -1709,7 +1709,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.model.Filter)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.model.Filter)", }, "insertText": "caseSensitive: $0", "insertTextFormat": 2, @@ -1734,7 +1734,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.model.Filter)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.model.Filter)", }, "insertText": "path: '$0'", "insertTextFormat": 2, @@ -1754,7 +1754,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.model.Filter)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.model.Filter)", }, "insertText": "test: '$0'", "insertTextFormat": 2, @@ -1774,7 +1774,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.model.Filter)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.model.Filter)", }, "insertText": "comparator: '$0'", "insertTextFormat": 2, @@ -1794,7 +1794,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.model.Filter)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.model.Filter)", }, "insertText": "operator: '$0'", "insertTextFormat": 2, @@ -1814,7 +1814,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.model.Filter)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.model.Filter)", }, "insertText": "value1: $0", "insertTextFormat": 2, @@ -1834,7 +1834,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.model.Filter)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.model.Filter)", }, "insertText": "value2: $0", "insertTextFormat": 2, @@ -1854,7 +1854,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.model.Filter)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.model.Filter)", }, "insertText": "variable: '$0'", "insertTextFormat": 2, @@ -1874,7 +1874,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.model.Filter)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.model.Filter)", }, "insertText": "condition: {$0}", "insertTextFormat": 2, @@ -1894,7 +1894,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.model.Filter)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.model.Filter)", }, "insertText": "filters: [{$0}]", "insertTextFormat": 2, @@ -1914,7 +1914,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.model.Filter)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.model.Filter)", }, "insertText": "and: $0", "insertTextFormat": 2, @@ -1934,7 +1934,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.model.Filter)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.model.Filter)", }, "insertText": "caseSensitive: $0", "insertTextFormat": 2, @@ -1959,7 +1959,7 @@ Array [ **Optional:** false -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.model.Sorter)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.model.Sorter)", }, "insertText": "path: '$0'", "insertTextFormat": 2, @@ -1979,7 +1979,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.model.Sorter)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.model.Sorter)", }, "insertText": "descending: $0", "insertTextFormat": 2, @@ -1999,7 +1999,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.model.Sorter)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.model.Sorter)", }, "insertText": "group: $0", "insertTextFormat": 2, @@ -2019,7 +2019,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.model.Sorter)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.model.Sorter)", }, "insertText": "comparator: '$0'", "insertTextFormat": 2, @@ -2044,7 +2044,7 @@ Array [ **Optional:** false -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.model.Sorter)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.model.Sorter)", }, "insertText": "path: '$0'", "insertTextFormat": 2, @@ -2064,7 +2064,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.model.Sorter)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.model.Sorter)", }, "insertText": "descending: $0", "insertTextFormat": 2, @@ -2084,7 +2084,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.model.Sorter)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.model.Sorter)", }, "insertText": "group: $0", "insertTextFormat": 2, @@ -2104,7 +2104,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.model.Sorter)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.model.Sorter)", }, "insertText": "comparator: '$0'", "insertTextFormat": 2, diff --git a/packages/binding/test/unit/services/completion/__snapshots__/property-binding-info.test.ts.snap b/packages/binding/test/unit/services/completion/__snapshots__/property-binding-info.test.ts.snap index 1780db09f..16e757ad3 100644 --- a/packages/binding/test/unit/services/completion/__snapshots__/property-binding-info.test.ts.snap +++ b/packages/binding/test/unit/services/completion/__snapshots__/property-binding-info.test.ts.snap @@ -36,7 +36,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.base.ManagedObject.PropertyBindingInfo)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.base.ManagedObject.PropertyBindingInfo)", "label: value; text: value: '$0'; kind:15; commit:undefined; sort:; documentation: kind:markdown,value:\`(typedef) sap.ui.base.ManagedObject.PropertyBindingInfo\` @@ -47,7 +47,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.base.ManagedObject.PropertyBindingInfo)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.base.ManagedObject.PropertyBindingInfo)", "label: model; text: model: '$0'; kind:15; commit:undefined; sort:; documentation: kind:markdown,value:\`(typedef) sap.ui.base.ManagedObject.PropertyBindingInfo\` @@ -58,7 +58,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.base.ManagedObject.PropertyBindingInfo)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.base.ManagedObject.PropertyBindingInfo)", "label: suspended; text: suspended: $0; kind:15; commit:undefined; sort:; documentation: kind:markdown,value:\`(typedef) sap.ui.base.ManagedObject.PropertyBindingInfo\` @@ -69,7 +69,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.base.ManagedObject.PropertyBindingInfo)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.base.ManagedObject.PropertyBindingInfo)", "label: formatter; text: formatter: '$0'; kind:15; commit:undefined; sort:; documentation: kind:markdown,value:\`(typedef) sap.ui.base.ManagedObject.PropertyBindingInfo\` @@ -80,7 +80,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.base.ManagedObject.PropertyBindingInfo)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.base.ManagedObject.PropertyBindingInfo)", "label: useRawValues; text: useRawValues: $0; kind:15; commit:undefined; sort:; documentation: kind:markdown,value:\`(typedef) sap.ui.base.ManagedObject.PropertyBindingInfo\` @@ -93,7 +93,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.base.ManagedObject.PropertyBindingInfo)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.base.ManagedObject.PropertyBindingInfo)", "label: useInternalValues; text: useInternalValues: $0; kind:15; commit:undefined; sort:; documentation: kind:markdown,value:\`(typedef) sap.ui.base.ManagedObject.PropertyBindingInfo\` @@ -106,7 +106,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.base.ManagedObject.PropertyBindingInfo)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.base.ManagedObject.PropertyBindingInfo)", "label: type; text: type: '$0'; kind:15; commit:undefined; sort:; documentation: kind:markdown,value:\`(typedef) sap.ui.base.ManagedObject.PropertyBindingInfo\` @@ -117,7 +117,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.base.ManagedObject.PropertyBindingInfo)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.base.ManagedObject.PropertyBindingInfo)", "label: targetType; text: targetType: '$0'; kind:15; commit:undefined; sort:; documentation: kind:markdown,value:\`(typedef) sap.ui.base.ManagedObject.PropertyBindingInfo\` @@ -128,7 +128,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.base.ManagedObject.PropertyBindingInfo)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.base.ManagedObject.PropertyBindingInfo)", "label: formatOptions; text: formatOptions: {$0}; kind:15; commit:undefined; sort:; documentation: kind:markdown,value:\`(typedef) sap.ui.base.ManagedObject.PropertyBindingInfo\` @@ -139,7 +139,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.base.ManagedObject.PropertyBindingInfo)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.base.ManagedObject.PropertyBindingInfo)", "label: constraints; text: constraints: {$0}; kind:15; commit:undefined; sort:; documentation: kind:markdown,value:\`(typedef) sap.ui.base.ManagedObject.PropertyBindingInfo\` @@ -150,7 +150,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.base.ManagedObject.PropertyBindingInfo)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.base.ManagedObject.PropertyBindingInfo)", "label: mode; text: mode: '$0'; kind:15; commit:undefined; sort:; documentation: kind:markdown,value:\`(typedef) sap.ui.base.ManagedObject.PropertyBindingInfo\` @@ -161,7 +161,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.base.ManagedObject.PropertyBindingInfo)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.base.ManagedObject.PropertyBindingInfo)", "label: parameters; text: parameters: {$0}; kind:15; commit:undefined; sort:; documentation: kind:markdown,value:\`(typedef) sap.ui.base.ManagedObject.PropertyBindingInfo\` @@ -172,7 +172,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.base.ManagedObject.PropertyBindingInfo)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.base.ManagedObject.PropertyBindingInfo)", "label: events; text: events: {$0}; kind:15; commit:undefined; sort:; documentation: kind:markdown,value:\`(typedef) sap.ui.base.ManagedObject.PropertyBindingInfo\` @@ -183,7 +183,7 @@ Array [ **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.base.ManagedObject.PropertyBindingInfo)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.base.ManagedObject.PropertyBindingInfo)", "label: parts; text: parts: $0; kind:15; commit:undefined; sort:; documentation: kind:markdown,value:\`(typedef) sap.ui.base.ManagedObject.PropertyBindingInfo\` @@ -198,7 +198,7 @@ If a part is not specified as a binding info object but as a simple string, a bi **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.base.ManagedObject.PropertyBindingInfo)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.base.ManagedObject.PropertyBindingInfo)", ] `; diff --git a/packages/binding/test/unit/services/hover/__snapshots__/hover.test.ts.snap b/packages/binding/test/unit/services/hover/__snapshots__/hover.test.ts.snap index 00818e99f..db5a246f3 100644 --- a/packages/binding/test/unit/services/hover/__snapshots__/hover.test.ts.snap +++ b/packages/binding/test/unit/services/hover/__snapshots__/hover.test.ts.snap @@ -14,7 +14,7 @@ Object { **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.model.Filter)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.model.Filter)", }, } `; @@ -33,7 +33,7 @@ Object { **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.model.Filter)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.model.Filter)", }, } `; @@ -52,7 +52,7 @@ Object { **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.model.Filter)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.model.Filter)", }, } `; @@ -71,7 +71,7 @@ Object { **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.model.Filter)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.model.Filter)", }, } `; @@ -90,7 +90,7 @@ Object { **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.model.Filter)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.model.Filter)", }, } `; @@ -109,7 +109,7 @@ Object { **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.model.Filter)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.model.Filter)", }, } `; @@ -132,7 +132,7 @@ If a part is not specified as a binding info object but as a simple string, a bi **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.base.ManagedObject.PropertyBindingInfo)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.base.ManagedObject.PropertyBindingInfo)", }, } `; @@ -151,7 +151,7 @@ Object { **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.base.ManagedObject.PropertyBindingInfo)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.base.ManagedObject.PropertyBindingInfo)", }, } `; @@ -170,7 +170,7 @@ Object { **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.base.ManagedObject.PropertyBindingInfo)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.base.ManagedObject.PropertyBindingInfo)", }, } `; @@ -189,7 +189,7 @@ Object { **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.base.ManagedObject.PropertyBindingInfo)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.base.ManagedObject.PropertyBindingInfo)", }, } `; @@ -208,7 +208,7 @@ Object { **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.base.ManagedObject.PropertyBindingInfo)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.base.ManagedObject.PropertyBindingInfo)", }, } `; @@ -227,7 +227,7 @@ Object { **Optional:** true -[More information](https://ui5.sap.com/1.108.1/#/api/sap.ui.base.ManagedObject.PropertyBindingInfo)", +[More information](https://ui5.sap.com/1.108.26/#/api/sap.ui.base.ManagedObject.PropertyBindingInfo)", }, } `; diff --git a/packages/context/package.json b/packages/context/package.json index 88e4cca71..d7071f7eb 100644 --- a/packages/context/package.json +++ b/packages/context/package.json @@ -19,6 +19,7 @@ "@sap-ux/annotation-converter": "0.5.20", "@sap-ux/edmx-parser": "0.5.13", "@sap-ux/project-access": "1.9.1", + "@ui5-language-assistant/logger": "0.0.1", "@ui5-language-assistant/logic-utils": "4.0.15", "@ui5-language-assistant/settings": "4.0.9", "fs-extra": "10.1.0", diff --git a/packages/context/src/constant.ts b/packages/context/src/constant.ts new file mode 100644 index 000000000..a1895deab --- /dev/null +++ b/packages/context/src/constant.ts @@ -0,0 +1 @@ +export const PACKAGE_NAME = "@ui5-language-assistant/context"; diff --git a/packages/context/src/ui5-model.ts b/packages/context/src/ui5-model.ts index be4d3391a..08da4dcec 100644 --- a/packages/context/src/ui5-model.ts +++ b/packages/context/src/ui5-model.ts @@ -134,10 +134,10 @@ async function createSemanticModelWithFetcher( apiJson = await response.json(); await writeToCache(cacheFilePath, apiJson); } else if (response.status === 404) { - getLogger().error("Could not find UI5 lib from", { url }); + getLogger().warn("Could not find UI5 lib from", { url }); await writeToCache(cacheFilePath, {}); // write dummy file! TODO: how to invalidate? } else { - getLogger().error("Could not read UI5 lib from", { url }); + getLogger().warn("Could not read UI5 lib from", { url }); } } else { getLogger().info("Reading Cache For UI5 Lib", { @@ -271,7 +271,7 @@ async function getVersionInfo( throw new Error(`Version info request has failed (${url})`); } } catch (e) { - getLogger().error("Could not read version information. " + e, { + getLogger().warn("Could not read version information. " + e, { url, }); } @@ -420,7 +420,7 @@ export async function negotiateVersionWithFetcher( >; } else { isFallback = true; - getLogger().error( + getLogger().warn( "Could not read version mapping, fallback to default version", { url, diff --git a/packages/context/src/utils/fileUtils.ts b/packages/context/src/utils/fileUtils.ts index a6823cec6..368358b71 100644 --- a/packages/context/src/utils/fileUtils.ts +++ b/packages/context/src/utils/fileUtils.ts @@ -39,7 +39,7 @@ export async function findAllFilesInWorkspace( // Windows paths are not supported by globby const pattern = toPosixPath(join(workspaceFolderPath, "**", fileName)); const result = globby(pattern).catch((reason) => { - getLogger().error( + getLogger().warn( `Failed to find all ${fileName} files in current workspace!`, { workspaceFolderPath, diff --git a/packages/context/src/utils/logger.ts b/packages/context/src/utils/logger.ts index d7508e1a9..2d700809d 100644 --- a/packages/context/src/utils/logger.ts +++ b/packages/context/src/utils/logger.ts @@ -1,24 +1,6 @@ -import { - getLogger as logger, - ILogger, -} from "@ui5-language-assistant/logic-utils"; - -const getPackageName = (): string => { - let meta: { name: string }; - try { - meta = require("../../package.json"); - } catch (e) { - meta = require("../../../package.json"); - } - - if (!meta) { - return ""; - } - // eslint-disable-next-line @typescript-eslint/no-var-requires -- Using `require` for .json file as this gets bundled with webpack correctly. - return meta.name; -}; +import { getLogger as logger, ILogger } from "@ui5-language-assistant/logger"; +import { PACKAGE_NAME } from "../constant"; export const getLogger = (): ILogger => { - const name = getPackageName(); - return logger(name); + return logger(PACKAGE_NAME); }; diff --git a/packages/context/src/utils/project.ts b/packages/context/src/utils/project.ts index d0c4e7c1a..749e10090 100644 --- a/packages/context/src/utils/project.ts +++ b/packages/context/src/utils/project.ts @@ -17,7 +17,7 @@ import { ProjectType, UI5_PROJECT_TYPE, } from "../types"; -import { getLogger } from "./logger"; +import { getLogger } from "."; /** * Unify service path by adding forward slash to beginning and end of a service path diff --git a/packages/context/src/utils/ui5.ts b/packages/context/src/utils/ui5.ts index d2e67fa78..c877db944 100644 --- a/packages/context/src/utils/ui5.ts +++ b/packages/context/src/utils/ui5.ts @@ -1,6 +1,6 @@ import { UI5Framework } from "@ui5-language-assistant/semantic-model-types"; import { UI5_FRAMEWORK_CDN_BASE_URL } from "../types"; -import { getLogger } from "../utils"; +import { getLogger } from "."; import { tryFetch, getLocalUrl } from "@ui5-language-assistant/logic-utils"; /** diff --git a/packages/context/test/unit/manifest.test.ts b/packages/context/test/unit/manifest.test.ts index d352b19ad..b7f6247ae 100644 --- a/packages/context/test/unit/manifest.test.ts +++ b/packages/context/test/unit/manifest.test.ts @@ -96,7 +96,7 @@ describe("manifest", () => { }, mainServicePath: "/processor/", flexEnabled: true, - minUI5Version: "1.108.1", + minUI5Version: "1.108.26", }); }); @@ -255,7 +255,7 @@ describe("manifest", () => { }, mainServicePath: "/processor/", flexEnabled: true, - minUI5Version: "1.108.1", + minUI5Version: "1.108.26", }); } finally { mock.restore(); diff --git a/packages/context/test/unit/ui5-model.test.ts b/packages/context/test/unit/ui5-model.test.ts index e4b843279..5276b5d07 100644 --- a/packages/context/test/unit/ui5-model.test.ts +++ b/packages/context/test/unit/ui5-model.test.ts @@ -1,25 +1,3 @@ -jest.mock("@ui5-language-assistant/logic-utils", () => { - const actual = jest.requireActual("@ui5-language-assistant/logic-utils"); - - return { - ...actual, - getLogger: (name: string) => { - const logger = actual.getLogger(name); - return { - ...logger, - fatal: (m, ...args: unknown[]) => - console.log(`Fatal: ${m}, ${JSON.stringify(args)}`), - error: (m, ...args: unknown[]) => - console.log(`Error: ${m}, ${JSON.stringify(args)}`), - warn: (m, ...args: unknown[]) => - console.log(`Warning: ${m}, ${JSON.stringify(args)}`), - info: (m, ...args: unknown[]) => - console.log(`Info: ${m}, ${JSON.stringify(args)}}`), - }; - }, - }; -}); - import { dir as tempDir, file as tempFile } from "tmp-promise"; import { readdir, mkdirs, writeFile } from "fs-extra"; import { sync as rimrafSync } from "rimraf"; diff --git a/packages/fe/test/unit/services/completion/providers/filter-bar.test.ts b/packages/fe/test/unit/services/completion/providers/filter-bar.test.ts index c00af84f7..6db56b194 100644 --- a/packages/fe/test/unit/services/completion/providers/filter-bar.test.ts +++ b/packages/fe/test/unit/services/completion/providers/filter-bar.test.ts @@ -87,7 +87,7 @@ describe("filterBar id attribute value completion", () => { uri, settings ); - }, 5 * 60000); + }); describe("filterBar attribute completion", () => { it("id value completion", async function () { diff --git a/packages/language-server/package.json b/packages/language-server/package.json index 00dd4b04e..76ef265bd 100644 --- a/packages/language-server/package.json +++ b/packages/language-server/package.json @@ -27,6 +27,7 @@ "dependencies": { "@ui5-language-assistant/binding": "1.0.21", "@sap/swa-for-sapbas-vsx": "1.1.9", + "@ui5-language-assistant/logger": "0.0.1", "@ui5-language-assistant/context": "4.0.21", "@ui5-language-assistant/logic-utils": "4.0.15", "@ui5-language-assistant/fe": "4.0.22", diff --git a/packages/language-server/src/constant.ts b/packages/language-server/src/constant.ts new file mode 100644 index 000000000..6a4c18a89 --- /dev/null +++ b/packages/language-server/src/constant.ts @@ -0,0 +1 @@ +export const PACKAGE_NAME = "@ui5-language-assistant/language-server"; diff --git a/packages/language-server/src/logger.ts b/packages/language-server/src/logger.ts index 567b60e4e..e2ac3e9de 100644 --- a/packages/language-server/src/logger.ts +++ b/packages/language-server/src/logger.ts @@ -3,24 +3,12 @@ import { setLogLevel as setLogLevelSetter, LogLevel, ILogger, -} from "@ui5-language-assistant/logic-utils"; -import { join } from "path"; -import { readJsonSync } from "fs-extra"; -const getPackageName = (): string => { - let meta; - try { - // in production - ../extensions/saposs.vscode-ui5-language-assistant-4.0.6/node_modules/@ui5-language-assistant/language-server/dist - meta = readJsonSync(join(__dirname, "..", "package.json")); - } catch (error) { - meta = readJsonSync(join(__dirname, "..", "..", "package.json")); - } - return meta?.name; -}; +} from "@ui5-language-assistant/logger"; +import { PACKAGE_NAME } from "./constant"; -const name = getPackageName(); export const getLogger = (): ILogger => { - return logger(name); + return logger(PACKAGE_NAME); }; export const setLogLevel = (logLevel: LogLevel): void => - setLogLevelSetter(name, logLevel); + setLogLevelSetter(PACKAGE_NAME, logLevel); diff --git a/packages/logger/CONTRIBUTING.md b/packages/logger/CONTRIBUTING.md new file mode 100644 index 000000000..84eb94476 --- /dev/null +++ b/packages/logger/CONTRIBUTING.md @@ -0,0 +1,4 @@ +# Contribution Guide + +This package does not have any unique development flows. +Please see the top level [Contribution Guide](../../CONTRIBUTING.md). diff --git a/packages/logger/README.md b/packages/logger/README.md new file mode 100644 index 000000000..35bd221b8 --- /dev/null +++ b/packages/logger/README.md @@ -0,0 +1,32 @@ +[![npm (scoped)](https://img.shields.io/npm/v/@ui5-language-assistant/logger.svg)](https://www.npmjs.com/package/@ui5-language-assistant/logger) + +# @ui5-language-assistant/logger + +A logger package + +## Installation + +With npm: + +- `npm install @ui5-language-assistant/logger` + +With Yarn: + +- `yarn add @ui5-language-assistant/logger` + +## Usage + +This package only exposes programmatic APIs, import the package and use the exported APIs +defined in [api.d.ts](./api.d.ts). + +## Support + +Please open [issues](https://github.com/SAP/ui5-language-assistant/issues) on github. + +## Contributing + +See [CONTRIBUTING.md](./CONTRIBUTING.md). + +## Licensing + +Copyright 2022 SAP SE. Please see our [LICENSE](../../LICENSE) for copyright and license information. Detailed information including third-party components and their licensing/copyright information is available [via the REUSE tool](https://api.reuse.software/info/github.com/SAP/ui5-language-assistant). diff --git a/packages/logger/api.d.ts b/packages/logger/api.d.ts new file mode 100644 index 000000000..ac55f3d54 --- /dev/null +++ b/packages/logger/api.d.ts @@ -0,0 +1,7 @@ +export { + ILogger, + getLogLevel, + getLogger, + setLogLevel, + LogLevel, +} from "./src/api"; diff --git a/packages/logger/jest.config.js b/packages/logger/jest.config.js new file mode 100644 index 000000000..406cef575 --- /dev/null +++ b/packages/logger/jest.config.js @@ -0,0 +1,15 @@ +const { join } = require("path"); +const defaultConfig = require("../../jest.config"); + +module.exports = { + ...defaultConfig, + globals: { + "ts-jest": { + tsconfig: join(__dirname, "tsconfig-test.json"), + diagnostics: { + // warnOnly: true, + exclude: /\.(spec|test)\.ts$/, + }, + }, + }, +}; diff --git a/packages/logger/package.json b/packages/logger/package.json new file mode 100644 index 000000000..ceff0a197 --- /dev/null +++ b/packages/logger/package.json @@ -0,0 +1,34 @@ +{ + "name": "@ui5-language-assistant/logger", + "version": "0.0.1", + "private": true, + "description": "A logger package", + "keywords": [], + "files": [ + ".reuse", + "LICENSES", + "lib/src", + "api.d.ts", + "src" + ], + "main": "lib/src/api.js", + "repository": "https://github.com/sap/ui5-language-assistant/", + "license": "Apache-2.0", + "typings": "./api.d.ts", + "dependencies": { + "@vscode-logging/logger": "1.2.2", + "@ui5-language-assistant/settings": "4.0.9" + }, + "devDependencies": { + "@vscode-logging/types": "0.1.4" + }, + "scripts": { + "ci": "npm-run-all clean compile lint coverage", + "clean": "rimraf ./lib ./coverage ./nyc_output", + "compile": "yarn run clean && tsc -p .", + "compile:watch": "tsc -p . --watch", + "lint": "eslint . --ext .ts --max-warnings=0 --ignore-path=../../.gitignore", + "test": "jest --ci --forceExit --detectOpenHandles --maxWorkers=1 --coverage=false", + "coverage": "jest --ci --forceExit --detectOpenHandles --maxWorkers=1 --coverage=true" + } +} diff --git a/packages/logic-utils/src/utils/logger.ts b/packages/logger/src/api.ts similarity index 100% rename from packages/logic-utils/src/utils/logger.ts rename to packages/logger/src/api.ts diff --git a/packages/logic-utils/test/unit/logger.test.ts b/packages/logger/test/unit/api.test.ts similarity index 69% rename from packages/logic-utils/test/unit/logger.test.ts rename to packages/logger/test/unit/api.test.ts index 4176a4ffd..b0db6c4ad 100644 --- a/packages/logic-utils/test/unit/logger.test.ts +++ b/packages/logger/test/unit/api.test.ts @@ -2,12 +2,12 @@ import { getLogger, getLogLevel, setLogLevel } from "../../src/api"; import { LogLevel } from "@vscode-logging/logger"; import { validLoggingLevelValues } from "@ui5-language-assistant/settings"; -describe("the Language Server Logger", () => { +describe("Logger", () => { let errorSpy; - const extName = "dummyExt"; - + const name = "dummyName"; beforeAll(() => { - errorSpy = jest.spyOn(console, "error"); + // mockReturnValue to avoid log miss in console + errorSpy = jest.spyOn(console, "error").mockReturnValue(); }); afterEach(() => { @@ -15,7 +15,7 @@ describe("the Language Server Logger", () => { }); it("supports structured JSON logging", async () => { - getLogger(extName).error("hello world", { a: 1, b: [1, 2, 3] }); + getLogger(name).error("hello world", { a: 1, b: [1, 2, 3] }); const logEntry = errorSpy.mock.calls[0]; const jsonLogEntry = JSON.parse(logEntry); expect(jsonLogEntry).toHaveProperty("a", 1); @@ -30,25 +30,27 @@ describe("the Language Server Logger", () => { }); it("supports changing the log level", async () => { - setLogLevel(extName, "fatal"); - getLogger(extName).error( + // mockReturnValue to avoid log miss in console + jest.spyOn(console, "error").mockReturnValue(); + setLogLevel(name, "fatal"); + getLogger(name).error( "`error` is lower than `fatal` so no logging should happen" ); expect(errorSpy).not.toHaveBeenCalled(); - getLogger(extName).fatal("`fatal` should cause logging to the console"); + getLogger(name).fatal("`fatal` should cause logging to the console"); expect(errorSpy).toHaveBeenCalled(); }); it("does not allow changing to an **unknown** logLevel", async () => { // "Verbose" is not a valid log level for the language server - setLogLevel(extName, "Verbose" as "trace"); + setLogLevel(name, "Verbose" as "trace"); const currentLogLevel = getLogLevel(); expect(currentLogLevel).not.toEqual("Verbose"); expect(validLoggingLevelValues[currentLogLevel]).toBeTrue(); }); afterEach(() => { - setLogLevel(extName, orgLevel); + setLogLevel(name, orgLevel); }); }); }); diff --git a/packages/logger/tsconfig-test.json b/packages/logger/tsconfig-test.json new file mode 100644 index 000000000..fb1f25450 --- /dev/null +++ b/packages/logger/tsconfig-test.json @@ -0,0 +1,4 @@ +{ + "extends": "./tsconfig.json", + "include": ["src/**/*.ts", "test/**/*.ts"] +} diff --git a/packages/logger/tsconfig.json b/packages/logger/tsconfig.json new file mode 100644 index 000000000..7ecd7b544 --- /dev/null +++ b/packages/logger/tsconfig.json @@ -0,0 +1,9 @@ +{ + "extends": "../../tsconfig.base.json", + "compilerOptions": { + "rootDir": ".", + "outDir": "lib", + "baseUrl": "." + }, + "include": ["src/**/*", "test/**/*", "api.d.ts"] +} diff --git a/packages/logic-utils/api.d.ts b/packages/logic-utils/api.d.ts index ea338ad31..a1a375623 100644 --- a/packages/logic-utils/api.d.ts +++ b/packages/logic-utils/api.d.ts @@ -274,11 +274,6 @@ export function isSameXMLNSFromPrefix( ): boolean; export { - ILogger, - getLogLevel, - getLogger, - setLogLevel, - LogLevel, fetch, tryFetch, getLocalUrl, diff --git a/packages/logic-utils/package.json b/packages/logic-utils/package.json index cc202c456..c35595362 100644 --- a/packages/logic-utils/package.json +++ b/packages/logic-utils/package.json @@ -18,7 +18,6 @@ "dependencies": { "@ui5-language-assistant/semantic-model-types": "4.0.9", "@ui5-language-assistant/settings": "4.0.9", - "@vscode-logging/logger": "1.2.2", "@xml-tools/ast": "5.0.0", "lodash": "4.17.21", "node-fetch": "2.6.9", @@ -28,7 +27,6 @@ "devDependencies": { "@ui5-language-assistant/semantic-model": "4.0.14", "@ui5-language-assistant/test-utils": "4.0.10", - "@vscode-logging/types": "0.1.4", "@xml-tools/parser": "1.0.7" }, "scripts": { diff --git a/packages/logic-utils/src/api.ts b/packages/logic-utils/src/api.ts index daf3080be..15f17dc0b 100644 --- a/packages/logic-utils/src/api.ts +++ b/packages/logic-utils/src/api.ts @@ -38,14 +38,6 @@ export { isSameXMLNSFromPrefix, } from "./utils/xml-namespaces"; -export { - ILogger, - getLogLevel, - getLogger, - setLogLevel, - LogLevel, -} from "./utils/logger"; - export { fetch } from "./utils/fetch"; export { tryFetch, getLocalUrl } from "./utils/fetch-helper"; export { isXMLView } from "./utils/document"; diff --git a/packages/semantic-model/jest.config.js b/packages/semantic-model/jest.config.js index eed72053f..406cef575 100644 --- a/packages/semantic-model/jest.config.js +++ b/packages/semantic-model/jest.config.js @@ -3,7 +3,6 @@ const defaultConfig = require("../../jest.config"); module.exports = { ...defaultConfig, - setupFilesAfterEnv: ["./jest.setup.js"], globals: { "ts-jest": { tsconfig: join(__dirname, "tsconfig-test.json"), diff --git a/packages/semantic-model/jest.setup.js b/packages/semantic-model/jest.setup.js deleted file mode 100644 index 522286048..000000000 --- a/packages/semantic-model/jest.setup.js +++ /dev/null @@ -1,5 +0,0 @@ -jest.setTimeout(300000); // 5 min - -// add all jest-extended matchers -const matchers = require("jest-extended"); -expect.extend(matchers); diff --git a/packages/semantic-model/package.json b/packages/semantic-model/package.json index 74a475745..3d2df45c1 100644 --- a/packages/semantic-model/package.json +++ b/packages/semantic-model/package.json @@ -18,6 +18,7 @@ "typings": "./api.d.ts", "dependencies": { "@ui5-language-assistant/semantic-model-types": "4.0.9", + "@ui5-language-assistant/logger": "0.0.1", "ajv": "6.12.3", "deep-freeze-strict": "1.1.1", "fs-extra": "10.1.0", diff --git a/packages/semantic-model/src/constant.ts b/packages/semantic-model/src/constant.ts new file mode 100644 index 000000000..85c982f4a --- /dev/null +++ b/packages/semantic-model/src/constant.ts @@ -0,0 +1 @@ +export const PACKAGE_NAME = "@ui5-language-assistant/semantic-model"; diff --git a/packages/semantic-model/src/logger.ts b/packages/semantic-model/src/logger.ts new file mode 100644 index 000000000..a856e3c17 --- /dev/null +++ b/packages/semantic-model/src/logger.ts @@ -0,0 +1,6 @@ +import { getLogger as logger, ILogger } from "@ui5-language-assistant/logger"; +import { PACKAGE_NAME } from "./constant"; + +export const getLogger = (): ILogger => { + return logger(PACKAGE_NAME); +}; diff --git a/packages/semantic-model/src/utils.ts b/packages/semantic-model/src/utils.ts index f0043306a..f9ffde49a 100644 --- a/packages/semantic-model/src/utils.ts +++ b/packages/semantic-model/src/utils.ts @@ -3,6 +3,7 @@ import { BaseUI5Node, UI5SemanticModel, } from "@ui5-language-assistant/semantic-model-types"; +import { getLogger } from "./logger"; export function newMap(): Record { // Create an object without a prototype so it doesn't have built-in methods like toString @@ -20,7 +21,7 @@ export function error(message: string, throwError: boolean): void { if (throwError) { throw new Error(message); } else { - console.error(message); + getLogger().trace(message); } } diff --git a/packages/xml-views-validation/test/unit/helper.ts b/packages/xml-views-validation/test/unit/helper.ts new file mode 100644 index 000000000..48f4d03bc --- /dev/null +++ b/packages/xml-views-validation/test/unit/helper.ts @@ -0,0 +1,45 @@ +import { join } from "path"; +import type { UI5ValidatorsConfig, UI5XMLViewIssue } from "../../api"; +import { TestFramework } from "@ui5-language-assistant/test-framework"; +import { getContext } from "@ui5-language-assistant/context"; +import type { Context } from "@ui5-language-assistant/context"; +import { validateXMLView } from "@ui5-language-assistant/xml-views-validation"; + +export const getContent = (snippet: string): string => { + return ` + + ${snippet} + + + + `; +}; + +export const issueToSnapshot = (item: UI5XMLViewIssue): string => + `kind: ${item.kind}; text: ${item.message}; severity:${item.severity}; offsetRange:${item.offsetRange.start}-${item.offsetRange.end}`; + +export type GetViewValidator = (snippet: string) => Promise; +export const getViewValidator = + ( + framework: TestFramework, + viewFilePathSegments: string[], + validators: UI5ValidatorsConfig + ): GetViewValidator => + async (snippet: string): Promise => { + await framework.updateFile(viewFilePathSegments, snippet); + const root = framework.getProjectRoot(); + const documentPath = join(root, ...viewFilePathSegments); + const { ast } = await framework.readFile(viewFilePathSegments); + const context = (await getContext(documentPath)) as Context; + return validateXMLView({ + validators, + context: context, + xmlView: ast, + }); + }; diff --git a/packages/xml-views-validation/test/unit/validators/element/__snapshots__/unknown-tag-name.test.ts.snap b/packages/xml-views-validation/test/unit/validators/element/__snapshots__/unknown-tag-name.test.ts.snap new file mode 100644 index 000000000..3f34474fb --- /dev/null +++ b/packages/xml-views-validation/test/unit/validators/element/__snapshots__/unknown-tag-name.test.ts.snap @@ -0,0 +1,306 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`the unknown tag name validation negative edge cases tag with namespace ui5 namespace will detect an issue for sap.ui.core.ExtensionPoint in the root tag 1`] = ` +Array [ + Object { + "issueType": "base", + "kind": "UnknownTagName", + "message": "The \\"ExtensionPoint\\" class doesn't exist. Enter a namespace.", + "offsetRange": Object { + "end": 16, + "start": 3, + }, + "severity": "error", + }, +] +`; + +exports[`the unknown tag name validation true positive scenarios tag with namespace will detect an invalid aggregation name under known class tag without default aggregation 1`] = ` +Array [ + Object { + "issueType": "base", + "kind": "UnknownTagName", + "message": "The \\"content_TYPO\\" name is neither a class name in the \\"sap.m\\" namespace nor an aggregation of the \\"sap.m.SplitApp\\" class.", + "offsetRange": Object { + "end": 176, + "start": 163, + }, + "severity": "error", + }, +] +`; + +exports[`the unknown tag name validation true positive scenarios tag with namespace will detect an invalid aggregation when it's in the wrong namespace 1`] = ` +Array [ + Object { + "issueType": "base", + "kind": "UnknownTagName", + "message": "The \\"content\\" class doesn't exist in the \\"sap.m\\" namespace.", + "offsetRange": Object { + "end": 138, + "start": 130, + }, + "severity": "error", + }, +] +`; + +exports[`the unknown tag name validation true positive scenarios tag with namespace will detect an invalid class name in root tag 1`] = ` +Array [ + Object { + "issueType": "base", + "kind": "UnknownTagName", + "message": "The \\"View_TYPO\\" class doesn't exist in the \\"sap.ui.core.mvc\\" namespace.", + "offsetRange": Object { + "end": 22, + "start": 10, + }, + "severity": "error", + }, +] +`; + +exports[`the unknown tag name validation true positive scenarios tag with namespace will detect an invalid class name under aggregation 1`] = ` +Array [ + Object { + "issueType": "base", + "kind": "UnknownTagName", + "message": "The \\"Button_TYPO\\" class doesn't exist in the \\"sap.m\\" namespace.", + "offsetRange": Object { + "end": 176, + "start": 164, + }, + "severity": "error", + }, +] +`; + +exports[`the unknown tag name validation true positive scenarios tag with namespace will detect an invalid class name under aggregation in the same namespace 1`] = ` +Array [ + Object { + "issueType": "base", + "kind": "UnknownTagName", + "message": "The \\"Button_TYPO\\" class doesn't exist in the \\"sap.ui.core.mvc\\" namespace.", + "offsetRange": Object { + "end": 111, + "start": 97, + }, + "severity": "error", + }, +] +`; + +exports[`the unknown tag name validation true positive scenarios tag with namespace will detect an invalid class name under class that doesn't have a default aggregation 1`] = ` +Array [ + Object { + "issueType": "base", + "kind": "UnknownTagName", + "message": "The \\"Button_TYPO\\" name is neither a class name in the \\"sap.m\\" namespace nor an aggregation of the \\"sap.m.SplitApp\\" class.", + "offsetRange": Object { + "end": 163, + "start": 151, + }, + "severity": "error", + }, +] +`; + +exports[`the unknown tag name validation true positive scenarios tag with namespace will detect an invalid class name under class that has default aggregation 1`] = ` +Array [ + Object { + "issueType": "base", + "kind": "UnknownTagName", + "message": "The \\"Button_TYPO\\" class doesn't exist in the \\"sap.m\\" namespace.", + "offsetRange": Object { + "end": 132, + "start": 120, + }, + "severity": "error", + }, +] +`; + +exports[`the unknown tag name validation true positive scenarios tag with namespace will detect an issue for unknown name under unknown class in a known namespace 1`] = ` +Array [ + Object { + "issueType": "base", + "kind": "UnknownTagName", + "message": "The \\"SplitApp_TYPO\\" class doesn't exist in the \\"sap.m\\" namespace.", + "offsetRange": Object { + "end": 134, + "start": 120, + }, + "severity": "error", + }, + Object { + "issueType": "base", + "kind": "UnknownTagName", + "message": "The \\"Button_TYPO\\" name is neither a class name in the \\"sap.m\\" namespace nor an aggregation of its parent tag.", + "offsetRange": Object { + "end": 168, + "start": 156, + }, + "severity": "error", + }, +] +`; + +exports[`the unknown tag name validation true positive scenarios tag without namespace when default namespace is a ui5 namespace will detect an issue for unknown name under unknown class in the default namespace 1`] = ` +Array [ + Object { + "issueType": "base", + "kind": "UnknownTagName", + "message": "The \\"SplitApp_TYPO\\" name is neither a class name in the \\"sap.m\\" namespace nor an aggregation of the \\"sap.ui.core.mvc.View\\" class.", + "offsetRange": Object { + "end": 140, + "start": 128, + }, + "severity": "error", + }, + Object { + "issueType": "base", + "kind": "UnknownTagName", + "message": "The \\"Button_TYPO\\" name is neither a class name in the \\"sap.m\\" namespace nor an aggregation of its parent tag.", + "offsetRange": Object { + "end": 174, + "start": 164, + }, + "severity": "error", + }, +] +`; + +exports[`the unknown tag name validation true positive scenarios tag without namespace when default namespace is not defined will detect an invalid aggregation namespace under known class tag without default aggregation 1`] = ` +Array [ + Object { + "issueType": "base", + "kind": "UnknownTagName", + "message": "The \\"content\\" aggregation must have the same namespace as the \\"sap.m.SplitApp\\" class.", + "offsetRange": Object { + "end": 169, + "start": 163, + }, + "severity": "error", + }, +] +`; + +exports[`the unknown tag name validation true positive scenarios tag without namespace when default namespace is not defined will detect an invalid class name in root tag 1`] = ` +Array [ + Object { + "issueType": "base", + "kind": "UnknownTagName", + "message": "The \\"View\\" class doesn't exist. Enter a namespace.", + "offsetRange": Object { + "end": 17, + "start": 14, + }, + "severity": "error", + }, +] +`; + +exports[`the unknown tag name validation true positive scenarios tag without namespace when default namespace is not defined will detect an invalid class name under known aggregation tag 1`] = ` +Array [ + Object { + "issueType": "base", + "kind": "UnknownTagName", + "message": "The \\"List\\" class doesn't exist. Enter a namespace.", + "offsetRange": Object { + "end": 106, + "start": 103, + }, + "severity": "error", + }, +] +`; + +exports[`the unknown tag name validation true positive scenarios tag without namespace when default namespace is not defined will detect an invalid class or aggregation name under known class tag with default aggregation 1`] = ` +Array [ + Object { + "issueType": "base", + "kind": "UnknownTagName", + "message": "The \\"List\\" name is neither a class name nor an aggregation of the \\"sap.ui.core.mvc.View\\" class.", + "offsetRange": Object { + "end": 72, + "start": 69, + }, + "severity": "error", + }, +] +`; + +exports[`the unknown tag name validation true positive scenarios tag without namespace when default namespace is not defined will detect an issue for unknown name under unknown class in non-default non-ui5 namespace when name starts with uppercase 1`] = ` +Array [ + Object { + "issueType": "base", + "kind": "UnknownTagName", + "message": "The \\"Button_TYPO\\" name is neither a class name nor an aggregation of its parent tag. Enter a namespace.", + "offsetRange": Object { + "end": 184, + "start": 174, + }, + "severity": "error", + }, +] +`; + +exports[`the unknown tag name validation true positive scenarios when default namespace is a ui5 namespace will detect an invalid aggregation name under known class tag without default aggregation 1`] = ` +Array [ + Object { + "issueType": "base", + "kind": "UnknownTagName", + "message": "The \\"content_TYPO\\" aggregation doesn't exist in the \\"sap.m.SplitApp\\" class.", + "offsetRange": Object { + "end": 160, + "start": 149, + }, + "severity": "error", + }, +] +`; + +exports[`the unknown tag name validation true positive scenarios when default namespace is a ui5 namespace will detect an invalid class name in root tag 1`] = ` +Array [ + Object { + "issueType": "base", + "kind": "UnknownTagName", + "message": "The \\"View_TYPO\\" class doesn't exist in the \\"sap.ui.core.mvc\\" namespace.", + "offsetRange": Object { + "end": 9, + "start": 1, + }, + "severity": "error", + }, +] +`; + +exports[`the unknown tag name validation true positive scenarios when default namespace is a ui5 namespace will detect an invalid class name under known aggregation tag 1`] = ` +Array [ + Object { + "issueType": "base", + "kind": "UnknownTagName", + "message": "The \\"List_TYPO\\" class doesn't exist in the \\"sap.ui.core.mvc\\" namespace.", + "offsetRange": Object { + "end": 111, + "start": 103, + }, + "severity": "error", + }, +] +`; + +exports[`the unknown tag name validation true positive scenarios when default namespace is a ui5 namespace will detect an invalid class or aggregation name under known class tag with default aggregation 1`] = ` +Array [ + Object { + "issueType": "base", + "kind": "UnknownTagName", + "message": "The \\"List_TYPO\\" name is neither a class name in the \\"sap.ui.core.mvc\\" namespace nor an aggregation of the \\"sap.ui.core.mvc.View\\" class.", + "offsetRange": Object { + "end": 69, + "start": 61, + }, + "severity": "error", + }, +] +`; diff --git a/packages/xml-views-validation/test/unit/validators/element/unknown-tag-name.test.ts b/packages/xml-views-validation/test/unit/validators/element/unknown-tag-name.test.ts index d1bded07d..271297b1a 100644 --- a/packages/xml-views-validation/test/unit/validators/element/unknown-tag-name.test.ts +++ b/packages/xml-views-validation/test/unit/validators/element/unknown-tag-name.test.ts @@ -1,41 +1,15 @@ -import { join } from "path"; -import { partial } from "lodash"; -import { - validations, - buildMessage, -} from "@ui5-language-assistant/user-facing-text"; import { validators } from "../../../../src/api"; -import { - assertNoIssues as assertNoIssuesBase, - assertSingleIssue as assertSingleIssueBase, - testValidationsScenario, - computeExpectedRanges, -} from "../../test-utils"; -import { - Context as AppContext, - getContext, -} from "@ui5-language-assistant/context"; import { Config, ProjectName, ProjectType, TestFramework, } from "@ui5-language-assistant/test-framework"; - -const { - UNKNOWN_CLASS_IN_NS, - UNKNOWN_CLASS_WITHOUT_NS, - UNKNOWN_AGGREGATION_IN_CLASS, - UNKNOWN_AGGREGATION_IN_CLASS_DIFF_NAMESPACE, - UNKNOWN_TAG_NAME_IN_CLASS, - UNKNOWN_TAG_NAME_IN_NS_UNDER_CLASS, - UNKNOWN_TAG_NAME_IN_NS, - UNKNOWN_TAG_NAME_NO_NS, -} = validations; +import { GetViewValidator, getViewValidator } from "../../helper"; describe("the unknown tag name validation", () => { - let appContext: AppContext; let framework: TestFramework; + let validateView: GetViewValidator; const viewFilePathSegments = [ "app", "manage_travels", @@ -54,470 +28,363 @@ describe("the unknown tag name validation", () => { }, }; framework = new TestFramework(config); - appContext = (await getContext( - join(framework.getProjectRoot(), ...viewFilePathSegments) - )) as AppContext; + validateView = getViewValidator(framework, viewFilePathSegments, { + attribute: [], + document: [], + element: [validators.validateUnknownTagName], + }); }); describe("true positive scenarios", () => { - let assertSingleIssue: (xmlSnippet: string, message: string) => void; - beforeAll(() => { - assertSingleIssue = partial( - assertSingleIssueBase, - appContext, - { - element: [validators.validateUnknownTagName], - }, - "UnknownTagName", - "error" - ); - }); - describe("tag with namespace", () => { - it("will detect an invalid class name in root tag", () => { - assertSingleIssue( - `<🢂mvc:View_TYPO🢀 - xmlns:mvc="sap.ui.core.mvc" - xmlns="sap.m"> - `, - buildMessage(UNKNOWN_CLASS_IN_NS.msg, "View_TYPO", "sap.ui.core.mvc") - ); + it("will detect an invalid class name in root tag", async () => { + const snippet = ` + + + `; + const result = await validateView(snippet); + expect(result).toMatchSnapshot(); }); - it("will detect an invalid class name under class that has default aggregation", () => { - assertSingleIssue( - ` - <🢂m:Button_TYPO🢀> - - `, - buildMessage(UNKNOWN_CLASS_IN_NS.msg, "Button_TYPO", "sap.m") - ); + it("will detect an invalid class name under class that has default aggregation", async () => { + const snippet = ` + + + + `; + const result = await validateView(snippet); + expect(result).toMatchSnapshot(); }); - it("will detect an invalid class name under class that doesn't have a default aggregation", () => { - assertSingleIssue( - ` - - <🢂m:Button_TYPO🢀> - - - `, - buildMessage( - UNKNOWN_TAG_NAME_IN_NS_UNDER_CLASS.msg, - "Button_TYPO", - "sap.m", - "sap.m.SplitApp" - ) - ); + it("will detect an invalid class name under class that doesn't have a default aggregation", async () => { + const snippet = ` + + + + + + `; + const result = await validateView(snippet); + expect(result).toMatchSnapshot(); }); - it("will detect an invalid class name under aggregation", () => { - assertSingleIssue( - ` - - <🢂m:Button_TYPO🢀> - - - `, - buildMessage(UNKNOWN_CLASS_IN_NS.msg, "Button_TYPO", "sap.m") - ); + it("will detect an invalid class name under aggregation", async () => { + const snippet = ` + + + + + + `; + const result = await validateView(snippet); + expect(result).toMatchSnapshot(); }); - it("will detect an invalid aggregation when it's in the wrong namespace", () => { - assertSingleIssue( - ` - <🢂m:content🢀> - - `, - buildMessage(UNKNOWN_CLASS_IN_NS.msg, "content", "sap.m") - ); + it("will detect an invalid aggregation when it's in the wrong namespace", async () => { + const snippet = ` + + + + `; + const result = await validateView(snippet); + expect(result).toMatchSnapshot(); }); - it("will detect an invalid class name under aggregation in the same namespace", () => { - assertSingleIssue( - ` - - <🢂mvc:Button_TYPO🢀> - - - `, - buildMessage( - UNKNOWN_CLASS_IN_NS.msg, - "Button_TYPO", - "sap.ui.core.mvc" - ) - ); + it("will detect an invalid class name under aggregation in the same namespace", async () => { + const snippet = ` + + + + + + `; + const result = await validateView(snippet); + expect(result).toMatchSnapshot(); }); - it("will detect an invalid aggregation name under known class tag without default aggregation", () => { - assertSingleIssue( - ` - - <🢂m:content_TYPO🢀> - - - `, - buildMessage( - UNKNOWN_TAG_NAME_IN_NS_UNDER_CLASS.msg, - "content_TYPO", - "sap.m", - "sap.m.SplitApp" - ) - ); + it("will detect an invalid aggregation name under known class tag without default aggregation", async () => { + const snippet = ` + + + + + + `; + const result = await validateView(snippet); + expect(result).toMatchSnapshot(); }); - it("will detect an issue for unknown name under unknown class in a known namespace", () => { - const xmlSnippet = ` + it("will detect an issue for unknown name under unknown class in a known namespace", async () => { + const snippet = ` - <🢂m:SplitApp_TYPO🢀> - <🢂m:Button_TYPO🢀> - - - `; - const expectedRanges = computeExpectedRanges(xmlSnippet); - - testValidationsScenario({ - context: appContext, - xmlText: xmlSnippet, - validators: { element: [validators.validateUnknownTagName] }, - assertion: (issues) => { - expect(issues).toIncludeSameMembers([ - { - issueType: "base", - kind: "UnknownTagName", - message: buildMessage( - UNKNOWN_CLASS_IN_NS.msg, - "SplitApp_TYPO", - "sap.m" - ), - offsetRange: expectedRanges[0], - severity: "error", - }, - { - issueType: "base", - kind: "UnknownTagName", - message: buildMessage( - UNKNOWN_TAG_NAME_IN_NS.msg, - "Button_TYPO", - "sap.m" - ), - offsetRange: expectedRanges[1], - severity: "error", - }, - ]); - }, - }); + xmlns:mvc="sap.ui.core.mvc" + xmlns:m="sap.m" + > + + + + + `; + const result = await validateView(snippet); + expect(result).toMatchSnapshot(); }); }); describe("tag without namespace", () => { describe("when default namespace is not defined", () => { - it("will detect an invalid class name in root tag", () => { - assertSingleIssue( - `<🢂View🢀> - `, - buildMessage(UNKNOWN_CLASS_WITHOUT_NS.msg, "View") - ); - }); - - it("will detect an invalid class name under known aggregation tag", () => { - assertSingleIssue( - ` - - <🢂List🢀> - - `, - buildMessage(UNKNOWN_CLASS_WITHOUT_NS.msg, "List") - ); - }); - - it("will detect an invalid class or aggregation name under known class tag with default aggregation", () => { - assertSingleIssue( - ` - <🢂List🢀> - `, - buildMessage( - UNKNOWN_TAG_NAME_IN_CLASS.msg, - "List", - "sap.ui.core.mvc.View" - ) - ); - }); - - it("will detect an invalid aggregation namespace under known class tag without default aggregation", () => { - assertSingleIssue( - ` - - <🢂content🢀> - - - `, - buildMessage( - UNKNOWN_AGGREGATION_IN_CLASS_DIFF_NAMESPACE.msg, - "content", - "sap.m.SplitApp" - ) - ); - }); - - it("will detect an issue for unknown name under unknown class in non-default non-ui5 namespace when name starts with uppercase", () => { - assertSingleIssue( - ` - - <🢂Button_TYPO🢀> - - - `, - buildMessage(UNKNOWN_TAG_NAME_NO_NS.msg, "Button_TYPO") - ); + it("will detect an invalid class name in root tag", async () => { + const snippet = ` + + + `; + const result = await validateView(snippet); + expect(result).toMatchSnapshot(); + }); + + it("will detect an invalid class name under known aggregation tag", async () => { + const snippet = ` + + + + + + `; + const result = await validateView(snippet); + expect(result).toMatchSnapshot(); + }); + + it("will detect an invalid class or aggregation name under known class tag with default aggregation", async () => { + const snippet = ` + + + + `; + const result = await validateView(snippet); + expect(result).toMatchSnapshot(); + }); + + it("will detect an invalid aggregation namespace under known class tag without default aggregation", async () => { + const snippet = ` + + + + + + `; + const result = await validateView(snippet); + expect(result).toMatchSnapshot(); + }); + + it("will detect an issue for unknown name under unknown class in non-default non-ui5 namespace when name starts with uppercase", async () => { + const snippet = ` + + + + + `; + const result = await validateView(snippet); + expect(result).toMatchSnapshot(); }); }); describe("when default namespace is a ui5 namespace", () => { - it("will detect an issue for unknown name under unknown class in the default namespace", () => { - const xmlSnippet = ` + it("will detect an issue for unknown name under unknown class in the default namespace", async () => { + const snippet = ` - <🢂SplitApp_TYPO🢀> - <🢂Button_TYPO🢀> - - - `; - const expectedRanges = computeExpectedRanges(xmlSnippet); - - testValidationsScenario({ - context: appContext, - xmlText: xmlSnippet, - validators: { element: [validators.validateUnknownTagName] }, - assertion: (issues) => { - expect(issues).toIncludeSameMembers([ - { - issueType: "base", - kind: "UnknownTagName", - message: buildMessage( - UNKNOWN_TAG_NAME_IN_NS_UNDER_CLASS.msg, - "SplitApp_TYPO", - "sap.m", - "sap.ui.core.mvc.View" - ), - offsetRange: expectedRanges[0], - severity: "error", - }, - { - issueType: "base", - kind: "UnknownTagName", - message: buildMessage( - UNKNOWN_TAG_NAME_IN_NS.msg, - "Button_TYPO", - "sap.m" - ), - offsetRange: expectedRanges[1], - severity: "error", - }, - ]); - }, - }); + xmlns:mvc="sap.ui.core.mvc" + xmlns="sap.m" + > + + + + + `; + const result = await validateView(snippet); + expect(result).toMatchSnapshot(); }); }); }); describe("when default namespace is a ui5 namespace", () => { - it("will detect an invalid class name in root tag", () => { - assertSingleIssue( - `<🢂View_TYPO🢀 - xmlns="sap.ui.core.mvc"> - `, - buildMessage(UNKNOWN_CLASS_IN_NS.msg, "View_TYPO", "sap.ui.core.mvc") - ); + it("will detect an invalid class name in root tag", async () => { + const snippet = ``; + const result = await validateView(snippet); + expect(result).toMatchSnapshot(); }); - it("will detect an invalid class name under known aggregation tag", () => { - assertSingleIssue( - ` - - <🢂List_TYPO🢀> - - `, - buildMessage(UNKNOWN_CLASS_IN_NS.msg, "List_TYPO", "sap.ui.core.mvc") - ); + it("will detect an invalid class name under known aggregation tag", async () => { + const snippet = ` + + + + + + `; + const result = await validateView(snippet); + expect(result).toMatchSnapshot(); }); - it("will detect an invalid class or aggregation name under known class tag with default aggregation", () => { - assertSingleIssue( - ` - <🢂List_TYPO🢀> - `, - buildMessage( - UNKNOWN_TAG_NAME_IN_NS_UNDER_CLASS.msg, - "List_TYPO", - "sap.ui.core.mvc", - "sap.ui.core.mvc.View" - ) - ); + it("will detect an invalid class or aggregation name under known class tag with default aggregation", async () => { + const snippet = ` + + + + `; + const result = await validateView(snippet); + expect(result).toMatchSnapshot(); }); - it("will detect an invalid aggregation name under known class tag without default aggregation", () => { - assertSingleIssue( - ` - - <🢂content_TYPO🢀> - - - `, - buildMessage( - UNKNOWN_AGGREGATION_IN_CLASS.msg, - "content_TYPO", - "sap.m.SplitApp" - ) - ); + it("will detect an invalid aggregation name under known class tag without default aggregation", async () => { + const snippet = ` + + + + + `; + const result = await validateView(snippet); + expect(result).toMatchSnapshot(); }); }); }); describe("negative edge cases", () => { - let assertNoIssues: (xmlSnippet: string) => void; - beforeAll(() => { - assertNoIssues = partial(assertNoIssuesBase, appContext, { - element: [validators.validateUnknownTagName], - }); - }); - describe("tag with namespace", () => { describe("non-ui5 namespace", () => { - it("will not detect an issue when namespace is unknown", () => { - assertNoIssues( - ` - ` - ); - }); - - it("will not detect an issue when namespace is xhtml", () => { - assertNoIssues( - ` { + const snippet = ` + `; + const result = await validateView(snippet); + expect(result).toStrictEqual([]); + }); + + it("will not detect an issue when namespace is xhtml", async () => { + const snippet = ` + - ` - ); + + `; + const result = await validateView(snippet); + expect(result).toStrictEqual([]); }); - it("will not detect an issue when namespace is not defined in xmlns attribute", () => { - assertNoIssues( - ` - ` - ); + it("will not detect an issue when namespace is not defined in xmlns attribute", async () => { + const snippet = ` + + + `; + const result = await validateView(snippet); + expect(result).toStrictEqual([]); }); }); describe("ui5 namespace", () => { - let assertSingleIssue: (xmlSnippet: string, message: string) => void; - beforeAll(() => { - assertSingleIssue = partial( - assertSingleIssueBase, - appContext, - { - element: [validators.validateUnknownTagName], - }, - "UnknownTagName", - "error" - ); - }); - it("will not detect an issue for known class in the root tag", () => { - assertNoIssues( - ` { + const snippet = ` + - ` - ); + + `; + const result = await validateView(snippet); + expect(result).toStrictEqual([]); }); - it("will not detect an issue for sap.ui.core.FragmentDefinition in the root tag", () => { - assertNoIssues( - ` -