Skip to content

Commit

Permalink
Merge branch 'master' into fix/absolute-path-meta-path
Browse files Browse the repository at this point in the history
  • Loading branch information
marufrasully authored Apr 26, 2024
2 parents ec4fd95 + 1dfdebf commit e35ed5f
Show file tree
Hide file tree
Showing 18 changed files with 293 additions and 84 deletions.
6 changes: 6 additions & 0 deletions packages/binding/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @ui5-language-assistant/binding

## 1.0.29

### Patch Changes

- 98c33e7: fix: relax diagnostic for property which can be used with both aggregation binding info or property binding info

## 1.0.28

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/binding/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ui5-language-assistant/binding",
"version": "1.0.28",
"version": "1.0.29",
"private": true,
"description": "UI5 LSP server extension for binding",
"keywords": [],
Expand Down
5 changes: 1 addition & 4 deletions packages/binding/src/definition/definition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
} from "../types";
import { ui5NodeToFQN } from "@ui5-language-assistant/logic-utils";
import { forOwn } from "lodash";
import { getDocumentation } from "../utils";
import { getAltTypesPrime, getDocumentation } from "../utils";
import { getFallBackElements } from "./fall-back-definition";
import { getSorterPossibleElement } from "./sorter";
import { getFiltersPossibleElement } from "./filter";
Expand Down Expand Up @@ -383,9 +383,6 @@ const buildType = (param: {
return propertyType;
};

const getAltTypesPrime = (aggregation?: UI5Aggregation) =>
aggregation?.altTypes?.find((i) => i.kind === "PrimitiveType");

const removeDuplicate = (builtType: PropertyType[]): PropertyType[] => {
const result = builtType.reduce(
(previous: PropertyType[], current: PropertyType) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,24 +1,32 @@
import { findRange } from "../../../utils";
import { findRange, getAltTypesPrime } from "../../../utils";
import {
BindingIssue,
BINDING_ISSUE_TYPE,
BindingInfoElement,
} from "../../../types";
import { BindingParserTypes as BindingTypes } from "@ui5-language-assistant/binding-parser";
import { t } from "../../../i18n";
import { UI5Aggregation } from "@ui5-language-assistant/semantic-model-types";

export const checkRequiredElement = (
element: BindingTypes.StructureValue,
bindingElements: BindingInfoElement[]
bindingElements: BindingInfoElement[],
aggregation: UI5Aggregation | undefined
): BindingIssue[] => {
// check required element
const reqEl = bindingElements.find((i) => i.required);
if (reqEl) {
// check required element is applied
const usedRequiredEl = element.elements.find(
let usedRequiredEl = element.elements.find(
/* istanbul ignore next */
(i) => i.key?.text === reqEl.name
);
const altTypes = getAltTypesPrime(aggregation);
if (!usedRequiredEl && altTypes) {
// some property e.g `tooltip` can be used with both `aggregation binding info` or `property binding info`. Therefore `altTypes` is defined in design time.
// if `altTypes` is present, check if any element is used. This is a very broad check to avoid false diagnostic.
usedRequiredEl = element.elements[0];
}
if (!usedRequiredEl) {
return [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,6 @@ export const checkBinding = (
issues.push(...checkDependents(bindingElements, binding));
issues.push(...checkNestedParts(binding));
issues.push(...checkBrackets(binding));
issues.push(...checkRequiredElement(binding, bindingElements));
issues.push(...checkRequiredElement(binding, bindingElements, aggregation));
return issues;
};
10 changes: 10 additions & 0 deletions packages/binding/src/utils/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
import type {
UI5Aggregation,
UI5Type,
} from "@ui5-language-assistant/semantic-model-types";

export {
typesToValue,
valueTypeMap,
Expand All @@ -14,3 +19,8 @@ export { getCursorContext } from "./cursor";
export { getLogger } from "./logger";

export { getDocumentation } from "./documentation";

export const getAltTypesPrime = (
aggregation?: UI5Aggregation
): UI5Type | undefined =>
aggregation?.altTypes?.find((i) => i.kind === "PrimitiveType");
Original file line number Diff line number Diff line change
Expand Up @@ -234,4 +234,10 @@ describe("aggregation binding", () => {
const result = await validateView(snippet);
expect(result.map((item) => issueToSnapshot(item))).toStrictEqual([]);
});
it("tooltip [altTypes] - no diagnostics if any element used", async () => {
const snippet = `
<Text text="My Text" tooltip="{ parts:['']}"/>`;
const result = await validateView(snippet);
expect(result.map((item) => issueToSnapshot(item))).toStrictEqual([]);
});
});
7 changes: 7 additions & 0 deletions packages/language-server/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Change Log

## 4.0.47

### Patch Changes

- Updated dependencies [98c33e7]
- @ui5-language-assistant/binding@1.0.29

## 4.0.46

### Patch Changes
Expand Down
4 changes: 2 additions & 2 deletions packages/language-server/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ui5-language-assistant/language-server",
"version": "4.0.46",
"version": "4.0.47",
"private": true,
"description": "UI5 Language Server",
"keywords": [
Expand All @@ -26,7 +26,7 @@
},
"dependencies": {
"@ui5-language-assistant/xml-views-definition": "0.0.3",
"@ui5-language-assistant/binding": "1.0.28",
"@ui5-language-assistant/binding": "1.0.29",
"@sap/swa-for-sapbas-vsx": "1.1.9",
"@ui5-language-assistant/logger": "0.0.1",
"@ui5-language-assistant/context": "4.0.25",
Expand Down
18 changes: 18 additions & 0 deletions packages/vscode-ui5-language-assistant-bas-ext/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
# Change Log

## 4.0.62

### Patch Changes

- fdbf071: chore: update schema.json file

## 4.0.61

### Patch Changes

- 98c33e7: fix: relax diagnostic for property which can be used with both aggregation binding info or property binding info

## 4.0.60

### Patch Changes

- 5b9fa1f: fix: add manual test case

## 4.0.59

### Patch Changes
Expand Down
4 changes: 2 additions & 2 deletions packages/vscode-ui5-language-assistant-bas-ext/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@ui5-language-assistant/vscode-ui5-language-assistant-bas-ext",
"description": "A wrapper module for BAS simple extension around Language Support For SAPUI5",
"license": "Apache-2.0",
"version": "4.0.59",
"version": "4.0.62",
"private": false,
"repository": {
"type": "git",
Expand All @@ -13,7 +13,7 @@
},
"devDependencies": {
"fs-extra": "10.1.0",
"vscode-ui5-language-assistant": "4.0.59"
"vscode-ui5-language-assistant": "4.0.62"
},
"files": [
"*.vsix",
Expand Down
19 changes: 19 additions & 0 deletions packages/vscode-ui5-language-assistant/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
# Change Log

## 4.0.62

### Patch Changes

- fdbf071: chore: update schema.json file

## 4.0.61

### Patch Changes

- 98c33e7: fix: relax diagnostic for property which can be used with both aggregation binding info or property binding info
- @ui5-language-assistant/language-server@4.0.47

## 4.0.60

### Patch Changes

- 5b9fa1f: fix: add manual test case

## 4.0.59

### Patch Changes
Expand Down
4 changes: 2 additions & 2 deletions packages/vscode-ui5-language-assistant/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"displayName": "UI5 Language Assistant",
"private": true,
"description": "Language Support For SAPUI5",
"version": "4.0.59",
"version": "4.0.62",
"publisher": "SAPOSS",
"icon": "resources/ui5-language-assistant.png",
"keywords": [
Expand Down Expand Up @@ -155,7 +155,7 @@
"update:schema": "ts-node --project tsconfig.cli.json scripts/manifest/run-update.ts"
},
"dependencies": {
"@ui5-language-assistant/language-server": "4.0.46",
"@ui5-language-assistant/language-server": "4.0.47",
"vscode-languageclient": "8.0.2",
"@prettier/plugin-xml": "2.2.0",
"prettier": "2.8.7"
Expand Down
Loading

0 comments on commit e35ed5f

Please sign in to comment.