forked from JetBrains/intellij-sdk-docs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
breandan
committed
Jan 12, 2016
1 parent
c12a758
commit 026d72a
Showing
10 changed files
with
134 additions
and
0 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<module type="PLUGIN_MODULE" version="4"> | ||
<component name="DevKit.ModuleBuildProperties" url="file://$MODULE_DIR$/resources/META-INF/plugin.xml" /> | ||
<component name="NewModuleRootManager" inherit-compiler-output="true"> | ||
<exclude-output /> | ||
<content url="file://$MODULE_DIR$"> | ||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" /> | ||
<sourceFolder url="file://$MODULE_DIR$/resources" type="java-resource" /> | ||
</content> | ||
<orderEntry type="inheritedJdk" /> | ||
<orderEntry type="sourceFolder" forTests="false" /> | ||
</component> | ||
</module> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<idea-plugin version="2"> | ||
<id>com.your.company.unique.plugin.id</id> | ||
<name>Plugin display name here</name> | ||
<version>1.0</version> | ||
<vendor email="[email protected]" url="http://www.yourcompany.com">YourCompany</vendor> | ||
|
||
<description><![CDATA[ | ||
Enter short description for your plugin here.<br> | ||
<em>most HTML tags may be used</em> | ||
]]></description> | ||
|
||
<change-notes><![CDATA[ | ||
Add change notes here.<br> | ||
<em>most HTML tags may be used</em> | ||
]]> | ||
</change-notes> | ||
|
||
<!-- please see http://www.jetbrains.org/intellij/sdk/docs/basics/getting_started/build_number_ranges.html for description --> | ||
<idea-version since-build="141.0"/> | ||
|
||
<!-- please see http://www.jetbrains.org/intellij/sdk/docs/basics/getting_started/plugin_compatibility.html | ||
on how to target different products --> | ||
<!-- uncomment to enable plugin in all products | ||
<depends>com.intellij.modules.lang</depends> | ||
--> | ||
|
||
<extensions defaultExtensionNs="com.intellij"> | ||
<!-- Add your extensions here --> | ||
</extensions> | ||
|
||
<actions> | ||
<!-- Add your actions here --> | ||
</actions> | ||
|
||
</idea-plugin> |
9 changes: 9 additions & 0 deletions
9
code_samples/live_templates/resources/liveTemplates/Markdown.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<templateSet group="Markdown"> | ||
<template name="[" value="[$TEXT$]($LINK$)$END$" description="New link reference." toReformat="false" toShortenFQNames="false"> | ||
<variable name="TEXT" expression="" defaultValue="" alwaysStopAt="true" /> | ||
<variable name="LINK" expression="complete()" defaultValue="" alwaysStopAt="true" /> | ||
<context> | ||
<option name="MARKDOWN" value="true" /> | ||
</context> | ||
</template> | ||
</templateSet> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import com.intellij.codeInsight.template.TemplateContextType; | ||
|
||
/** | ||
* Created by breandan on 1/11/2016. | ||
*/ | ||
public class MarkdownContext extends TemplateContextType { | ||
} |
7 changes: 7 additions & 0 deletions
7
code_samples/live_templates/src/MarkdownTemplateProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import com.intellij.codeInsight.template.impl.DefaultLiveTemplatesProvider; | ||
|
||
/** | ||
* Created by breandan on 1/11/2016. | ||
*/ | ||
public class MarkdownTemplateProvider implements DefaultLiveTemplatesProvider { | ||
} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
<templateSet group="Markdown"> | ||
<template name="[" value="[$TEXT$]($LINK$)$END$" description="New link reference." toReformat="false" toShortenFQNames="false"> | ||
<variable name="TEXT" expression="" defaultValue="" alwaysStopAt="true" /> | ||
<variable name="LINK" expression="complete()" defaultValue="" alwaysStopAt="true" /> | ||
<context> | ||
<option name="OTHER" value="true" /> | ||
</context> | ||
</template> | ||
</templateSet> | ||
``` | ||
|
||
Copy this file into your plugin's resources, (eg. `project/resource/liveTemplates/Markdown.xml`. | ||
|
||
## Implement DefaultLiveTemplatesProvider | ||
|