diff --git a/.idea/misc.xml b/.idea/misc.xml
index 43f2a1f4c33..8cfd6389adc 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -3,7 +3,7 @@
-
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
index 109a039b3f9..31756bbe106 100644
--- a/.idea/modules.xml
+++ b/.idea/modules.xml
@@ -11,6 +11,7 @@
+
diff --git a/.idea/runConfigurations/editor_basics.xml b/.idea/runConfigurations/editor_basics.xml
index 477e1437d07..9bc65b3eafd 100644
--- a/.idea/runConfigurations/editor_basics.xml
+++ b/.idea/runConfigurations/editor_basics.xml
@@ -3,7 +3,6 @@
-
\ No newline at end of file
diff --git a/.idea/runConfigurations/facet_basics.xml b/.idea/runConfigurations/facet_basics.xml
index 65fbb04df28..f1528e683b1 100644
--- a/.idea/runConfigurations/facet_basics.xml
+++ b/.idea/runConfigurations/facet_basics.xml
@@ -3,7 +3,6 @@
-
\ No newline at end of file
diff --git a/.idea/runConfigurations/framework.xml b/.idea/runConfigurations/framework.xml
index 0dd24f6738c..ca40a141d54 100644
--- a/.idea/runConfigurations/framework.xml
+++ b/.idea/runConfigurations/framework.xml
@@ -3,7 +3,6 @@
-
\ No newline at end of file
diff --git a/.idea/runConfigurations/kotlin_demo.xml b/.idea/runConfigurations/kotlin_demo.xml
index ed1663ee09f..306685de0fc 100644
--- a/.idea/runConfigurations/kotlin_demo.xml
+++ b/.idea/runConfigurations/kotlin_demo.xml
@@ -3,7 +3,6 @@
-
\ No newline at end of file
diff --git a/.idea/runConfigurations/project_model.xml b/.idea/runConfigurations/project_model.xml
index faac073d05a..be694317e5e 100644
--- a/.idea/runConfigurations/project_model.xml
+++ b/.idea/runConfigurations/project_model.xml
@@ -3,7 +3,6 @@
-
\ No newline at end of file
diff --git a/.idea/runConfigurations/register_actions.xml b/.idea/runConfigurations/register_actions.xml
index 19342c2ad42..b7bf2602722 100644
--- a/.idea/runConfigurations/register_actions.xml
+++ b/.idea/runConfigurations/register_actions.xml
@@ -3,7 +3,6 @@
-
\ No newline at end of file
diff --git a/.idea/runConfigurations/simple_language_plugin.xml b/.idea/runConfigurations/simple_language_plugin.xml
index adb27b13392..c72beef526d 100644
--- a/.idea/runConfigurations/simple_language_plugin.xml
+++ b/.idea/runConfigurations/simple_language_plugin.xml
@@ -3,7 +3,6 @@
-
\ No newline at end of file
diff --git a/.idea/runConfigurations/tree_structure_provider.xml b/.idea/runConfigurations/tree_structure_provider.xml
index 5485c1c71d8..27e1002202a 100644
--- a/.idea/runConfigurations/tree_structure_provider.xml
+++ b/.idea/runConfigurations/tree_structure_provider.xml
@@ -3,7 +3,7 @@
-
+
\ No newline at end of file
diff --git a/_SUMMARY.md b/_SUMMARY.md
index e7ecb3484c7..325f1556c00 100644
--- a/_SUMMARY.md
+++ b/_SUMMARY.md
@@ -143,6 +143,8 @@
* [Supporting Module Types](tutorials/project_wizard/module_types.md)
* [Code Inspections](tutorials/code_inspections.md)
* [Code Intentions](tutorials/code_intentions.md)
+ * [Live Templates](tutorials/live_templates.md)
+ * [1. Adding Live Template Support](tutorials/live_templates/template_support.md)\
* [Run Configurations](tutorials/run_configurations.md)
* [Supporting Frameworks](tutorials/framework.md)
* [Tree Structure View](tutorials/tree_structure_view.md)
diff --git a/code_samples/live_templates/resources/META-INF/plugin.xml b/code_samples/live_templates/resources/META-INF/plugin.xml
index 68ae2627bca..1e2935c91ee 100644
--- a/code_samples/live_templates/resources/META-INF/plugin.xml
+++ b/code_samples/live_templates/resources/META-INF/plugin.xml
@@ -1,6 +1,6 @@
- com.your.company.unique.plugin.id
- Plugin display name here
+ live_templates
+ live_templates1.0YourCompany
@@ -25,7 +25,9 @@
-->
-
+
+
+
diff --git a/code_samples/live_templates/src/MarkdownContext.java b/code_samples/live_templates/src/MarkdownContext.java
index 4daf4df1a92..1c1c05a6d5e 100644
--- a/code_samples/live_templates/src/MarkdownContext.java
+++ b/code_samples/live_templates/src/MarkdownContext.java
@@ -1,7 +1,17 @@
+import com.intellij.codeInsight.template.EverywhereContextType;
import com.intellij.codeInsight.template.TemplateContextType;
+import com.intellij.psi.PsiFile;
+import org.jetbrains.annotations.NonNls;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
-/**
- * Created by breandan on 1/11/2016.
- */
public class MarkdownContext extends TemplateContextType {
+ protected MarkdownContext() {
+ super("MARKDOWN", "Markdown");
+ }
+
+ @Override
+ public boolean isInContext(@NotNull PsiFile file, int offset) {
+ return file.getName().endsWith(".md");
+ }
}
diff --git a/code_samples/live_templates/src/MarkdownTemplateProvider.java b/code_samples/live_templates/src/MarkdownTemplateProvider.java
index 8926db4b15d..c113accb37d 100644
--- a/code_samples/live_templates/src/MarkdownTemplateProvider.java
+++ b/code_samples/live_templates/src/MarkdownTemplateProvider.java
@@ -1,7 +1,16 @@
import com.intellij.codeInsight.template.impl.DefaultLiveTemplatesProvider;
+import org.jetbrains.annotations.Nullable;
-/**
- * Created by breandan on 1/11/2016.
- */
public class MarkdownTemplateProvider implements DefaultLiveTemplatesProvider {
+ @Override
+ public String[] getDefaultLiveTemplateFiles()
+ {
+ return new String[] {"liveTemplates/Markdown"};
+ }
+
+ @Nullable
+ @Override
+ public String[] getHiddenLiveTemplateFiles() {
+ return new String[0];
+ }
}
diff --git a/code_samples/max_opened_projects/resources/META-INF/plugin.xml b/code_samples/max_opened_projects/resources/META-INF/plugin.xml
index 3e3ce844c56..d844bd01e51 100644
--- a/code_samples/max_opened_projects/resources/META-INF/plugin.xml
+++ b/code_samples/max_opened_projects/resources/META-INF/plugin.xml
@@ -1,5 +1,5 @@
- Plugin name here
+ max_opened_projectsshort description of the plugin1.0YourCompany
diff --git a/tutorials.md b/tutorials.md
index fec2a1dc506..eced37142ca 100644
--- a/tutorials.md
+++ b/tutorials.md
@@ -25,4 +25,5 @@ A more detailed explanation of the API components can be found in the
* [Kotlin for Plugin Developers](tutorials/kotlin.md)
* [Gradle Build System](tutorials/build_system.md)
* [Code Inspections](tutorials/code_inspections.md)
-* [Code Intentions](tutorials/code_intentions.md)
\ No newline at end of file
+* [Code Intentions](tutorials/code_intentions.md)
+* [Live Templates](tutorials/live_templates.md)
\ No newline at end of file
diff --git a/tutorials/live_templates.md b/tutorials/live_templates.md
index e69de29bb2d..973c64cabe4 100644
--- a/tutorials/live_templates.md
+++ b/tutorials/live_templates.md
@@ -0,0 +1,15 @@
+---
+title: Live Templates
+---
+
+*Live templates* in IntelliJ IDEA are customizable rules that allow developers to abbreviate repetitive patterns of text in the editor. When a user types the designated abbreviation followed by a configurable *expansion key* (usually `Tab`), the IDE will transform the preceding input sequence to its full-length output, and update the cursor position. For example, consider a `for` loop. Typically, the end user would need to type `for(int i = 0; i < 10; i++) {}`. This pattern may be shortened to `fori` and the remaining contents will be expanded, leaving the following structure:
+
+```
+for(int i = [|]; i < []; i++) {
+ []
+}
+```
+
+ As the user completes each section of the `for` loop and presses `Tab`, the cursor will advance to the next position in the editor. For more information about creating your own Custom Live Templates, you may refer to the [corresponding documentation](https://www.jetbrains.com/idea/help/creating-and-editing-live-templates.html). In this tutorial, we will illustrate how to add default Custom Live Templates to an IntelliJ Platform plugin, and assign valid contexts where these templates can take on added functionality based on the surrounding code and file type. We will discuss how to export existing live templates, and bundle them within a plugin to give plugin users added typing efficiency when using a custom language.
+
+ * [1. Create a new Live Template](live_templates/template_support.md)
\ No newline at end of file
diff --git a/tutorials/live_templates/template_support.md b/tutorials/live_templates/template_support.md
index a97af669d19..9d679f3eb17 100644
--- a/tutorials/live_templates/template_support.md
+++ b/tutorials/live_templates/template_support.md
@@ -34,3 +34,34 @@ Copy this file into your plugin's resources, (eg. `project/resource/liveTemplate
## Implement DefaultLiveTemplatesProvider
+The `DefaultLiveTemplatesProvider` tells us where to find the Live Template settings file. Make sure to include the full path to the file, relative to the resources directory, excluding the file name.
+
+```java
+{% include /code_samples/live_templates/src/MarkdownTemplateProvider.java %}
+```
+
+## Implement TemplateContextType
+
+A `TemplateContextType` tells us where the live template is applicible.
+
+```java
+{% include /code_samples/live_templates/src/MarkdownTemplateProvider.java %}
+```
+
+Once you define the `TemplateContextType`, be sure to add the assigned context type to the previously created Live Template settings file. Under `...` add the following context:
+
+```xml
+
+
+
+```
+
+## Register Extension Points
+
+```xml
+{% include /code_samples/live_templates/resources/META-INF/plugin.xml %}
+```
+
+## Check Plugin
+
+Now check that the plugin is working correctly. Run the plugin and verify there is a new entry under *File \| Settings \| Live Templates \| Markdown \| \[*. Finally, create a new file `Test.md` and confirm that the Live Template works.
\ No newline at end of file