11import { expect } from "chai" ;
2- import { map , uniq , forEach } from "lodash" ;
2+ import { map , uniq , forEach , filter } from "lodash" ;
33import { CompletionItemKind , TextEdit } from "vscode-languageserver" ;
44import { UI5XMLViewCompletion } from "@ui5-language-assistant/xml-views-completion" ;
55import { UI5SemanticModel } from "@ui5-language-assistant/semantic-model-types" ;
@@ -255,7 +255,10 @@ describe("the UI5 language assistant Code Completion Services", () => {
255255 xmlns:mvc="sap.ui.core.mvc"
256256 xmlns="sap.m">
257257 <List> <te⇶` ;
258- const suggestions = getSuggestions ( xmlSnippet , ui5SemanticModel ) ;
258+ const suggestions = filter (
259+ getSuggestions ( xmlSnippet , ui5SemanticModel ) ,
260+ ( suggestion ) => suggestion . kind === CompletionItemKind . Field
261+ ) ;
259262 const suggestionsDetails = map ( suggestions , ( suggestion ) => ( {
260263 label : suggestion . label ,
261264 tagName : getTagName ( suggestion . textEdit as TextEdit ) ,
@@ -282,7 +285,10 @@ describe("the UI5 language assistant Code Completion Services", () => {
282285 xmlns:mvc="sap.ui.core.mvc"
283286 xmlns:m="sap.m">
284287 <m:List> <te⇶` ;
285- const suggestions = getSuggestions ( xmlSnippet , ui5SemanticModel ) ;
288+ const suggestions = filter (
289+ getSuggestions ( xmlSnippet , ui5SemanticModel ) ,
290+ ( suggestion ) => suggestion . kind === CompletionItemKind . Field
291+ ) ;
286292 const suggestionsDetails = map ( suggestions , ( suggestion ) => ( {
287293 label : suggestion . label ,
288294 tagName : getTagName ( suggestion . textEdit as TextEdit ) ,
@@ -309,7 +315,10 @@ describe("the UI5 language assistant Code Completion Services", () => {
309315 xmlns:mvc="sap.ui.core.mvc"
310316 xmlns="sap.m">
311317 <List> <te⇶Menu` ;
312- const suggestions = getSuggestions ( xmlSnippet , ui5SemanticModel ) ;
318+ const suggestions = filter (
319+ getSuggestions ( xmlSnippet , ui5SemanticModel ) ,
320+ ( suggestion ) => suggestion . kind === CompletionItemKind . Field
321+ ) ;
313322 const suggestionsDetails = map ( suggestions , ( suggestion ) => ( {
314323 label : suggestion . label ,
315324 replacedText : getTextInRange (
@@ -340,7 +349,10 @@ describe("the UI5 language assistant Code Completion Services", () => {
340349 xmlns:mvc="sap.ui.core.mvc"
341350 xmlns:m="sap.m">
342351 <m:List> <te⇶Menu` ;
343- const suggestions = getSuggestions ( xmlSnippet , ui5SemanticModel ) ;
352+ const suggestions = filter (
353+ getSuggestions ( xmlSnippet , ui5SemanticModel ) ,
354+ ( suggestion ) => suggestion . kind === CompletionItemKind . Field
355+ ) ;
344356 const suggestionsDetails = map ( suggestions , ( suggestion ) => ( {
345357 label : suggestion . label ,
346358 replacedText : getTextInRange (
@@ -378,7 +390,10 @@ describe("the UI5 language assistant Code Completion Services", () => {
378390 <te⇶></⭲te⭰>
379391 </List>
380392 </mvc:View>` ;
381- const suggestions = getSuggestions ( xmlSnippet , ui5SemanticModel ) ;
393+ const suggestions = filter (
394+ getSuggestions ( xmlSnippet , ui5SemanticModel ) ,
395+ ( suggestion ) => suggestion . kind === CompletionItemKind . Field
396+ ) ;
382397 const suggestionsDetails = map ( suggestions , ( suggestion ) => ( {
383398 label : suggestion . label ,
384399 tagName : getTagName ( suggestion . textEdit as TextEdit ) ,
@@ -442,7 +457,10 @@ describe("the UI5 language assistant Code Completion Services", () => {
442457 <m:te⇶></⭲m:te⭰>
443458 </m:List>
444459 </mvc:View>` ;
445- const suggestions = getSuggestions ( xmlSnippet , ui5SemanticModel ) ;
460+ const suggestions = filter (
461+ getSuggestions ( xmlSnippet , ui5SemanticModel ) ,
462+ ( suggestion ) => suggestion . kind === CompletionItemKind . Field
463+ ) ;
446464 const suggestionsDetails = map ( suggestions , ( suggestion ) => ( {
447465 label : suggestion . label ,
448466 tagName : getTagName ( suggestion . textEdit as TextEdit ) ,
@@ -506,7 +524,10 @@ describe("the UI5 language assistant Code Completion Services", () => {
506524 <te⇶></aaa>
507525 </List>
508526 </mvc:View>` ;
509- const suggestions = getSuggestions ( xmlSnippet , ui5SemanticModel ) ;
527+ const suggestions = filter (
528+ getSuggestions ( xmlSnippet , ui5SemanticModel ) ,
529+ ( suggestion ) => suggestion . kind === CompletionItemKind . Field
530+ ) ;
510531 const suggestionsDetails = map ( suggestions , ( suggestion ) => ( {
511532 label : suggestion . label ,
512533 tagName : getTagName ( suggestion . textEdit as TextEdit ) ,
@@ -555,7 +576,10 @@ describe("the UI5 language assistant Code Completion Services", () => {
555576 <te⇶>⭲</>⭰
556577 </List>
557578 </mvc:View>` ;
558- const suggestions = getSuggestions ( xmlSnippet , ui5SemanticModel ) ;
579+ const suggestions = filter (
580+ getSuggestions ( xmlSnippet , ui5SemanticModel ) ,
581+ ( suggestion ) => suggestion . kind === CompletionItemKind . Field
582+ ) ;
559583 const suggestionsDetails = map ( suggestions , ( suggestion ) => ( {
560584 label : suggestion . label ,
561585 tagName : getTagName ( suggestion . textEdit as TextEdit ) ,
0 commit comments