dbalek commented on code in PR #6648:
URL: https://github.com/apache/netbeans/pull/6648#discussion_r1394111926
##########
enterprise/micronaut/src/org/netbeans/modules/micronaut/completion/MicronautDataCompletionProvider.java:
##########
@@ -100,9 +134,205 @@ public CompletionItem createFinderMethodNameItem(String
prefix, String name, int
public CompletionItem createSQLItem(CompletionItem item) {
return item;
}
+
+ @Override
+ public CompletionItem createKeywordItem(String name, int
offset) {
+ return CompletionUtilities.newCompletionItemBuilder(name)
+ .startOffset(offset)
+ .iconResource(MICRONAUT_ICON)
+ .leftHtmlText(KEYWORD_COLOR + "<b>" + name +
"</b>" + COLOR_END)
+ .sortPriority(200)
+ .build();
+ }
+
+ @Override
+ public CompletionItem createBuiltInItem(String name, String
parenPair, int offset) {
+ return CompletionUtilities.newCompletionItemBuilder(name)
+ .iconResource(MICRONAUT_ICON)
+ .leftHtmlText(name + parenPair.charAt(0) + "..." +
parenPair.charAt(1))
+ .sortPriority(100)
+ .onSelect(ctx -> {
+ final Document doc =
ctx.getComponent().getDocument();
+ try {
+ doc.remove(offset,
ctx.getComponent().getCaretPosition() - offset);
+ } catch (BadLocationException ex) {
+ Exceptions.printStackTrace(ex);
+ }
+ String template = name + parenPair.charAt(0) +
"${cursor completionInvoke}" + parenPair.charAt(1);
+
CodeTemplateManager.get(doc).createTemporary(template).insert(ctx.getComponent());
+ }).build();
+ }
+
+ @Override
+ public CompletionItem createPackageItem(String name, int
offset) {
+ return CompletionUtilities.newCompletionItemBuilder(name)
+ .iconResource(PACKAGE_ICON)
+ .leftHtmlText(PACKAGE_COLOR + name + COLOR_END)
+ .sortPriority(400)
+ .insertText(name + '.')
+ .startOffset(offset)
+ .build();
+ }
+
+ @Override
+ public CompletionItem createBeanPropertyItem(String name,
String typeName, int offset) {
+ return CompletionUtilities.newCompletionItemBuilder(name)
+ .iconResource(PROPERTY)
+ .leftHtmlText(PROPERTY_COLOR + "<b>" + name +
"</b>" + COLOR_END)
+ .sortPriority(50)
+ .startOffset(offset)
+ .rightHtmlText(typeName)
+ .build();
+ }
+
+ @Override
+ public CompletionItem createEnvPropertyItem(String name,
String documentation, int anchorOffset, int offset) {
+ return CompletionUtilities.newCompletionItemBuilder(name)
+ .iconResource(ATTRIBUTE_VALUE)
+ .leftHtmlText(ATTRIBUTE_VALUE_COLOR + escape(name)
+ COLOR_END)
Review Comment:
Fixed.
--
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