Review of nbm-code-completion
diff --git a/netbeans.apache.org/src/content/tutorials/nbm-code-completion.asciidoc b/netbeans.apache.org/src/content/tutorials/nbm-code-completion.asciidoc
index 68793f9..38cc3c9 100644
--- a/netbeans.apache.org/src/content/tutorials/nbm-code-completion.asciidoc
+++ b/netbeans.apache.org/src/content/tutorials/nbm-code-completion.asciidoc
@@ -29,18 +29,18 @@
 :experimental:
 :description: NetBeans Code Completion Tutorial - Apache NetBeans
 :keywords: Apache NetBeans Platform, Platform Tutorials, NetBeans Code Completion Tutorial
+:reviewed: 2022-02-02
 
-This tutorial shows you how to implement the  link:https://bits.netbeans.org/dev/javadoc/org-netbeans-modules-editor-completion/overview-summary.html[Editor Code Completion API]. You will be shown how to implement the API in the context of HTML files. When the user invokes the code completion feature, a code completion box will appear, displaying words that can complete the text typed in the editor. At the end of this tutorial, HTML files will have a code completion box as follows:
+This tutorial shows you how to implement the
+link:https://bits.netbeans.org/dev/javadoc/org-netbeans-modules-editor-completion/overview-summary.html[Editor
+Code Completion API]. You will be shown how to implement the API in the context
+of HTML files. When the user invokes the code completion feature, a code
+completion box will appear, displaying words that can complete the text typed
+in the editor. At the end of this tutorial, HTML files will have a code
+completion box as follows:
 
-The content of the code completion box will come from country names retrieved from the JDK's  ``java.util.Locale``  package.
-
-NOTE: This document uses NetBeans IDE 8.0 and NetBeans Platform 8.0. If you are using an earlier version, see  link:74/nbm-code-completion.html[the previous version of this document].
-
-
-
-
-
-
+The content of the code completion box will come from country names retrieved
+from the JDK's  ``java.util.Locale``  package.
 
 For troubleshooting purposes, you are welcome to download the  link:http://web.archive.org/web/20150927111721/https://java.net/projects/nb-api-samples/sources/api-samples/show/versions/8.0/tutorials/CountryCodeCompleter[completed tutorial source code].
 
@@ -97,7 +97,7 @@
 In the  ``CountriesCompletionProvider``  class, change the signature so that the class  ``implements CompletionProvider`` . Place the cursor on the line that defines the signature. A lightbulb appears. Click it and the IDE adds an import statement for  ``org.netbeans.spi.editor.completion.CompletionProvider`` . The lightbulb appears again. Click it again and the IDE creates skeleton methods for the two methods required by the CompletionProvider class. You should now see this:
 
 
-[source,java]
+[source,java,subs="macros"]
 ----
 
 package org.netbeans.modules.countries;
@@ -129,17 +129,17 @@
 [start=4]
 1. Before coding the  ``CompletionProvider``  class, let's register it in the XML layer file, via a NetBeans Platform annotation:
 
-[source,java]
+[source,java,subs="macros"]
 ----
 
 package org.netbeans.modules.countries;
 
 import javax.swing.text.JTextComponent;
-*import org.netbeans.api.editor.mimelookup.MimeRegistration;*
+import org.netbeans.api.editor.mimelookup.MimeRegistration;
 import org.netbeans.spi.editor.completion.CompletionProvider;
 import org.netbeans.spi.editor.completion.CompletionTask;
 
