Skip to content

Commit 551cf10

Browse files
committed
feat: added more matchers
1 parent db6d096 commit 551cf10

File tree

1 file changed

+32
-7
lines changed

1 file changed

+32
-7
lines changed

src/completion/xml/NamespaceCompletionItemProvider.ts

Lines changed: 32 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ interface AttributeValueMatch {
1212

1313
interface ElementContentMatch {
1414
element?: string;
15-
attributeName: string;
16-
attributeValue: string;
15+
attributeName?: string;
16+
attributeValue?: string;
1717
}
1818

1919
export class NamespaceCompletionItemProvider extends XmlCompletionItemProvider {
@@ -52,13 +52,34 @@ export class NamespaceCompletionItemProvider extends XmlCompletionItemProvider {
5252
element: 'extension_attributes',
5353
attributeName: 'for',
5454
},
55+
{
56+
element: 'consumer',
57+
attributeName: 'handler',
58+
},
59+
{
60+
element: 'queue',
61+
attributeName: 'handler',
62+
},
63+
{
64+
element: 'handler',
65+
attributeName: 'type',
66+
},
5567
];
5668

5769
private static readonly ELEMENT_CONTENT_MATCHERS: ElementContentMatch[] = [
5870
{
5971
attributeName: 'xsi:type',
6072
attributeValue: 'object',
6173
},
74+
{
75+
element: 'backend_model',
76+
},
77+
{
78+
element: 'frontend_model',
79+
},
80+
{
81+
element: 'source_model',
82+
},
6283
];
6384

6485
getFilePatterns(): string[] {
@@ -101,11 +122,15 @@ export class NamespaceCompletionItemProvider extends XmlCompletionItemProvider {
101122
return false;
102123
}
103124

104-
return element.attributes.some(
105-
attribute =>
106-
attribute.key === matchElement.attributeName &&
107-
attribute.value === matchElement.attributeValue
108-
);
125+
if (matchElement.attributeName && matchElement.attributeValue) {
126+
return element.attributes.some(
127+
attribute =>
128+
attribute.key === matchElement.attributeName &&
129+
attribute.value === matchElement.attributeValue
130+
);
131+
}
132+
133+
return true;
109134
});
110135

111136
if (!match) {

0 commit comments

Comments
 (0)