dbalek commented on a change in pull request #3333:
URL: https://github.com/apache/netbeans/pull/3333#discussion_r758139292



##########
File path: 
enterprise/micronaut/src/org/netbeans/modules/micronaut/completion/MicronautConfigCompletionProvider.java
##########
@@ -89,17 +121,133 @@ public MicronautConfigCompletionQuery(Project project) {
 
         @Override
         protected void query(CompletionResultSet resultSet, Document doc, int 
caretOffset) {
-            resultSet.addAllItems(new 
MicronautConfigCompletionTask().query(doc, caretOffset, project, new 
MicronautConfigCompletionTask.ItemFactory<MicronautConfigCompletionItem>() {
+            resultSet.addAllItems(new 
MicronautConfigCompletionTask().query(doc, caretOffset, project, new 
MicronautConfigCompletionTask.ItemFactory<CompletionItem>() {
                 @Override
-                public MicronautConfigCompletionItem 
createPropertyItem(ConfigurationMetadataProperty property, int offset, int 
baseIndent, int indentLevelSize, int idx) {
+                public CompletionItem 
createPropertyItem(ConfigurationMetadataProperty property, int offset, int 
baseIndent, int indentLevelSize, int idx) {
                     resultSet.setAnchorOffset(offset);
-                    return 
MicronautConfigCompletionItem.createPropertyItem(property, offset, baseIndent, 
indentLevelSize, idx);
+                    String propName = property.getId();
+                    String propType = property.getType();
+                    CompletionUtilities.CompletionItemBuilder builder = 
CompletionUtilities.newCompletionItemBuilder(propName)
+                            .iconResource(ICON)
+                            .leftHtmlText(property.isDeprecated()
+                                    ? PROPERTY_NAME_COLOR + "<s>" + propName + 
"</s></font>"
+                                    : PROPERTY_NAME_COLOR + propName + 
"</font>")
+                            .sortPriority(property.isDeprecated() ? 30 : 20)
+                            .documentationTask(() -> {
+                                return new AsyncCompletionTask(new 
MicronautConfigDocumentationQuery(property));
+                            })
+                            .onSelect((component, overwrite) -> {
+                                try {

Review comment:
       LSP version is simpler because insertion logic (including e.g. 
indentation of a multi-line snippet) is left on client (VSCode) while NB code 
completion API requires completion items to manage perform their insertion.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to