-*@MimeRegistration(mimeType = "text/html", service = CompletionProvider.class)*
+@MimeRegistration(mimeType = "text/html", service = CompletionProvider.class)
 public class CountriesCompletionProvider implements CompletionProvider {
 
     @Override
@@ -166,7 +166,7 @@
 [start=1]
 1. In the createTask method, below the code from the previous section, add the following lines:
 
-[source,java]
+[source,java,subs="macros"]
 ----
 
 return new AsyncCompletionTask(new AsyncCompletionQuery() {
@@ -182,7 +182,7 @@
 [start=3]
 1. Next, we need to specify which code completion type we are working with. When the user clicks Ctrl-Space, or an alternative key combination defined by the user, our code completion entries should appear. This is the COMPLETION_QUERY_TYPE. Alternative query types exist, such as DOCUMENTATION_QUERY_TYPE and TOOLTIP_QUERY_TYPE. We need to test whether the user pressed the keys applicable to the COMPLETION_QUERY_TYPE. Therefore add the following test to the start of the  ``createTask``  method:
 
-[source,java]
+[source,java,subs="macros"]
 ----
 
 if (queryType != CompletionProvider.COMPLETION_QUERY_TYPE)
@@ -192,7 +192,7 @@
 At this stage, the  ``createTask``  method should look as follows:
 
 
-[source,java]
+[source,java,subs="macros"]
 ----
 
 @Override
@@ -217,7 +217,7 @@
 Before filling out the  ``query``  method, let's look at the  `` link:https://bits.netbeans.org/dev/javadoc/org-netbeans-modules-editor-completion/org/netbeans/spi/editor/completion/CompletionProvider.html#getAutoQueryTypes(javax.swing.text.JTextComponent,%20java.lang.String)[getAutoQueryTypes(JTextComponent jTextComponent, String string)]``  method. This method determines whether the code completion box appears _automatically_ or not. For now, let's return 0. This means that the code completion box will never appear unless the user explicitly asks for it. So, this method should now look as follows:
 
 
-[source,java]
+[source,java,subs="macros"]
 ----
 
 @Override
@@ -240,7 +240,7 @@
 [start=2]
 1. We will return to this class in later steps. For now, we will fill out the query method that we defined in the CompletionProvider class. Fill out the AsyncCompletionTask as follows, and note the explanatory comments in the code:
 
-[source,java]
+[source,java,subs="macros"]
 ----
 
 return new  link:http://bits.netbeans.org/dev/javadoc/org-netbeans-modules-editor-completion/org/netbeans/spi/editor/completion/support/AsyncCompletionTask.html[AsyncCompletionTask](new AsyncCompletionQuery() {
@@ -277,7 +277,7 @@
 [start=4]
 1. In the CountriesCompletionItem class, define the constructor as follows:
 
-[source,java]
+[source,java,subs="macros"]
 ----
 
 private String text;
@@ -292,18 +292,14 @@
 }
 ----
 
-Note that here we're referencing an icon. This is the icon that will appear next to each entry represented by the CompletionItem in the code completion box. The icon can be any icon with a dimension of 16x16 pixels. For example, you could make use of this icon:
-
-
-image::images/cc_icon.png[]
+Note that here we're referencing an icon. This is the icon that will appear next to each entry represented by the CompletionItem in the code completion box. The icon can be any icon with a dimension of 16x16 pixels. For example, you could make use of this icon: image:images/cc_icon.png[]
 
 If you like, you can right-click the image above and save it to the location specified in the ImageIcon definition above.
 
-
 [start=5]
 1. Next define the  `` link:https://bits.netbeans.org/dev/javadoc/org-netbeans-modules-editor-completion/org/netbeans/spi/editor/completion/CompletionItem.html#getPreferredWidth(java.awt.Graphics,%20java.awt.Font)[getPreferredWidth()]``  and  `` link:https://bits.netbeans.org/dev/javadoc/org-netbeans-modules-editor-completion/org/netbeans/spi/editor/completion/CompletionItem.html#render(java.awt.Graphics,%20java.awt.Font,%20java.awt.Color,%20java.awt.Color,%20int,%20int,%20boolean)[render()]``  methods as follows:
 
-[source,java]
+[source,java,subs="macros"]
 ----
 
 @Override
@@ -322,7 +318,7 @@
 Define the  `` link:https://bits.netbeans.org/dev/javadoc/org-netbeans-modules-editor-completion/org/netbeans/spi/editor/completion/CompletionItem.html#getSortText()[getSortText()]``  method as follows:
 
 
-[source,java]
+[source,java,subs="macros"]
 ----
 
 @Override
@@ -334,7 +330,7 @@
 Next, define the  `` link:https://bits.netbeans.org/dev/javadoc/org-netbeans-modules-editor-completion/org/netbeans/spi/editor/completion/CompletionItem.html#getInsertPrefix()[getInsertPrefix()]``  method:
 
 
-[source,java]
+[source,java,subs="macros"]
 ----
 
 @Override
@@ -363,7 +359,7 @@
 [start=1]
 1. Fill out the  ``defaultAction()``  method as follows:
 
-[source,java]
+[source,java,subs="macros"]
 ----
 
 @Override
@@ -397,7 +393,7 @@
 [start=1]
 1. In the CountriesCompletionProvider class, rewrite the  ``AsyncCompletionTask()``  method by adding the statements highlighted in bold below:
 
-[source,java]
+[source,java,subs="macros"]
 ----
 
 return new AsyncCompletionTask(new AsyncCompletionQuery() {
@@ -405,7 +401,7 @@
     @Override
     protected void query(CompletionResultSet completionResultSet, Document document, int caretOffset) {
 
-        *String filter = null;
+        String filter = null;
         int startOffset = caretOffset - 1;
 
         try {
@@ -421,7 +417,7 @@
             }
         } catch (BadLocationException ex) {
             Exceptions.printStackTrace(ex);
-        }*
+        }
 
         //Iterate through the available locales
         //and assign each country display name
@@ -430,11 +426,11 @@
         for (int i = 0; i < locales.length; i++) {
             final Locale locale = locales[i];
             final String country = locale.getDisplayCountry();
-            *//Here we test whether the country starts with the filter defined above:*
-            if (!country.equals("") *&amp;&amp; country.startsWith(filter)*) {
-                *//Here we include the start offset, so that we'll be able to figure out
-                //the number of characters that we'll need to remove:*
-                completionResultSet.addItem(new CountriesCompletionItem(country, *startOffset,* caretOffset));
+            //Here we test whether the country starts with the filter defined above:
+            if (!country.equals("") && country.startsWith(filter)) {
+                //Here we include the start offset, so that we'll be able to figure out
+                //the number of characters that we'll need to remove:
+                completionResultSet.addItem(new CountriesCompletionItem(country, startOffset, caretOffset));
             }
         }
         completionResultSet.finish();
@@ -448,7 +444,7 @@
 [start=2]
 1. Right at the end of the CountriesCompletionProvider, add the following two methods:
 
-[source,java]
+[source,java,subs="macros"]
 ----
 
 static int getRowFirstNonWhite(StyledDocument doc, int offset)
@@ -473,7 +469,7 @@
 ----
 
 
-[source,java]
+[source,java,subs="macros"]
 ----
 
 static int indexOfWhite(char[] line){
@@ -491,16 +487,16 @@
 
 
 [start=3]
-1. Change the constructor of the  ``CountriesCompletionItem``  to receive the start offset. Then change the  ``defaultAction``  so that the start offset will be used in determining the characters that will be removed when the selected country is inserted. Below, the statements highlighted in bold are those that should be added:*private int dotOffset;*
+1. Change the constructor of the  ``CountriesCompletionItem``  to receive the start offset. Then change the  ``defaultAction``  so that the start offset will be used in determining the characters that will be removed when the selected country is inserted. 
 
-[source,java]
+Below, the statements that should be added: `private int dotOffset;`
+
+[source,java,subs="macros"]
 ----
 
-
-
-public CountriesCompletionItem(String text, *int dotOffset,* int caretOffset) {
+public CountriesCompletionItem(String text, int dotOffset, int caretOffset) {
     this.text = text;
-    *this.dotOffset = dotOffset;*
+    this.dotOffset = dotOffset;
     this.caretOffset = caretOffset;
 }
 
@@ -547,7 +543,7 @@
 Here is the code that will achieve the result shown in the screenshot above:
 
 
-[source,java]
+[source,java,subs="macros"]
 ----
 
 @Override
@@ -574,7 +570,7 @@
 Make use of the documentation box like this, by implementing the  ``createDocumentationTask``  method in the  ``CountriesCompletionItem``  class:
 
 
-[source,java]
+[source,java,subs="macros"]
 ----
 
 @Override
@@ -592,7 +588,7 @@
 In the code above, the reference to the CountriesCompletionDocumentation class could be implemented as follows:
 
 
-[source,java]
+[source,java,subs="macros"]
 ----
 
 public class CountriesCompletionDocumentation implements CompletionDocumentation {
@@ -638,8 +634,6 @@
 
 link:http://netbeans.apache.org/community/mailing-lists.html[ Send Us Your Feedback]
 
-
-
 == See Also
 
 For more information about creating and developing plugins, see the following resources: