diff --git a/.idea/runConfigurations/comparing_references_inspection.xml b/.idea/runConfigurations/comparing_references_inspection.xml new file mode 100644 index 00000000000..48dd7c68216 --- /dev/null +++ b/.idea/runConfigurations/comparing_references_inspection.xml @@ -0,0 +1,9 @@ + + + + + \ No newline at end of file diff --git a/.idea/runConfigurations/conditional_operator_intention.xml b/.idea/runConfigurations/conditional_operator_intention.xml new file mode 100644 index 00000000000..5e1166e02c1 --- /dev/null +++ b/.idea/runConfigurations/conditional_operator_intention.xml @@ -0,0 +1,9 @@ + + + + + \ No newline at end of file diff --git a/.idea/runConfigurations/live_templates.xml b/.idea/runConfigurations/live_templates.xml new file mode 100644 index 00000000000..6af01246d6c --- /dev/null +++ b/.idea/runConfigurations/live_templates.xml @@ -0,0 +1,9 @@ + + + + + \ No newline at end of file diff --git a/code_samples/live_templates/live_templates.iml b/code_samples/live_templates/live_templates.iml new file mode 100644 index 00000000000..e025b203cd5 --- /dev/null +++ b/code_samples/live_templates/live_templates.iml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/code_samples/live_templates/resources/META-INF/plugin.xml b/code_samples/live_templates/resources/META-INF/plugin.xml new file mode 100644 index 00000000000..68ae2627bca --- /dev/null +++ b/code_samples/live_templates/resources/META-INF/plugin.xml @@ -0,0 +1,35 @@ + + com.your.company.unique.plugin.id + Plugin display name here + 1.0 + YourCompany + + + most HTML tags may be used + ]]> + + + most HTML tags may be used + ]]> + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/code_samples/live_templates/resources/liveTemplates/Markdown.xml b/code_samples/live_templates/resources/liveTemplates/Markdown.xml new file mode 100644 index 00000000000..c7788d82bfe --- /dev/null +++ b/code_samples/live_templates/resources/liveTemplates/Markdown.xml @@ -0,0 +1,9 @@ + + + \ No newline at end of file diff --git a/code_samples/live_templates/src/MarkdownContext.java b/code_samples/live_templates/src/MarkdownContext.java new file mode 100644 index 00000000000..4daf4df1a92 --- /dev/null +++ b/code_samples/live_templates/src/MarkdownContext.java @@ -0,0 +1,7 @@ +import com.intellij.codeInsight.template.TemplateContextType; + +/** + * Created by breandan on 1/11/2016. + */ +public class MarkdownContext extends TemplateContextType { +} diff --git a/code_samples/live_templates/src/MarkdownTemplateProvider.java b/code_samples/live_templates/src/MarkdownTemplateProvider.java new file mode 100644 index 00000000000..8926db4b15d --- /dev/null +++ b/code_samples/live_templates/src/MarkdownTemplateProvider.java @@ -0,0 +1,7 @@ +import com.intellij.codeInsight.template.impl.DefaultLiveTemplatesProvider; + +/** + * Created by breandan on 1/11/2016. + */ +public class MarkdownTemplateProvider implements DefaultLiveTemplatesProvider { +} diff --git a/tutorials/live_templates.md b/tutorials/live_templates.md new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tutorials/live_templates/template_support.md b/tutorials/live_templates/template_support.md new file mode 100644 index 00000000000..a97af669d19 --- /dev/null +++ b/tutorials/live_templates/template_support.md @@ -0,0 +1,36 @@ +--- +title: 1. Adding Live Template Support +--- + +## Template Creation + +Initially, you will need to [create a new Live Template](https://www.jetbrains.com/idea/help/creating-and-editing-live-templates.html#d1476224e158) from scratch. Add a new Template Group, "Markdown" and create a new Live Template under this group. Then give the template an abbreviation (ex. "[") and a description (ex. "New markdown link"). Paste the following snippet into the *Template text*: + +``` +[$TEXT$]($LINK$)$END$ +``` + +The variables `$TEXT$` and `$LINK$` may be further configured in the *Edit variables* dialogue, to reorder their precedence and bind to functions that will invoke auto-completion at the appropriate time, among many other [useful functions](https://www.jetbrains.com/idea/help/creating-and-editing-template-variables.html). Developers should become familiar with the provided functions before implementing any special functionality in a plugin, in case the desired feature is available as a [predefined function](https://www.jetbrains.com/idea/help/creating-and-editing-template-variables.html#predefined_functions). + +Finally, give your new Live Template an applicable context (ie. "Everywhere" or "Other"). + +## Export the Live Template + +Once confident the Live Template produces the expected result (consider testing it inside the current editor to minimize debugging later), export the Live Template (**File \| Export Settings \| ☑ Live Templates**). Unpack the resulting archive, and inside a directory `./templates/` there will be a file called `Markdown.xml` with the following contents: + +```xml + + + +``` + +Copy this file into your plugin's resources, (eg. `project/resource/liveTemplates/Markdown.xml`. + +## Implement DefaultLiveTemplatesProvider +