From 41119bfb2e4f55e57156b5f737af36f82a42583a Mon Sep 17 00:00:00 2001 From: Philip Makedonski Date: Mon, 20 Apr 2026 22:45:21 +0200 Subject: [PATCH 1/3] + completion refinements, #122 --- .../tdl/ui/contentassist/TDLtxProposalProvider.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/plugins/org.etsi.mts.tdl.tx.ui/src/org/etsi/mts/tdl/ui/contentassist/TDLtxProposalProvider.java b/plugins/org.etsi.mts.tdl.tx.ui/src/org/etsi/mts/tdl/ui/contentassist/TDLtxProposalProvider.java index fc8ad52..5a24ca2 100644 --- a/plugins/org.etsi.mts.tdl.tx.ui/src/org/etsi/mts/tdl/ui/contentassist/TDLtxProposalProvider.java +++ b/plugins/org.etsi.mts.tdl.tx.ui/src/org/etsi/mts/tdl/ui/contentassist/TDLtxProposalProvider.java @@ -383,11 +383,12 @@ public class TDLtxProposalProvider extends AbstractTDLtxProposalProvider { if (ne instanceof SimpleDataType) { } else { - String prefix = "new "; + String prefix = ""; String suffix = "()"; if (ne instanceof CollectionDataType) { suffix = "[]"; } + acceptor.accept(createCompletionProposal(suffix, new StyledString(suffix).append(" : new anonymous instance of type "+ne.getName(), StyledString.DECORATIONS_STYLER), getImage(ne), 1100, "", context)); acceptor.accept(createCompletionProposal(prefix+ne.getName()+suffix, new StyledString(prefix+ne.getName()+suffix).append(" : new instance of type", StyledString.DECORATIONS_STYLER), getImage(ne), 1000, "", context)); } } else if (ne instanceof Function && ((Function) ne).getReturnType().conformsTo(type)) { @@ -534,6 +535,13 @@ public class TDLtxProposalProvider extends AbstractTDLtxProposalProvider { .map(ParameterBinding::getParameter) .toList(); + if (dataElement == null) { + dataElement = ((DataElementUse) model).resolveDataType(); + //TODO: filter parentheses + prefix = prefix.replace("(", ""); + suffix = suffix.replace(")", ""); + } + //TODO: a bit of a hack.. this belongs elsewhere -> affects the whole chain, should be applied selectively // System.out.println(model); // System.out.println(context.getPreviousModel()); @@ -598,6 +606,9 @@ public class TDLtxProposalProvider extends AbstractTDLtxProposalProvider { ICompletionProposalAcceptor acceptor) { if (model instanceof DataElementUse) { NamedElement dataElement = ((DataElementUse) model).getDataElement(); + if (dataElement == null) { + dataElement = ((DataElementUse) model).resolveDataType(); + } if (dataElement instanceof CollectionDataType) { DataType itemType = ((CollectionDataType) dataElement).getItemType(); completeAssignment(model, context, acceptor, itemType); -- GitLab From 5606484a0979807557ce7e3828049c8f683037d5 Mon Sep 17 00:00:00 2001 From: Philip Makedonski Date: Mon, 20 Apr 2026 22:49:15 +0200 Subject: [PATCH 2/3] + completion refinements, #122 --- .../etsi/mts/tdl/ui/contentassist/TDLtxProposalProvider.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/org.etsi.mts.tdl.tx.ui/src/org/etsi/mts/tdl/ui/contentassist/TDLtxProposalProvider.java b/plugins/org.etsi.mts.tdl.tx.ui/src/org/etsi/mts/tdl/ui/contentassist/TDLtxProposalProvider.java index 5a24ca2..4689d30 100644 --- a/plugins/org.etsi.mts.tdl.tx.ui/src/org/etsi/mts/tdl/ui/contentassist/TDLtxProposalProvider.java +++ b/plugins/org.etsi.mts.tdl.tx.ui/src/org/etsi/mts/tdl/ui/contentassist/TDLtxProposalProvider.java @@ -384,9 +384,9 @@ public class TDLtxProposalProvider extends AbstractTDLtxProposalProvider { } else { String prefix = ""; - String suffix = "()"; + String suffix = "( )"; if (ne instanceof CollectionDataType) { - suffix = "[]"; + suffix = "[ ]"; } acceptor.accept(createCompletionProposal(suffix, new StyledString(suffix).append(" : new anonymous instance of type "+ne.getName(), StyledString.DECORATIONS_STYLER), getImage(ne), 1100, "", context)); acceptor.accept(createCompletionProposal(prefix+ne.getName()+suffix, new StyledString(prefix+ne.getName()+suffix).append(" : new instance of type", StyledString.DECORATIONS_STYLER), getImage(ne), 1000, "", context)); -- GitLab From ace138d35df2fae0b9566e13f1dacb33cd48bb23 Mon Sep 17 00:00:00 2001 From: Philip Makedonski Date: Mon, 20 Apr 2026 22:51:38 +0200 Subject: [PATCH 3/3] + completion refinements, #122 --- .../etsi/mts/tdl/ui/contentassist/TDLtxProposalProvider.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/org.etsi.mts.tdl.tx.ui/src/org/etsi/mts/tdl/ui/contentassist/TDLtxProposalProvider.java b/plugins/org.etsi.mts.tdl.tx.ui/src/org/etsi/mts/tdl/ui/contentassist/TDLtxProposalProvider.java index 4689d30..3972796 100644 --- a/plugins/org.etsi.mts.tdl.tx.ui/src/org/etsi/mts/tdl/ui/contentassist/TDLtxProposalProvider.java +++ b/plugins/org.etsi.mts.tdl.tx.ui/src/org/etsi/mts/tdl/ui/contentassist/TDLtxProposalProvider.java @@ -388,8 +388,8 @@ public class TDLtxProposalProvider extends AbstractTDLtxProposalProvider { if (ne instanceof CollectionDataType) { suffix = "[ ]"; } - acceptor.accept(createCompletionProposal(suffix, new StyledString(suffix).append(" : new anonymous instance of type "+ne.getName(), StyledString.DECORATIONS_STYLER), getImage(ne), 1100, "", context)); - acceptor.accept(createCompletionProposal(prefix+ne.getName()+suffix, new StyledString(prefix+ne.getName()+suffix).append(" : new instance of type", StyledString.DECORATIONS_STYLER), getImage(ne), 1000, "", context)); + acceptor.accept(createCompletionProposal(suffix, new StyledString(suffix).append(" : new anonymous instance of type "+ne.getName(), StyledString.DECORATIONS_STYLER), getImage(ne), 1200, "", context)); + acceptor.accept(createCompletionProposal(prefix+ne.getName()+suffix, new StyledString(prefix+ne.getName()+suffix).append(" : new instance of type", StyledString.DECORATIONS_STYLER), getImage(ne), 1100, "", context)); } } else if (ne instanceof Function && ((Function) ne).getReturnType().conformsTo(type)) { accept = true; -- GitLab