You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by GitBox <gi...@apache.org> on 2019/05/14 06:06:54 UTC

[GitHub] [netbeans] JaroslavTulach commented on a change in pull request #1249: Support for TextMate injection grammars added.

JaroslavTulach commented on a change in pull request #1249: Support for TextMate injection grammars added.
URL: https://github.com/apache/netbeans/pull/1249#discussion_r283636737
 
 

 ##########
 File path: ide/textmate.lexer/arch.xml
 ##########
 @@ -139,6 +139,33 @@
     {@literal @}GrammarRegistration(mimeType="text/x-kotlin", grammar="path/to/Kotlin.tmLanguage.json")
           </pre>
       </usecase>
+      <usecase id="register-injection-grammar" name="Register injection grammar">
+          Injection grammars let existing grammars to be extend. An injection grammar is
+          a regular TextMate grammar that is injected into a specific scope within
+          an existing grammar. To register a new injection grammar, add it as a file
+          into the system filesystem under "Editors/", and make sure it has attributes
+          "textmate-grammar" whose value is a string representing the TextMate top-level
+          scope and "inject-to" whose value is a string representing comma separated
+          list of scopes that the grammar is injected to. For example, registration
+          of the injection grammar highlighting TODO keywords in JavaScript and TypeScript
+          comments:
+          <pre>
+    &lt;folder name="Editors"&gt;
+        &lt;file name="todo-comment-injection.json" url="todo-comment-injection.json"&gt;
+            &lt;attr name="textmate-grammar" stringvalue="todo-comment.injection" /&gt;
+            &lt;attr name="inject-to" stringvalue="source.js,source.ts" /&gt;
+        &lt;/file&gt;
+    &lt;/folder&gt;
+          </pre>
+      </usecase>
+      <usecase id="register-injection-grammar-using-java-api" name="Register injection grammar using Java API">
+          To register a new injection grammar using Java API, add the GrammarInjectionRegistration
+          annotation to an appropriate package-info file, or an appropriate Java class.
+          For example:
+          <pre>
+    {@literal @}GrammarInjectionRegistration(grammar="path/to/todo-comment-injection.json", injectTo = {"source.js","source.ts"})
 
 Review comment:
   I don't think {@literal} works in this case. This is not a Javadoc document, but just an XML that gets converted to HTML and included inside of Javadoc files. Verify the generated Javadoc HTML page.
   
   I'd use `<a href="@TOP/..../GrammarInjectionRegistration">` to point to the class definition.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

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