Skip to content

Commit 05d9f69

Browse files
fix: wrong cc and readme file (#623)
* fix: no cc for wrong position * fix: update readme file * fix: change set --------- Co-authored-by: vadson71 <[email protected]>
1 parent 62251ca commit 05d9f69

File tree

4 files changed

+29
-2
lines changed

4 files changed

+29
-2
lines changed

.changeset/sour-pandas-behave.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
"@ui5-language-assistant/vscode-ui5-language-assistant-bas-ext": patch
3+
"vscode-ui5-language-assistant": patch
4+
"@ui5-language-assistant/binding": patch
5+
---
6+
7+
No code completion for wrong position

packages/binding/src/services/completion/providers/property-binding-info.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import {
22
parseBinding,
33
BindingParserTypes as BindingTypes,
4-
positionContained,
4+
rangeContained,
55
} from "@ui5-language-assistant/binding-parser";
66
import type { Position } from "vscode-languageserver-types";
77
import { AttributeValueCompletionOptions } from "@xml-tools/content-assist";
@@ -90,7 +90,10 @@ export function propertyBindingInfoSuggestions({
9090
}
9191
const cursorPos = context.textDocumentPosition?.position;
9292
const binding = ast.bindings.find(
93-
(b) => cursorPos && positionContained(b.range, cursorPos)
93+
(b) =>
94+
cursorPos &&
95+
b.range &&
96+
rangeContained(b.range, { start: cursorPos, end: cursorPos })
9497
);
9598
if (!binding) {
9699
continue;

packages/binding/test/unit/services/completion/index.test.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,14 @@ describe("index", () => {
141141
result.map((item) => completionItemToSnapshot(item, true))
142142
).toStrictEqual([]);
143143
});
144+
it("provides no CC on wrong position", async function () {
145+
const snippet = `
146+
<Input maxLength="${CURSOR_ANCHOR}{path: ''}"/>`;
147+
const result = await getCompletionResult(snippet);
148+
expect(
149+
result.map((item) => completionItemToSnapshot(item, true))
150+
).toStrictEqual([]);
151+
});
144152
it("provides no CC for metadata binding", async function () {
145153
const snippet = `
146154
<Input maxLength="{/#Company${CURSOR_ANCHOR}/ZipCode/@maxLength}"/>`;

packages/vscode-ui5-language-assistant/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ The feature is available in the following:
5050
- metaPath values in building blocks
5151
- contextPath values for Chart building blocks
5252
- filterBar values from the current file in building blocks
53+
- property binding info when possible
5354

5455
### XML View Validations
5556

@@ -73,6 +74,14 @@ and cannot be configured by the end user.
7374
- Wrong cardinality of aggregation
7475
- Wrong type of tags inside aggregations
7576
- Missing or empty ID when `flexEnabled` is true (stableID)
77+
- property binding info
78+
- missing key
79+
- missing or extra colon(s)
80+
- missing or wrong value
81+
- missing or extra comma(s)
82+
- duplicate keys
83+
- unknown key or char(s)
84+
- recursive composite bindings
7685

7786
- Warnings:
7887

0 commit comments

Comments
 (0)