Makhnev Petr e16176cfd9
Add article and tutorial about Navigation Bar
* add docs about navigation bar for Custom Language Support topic
* add info in `topics/intro/content_updates.md`
* renumber articles after the added tutorial
* add `custom_language_tutorial_header` to `structure_aware_navbar.md`
2022-05-24 10:50:04 +02:00

1.7 KiB

A commenter enables the user to comment-out a line of code at the cursor or selected code automatically. The Commenter defines support for Code | Comment with Line Comment and Code | Comment with Block Comment actions.

Define a Commenter

The commenter for Simple Language defines the line comment prefix as #.

{src="simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleCommenter.java"}

Register the Commenter

The SimpleCommenter implementation is registered in the plugin configuration file using the com.intellij.lang.commenter extension point.

<extensions defaultExtensionNs="com.intellij">
  <lang.commenter
      language="Simple"
      implementationClass="org.intellij.sdk.language.SimpleCommenter"/>
</extensions>

Run the Project

Run the plugin by using the Gradle runIde task.

Open the example Simple Language properties file in the IDE Development Instance. Place the cursor at the website line. Select Code | Comment with Line Comment. The line is converted to a comment. Select Code | Comment with Line Comment again, and the comment is converted back to active code.

Commenter