├── .gitignore ├── META-INF └── plugin.xml ├── README.md ├── doc └── Development.txt ├── generateReadme.groovy ├── generateTemplate.groovy ├── idea-ionic.iml ├── resources └── liveTemplates │ └── Ionic.xml └── src ├── com └── intellij │ └── plugin │ └── ionic │ └── IonicTemplatesProvider.java └── nl └── jworks └── generator └── Template.groovy /.gitignore: -------------------------------------------------------------------------------- 1 | out 2 | .idea 3 | -------------------------------------------------------------------------------- /META-INF/plugin.xml: -------------------------------------------------------------------------------- 1 | 2 | nl.jworks.intellij.ionic 3 | Ionic Framework 4 | 0.1 5 | Jworks 6 | 7 | Ionic Framework support for IntelliJ platform.

9 |

Ionic makes it incredibly easy to build beautiful and interactive mobile apps using HTML5 and AngularJS. 10 |
11 |

Documentation / list of snippets

12 |

Follow me on Twitter: @epragt

13 | ]]>
14 | 15 | 18 | 19 | 20 | 21 | 22 | 23 | 25 | com.intellij.modules.lang 26 | com.intellij.modules.platform 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 |
-------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Ionic Framework IntelliJ Plugin 2 | =============================== 3 | 4 | A plugin for the IntelliJ platform (IntelliJ IDEA, RubyMine, etc) that provides live templates for the Ionic Framework. You can install the plugin (named "Ionic Framework") from the plugins section inside your Jetbrains IDE. 5 | 6 | Feel free to let me know what else you want added via [issues](https://github.com/bodiam/idea-ionic/issues). 7 | 8 | Suggestions, feedback and other comments also welcome via [@epragt](https://twitter.com/epragt) on Twitter. 9 | 10 | ### Installation (in 3 easy steps) 11 | 12 | To install the plugin open your editor (IntelliJ) and hit: 13 | 14 | 1) `File > Settings > Plugins` and click on the `Browse repositories` button. 15 | 16 | 2) Look for `Ionic Framework` the right click and select `Download plugin`. 17 | 18 | 3) Finally hit the `Apply` button, agree to restart your IDE and you're all done! 19 | 20 | ### Usage 21 | 22 | To use the plugin, open an HTML file in the editor, and start typing `ion-`, followed by pressing CMD+J. A list of templates will show up. Alternatively, you can type e.g. `alert`, followed by CMD+J, to immediately show only the alert templates. 23 | 24 | ## What's new 25 | 26 | Since 0.1 (23 Feb 2015): 27 | 28 | Initial release with basic functionality. 29 | 30 | - ion-headers 31 | 32 | ### License 33 | 34 | Ionic Framework - IntelliJ Plugin is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT). 35 | -------------------------------------------------------------------------------- /doc/Development.txt: -------------------------------------------------------------------------------- 1 | Templates can be found here: 2 | 3 | cd ~/Library/Preferences/IntelliJIdea13/templates/ -------------------------------------------------------------------------------- /generateReadme.groovy: -------------------------------------------------------------------------------- 1 | @Grapes( 2 | @Grab(group='com.google.guava', module='guava', version='18.0') 3 | ) 4 | import com.google.common.base.CaseFormat 5 | 6 | def file = new File("resources/liveTemplates/Bootstrap3.xml") 7 | def root = new XmlParser().parse(file) 8 | 9 | def templates = root.template 10 | 11 | def components = templates.collect { 12 | new Component(text:it.'@description', code: it.'@name', context:findMainContext(it)) 13 | } 14 | 15 | def sorted = components.sort { it.code } 16 | def groups = splitInGroups(sorted) 17 | 18 | printToc(groups) 19 | printComponents(groups) 20 | 21 | 22 | 23 | 24 | void printToc(groups) { 25 | groups.each { 26 | println "- [${it.name}](#${CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, it.name)})" 27 | } 28 | } 29 | 30 | void printComponents(groups) { 31 | groups.each { group -> 32 | println "" 33 | println "### ${group.name}" 34 | println "" 35 | println "| Component | Snippet code | Context |" 36 | println "|------------------------------- | -------------------------------| ------- |" 37 | 38 | group.components.each { 39 | println "| ${String.format("%-30s", it.text)} | ${String.format("%-30s", it.code)} | ${String.format("%-7s", it.context)} |" 40 | } 41 | } 42 | } 43 | 44 | def findMainContext(template) { 45 | template.context.option.'@name'.contains('HTML') ? "HTML" : "CSS" 46 | } 47 | 48 | private List splitInGroups(components) { 49 | def groups = [] 50 | Group lastGroup = null 51 | 52 | components.each { component -> 53 | def groupName = component.code.split(':')[0][4..-1].capitalize() 54 | def group = new Group(name:groupName) 55 | 56 | if(lastGroup == null || group.name != lastGroup.name) { 57 | lastGroup = new Group(name:groupName) 58 | groups << lastGroup 59 | } 60 | 61 | lastGroup.components.add(component) 62 | } 63 | 64 | return groups 65 | } 66 | 67 | class Group { 68 | String name 69 | List components = [] 70 | } 71 | 72 | class Component { 73 | String text, code, context 74 | 75 | String getText() { 76 | text ?: 'No description' 77 | } 78 | } -------------------------------------------------------------------------------- /generateTemplate.groovy: -------------------------------------------------------------------------------- 1 | import nl.jworks.generator.Template 2 | 3 | def colors = [ 4 | "light", // light grey 5 | "stable", // grey 6 | "positive", // blue 7 | "calm", // cyan 8 | "balanced", // green 9 | "energized", // yellow 10 | "assertive", // red 11 | "royal", // purple 12 | "dark" // black 13 | ] 14 | 15 | def headers = colors.collect { color -> 16 | new Template("ion-header:$color", "Header which is fixed at top of the screen ($color)", "
\n" + "

\$title\$

\n" + "
", ["title"]) 17 | } 18 | def subheader = new Template("ion-subheader", "A secondary header bar can be placed below the original header bar.", "
\n" + "

Sub Header

\n" + "
") 19 | 20 | def footers = colors.collect { color -> 21 | new Template("ion-footer:$color", "Footers are regions at the bottom of a screen that can contain various types of content. ($color)", "
\n" + "
\$title\$
\n" + "
", ["title"]) 22 | } 23 | 24 | def button = new Template("ion-button", "It's a button", "") 25 | 26 | def buttons = colors.collect { color -> 27 | new Template("ion-button:$color", "A button ($color)", "", ["title"]) 28 | } 29 | 30 | def blockButtons = colors.collect { color -> 31 | new Template("ion-block-button:$color", "A button with display:block style ($color)", "", ["title"]) 32 | } 33 | 34 | def fullWidthBlockButtons = colors.collect { color -> 35 | new Template("ion-full-width-block-button:$color", "A button with display:block style without borders ($color)", "", ["title"]) 36 | } 37 | 38 | def smallButtons = colors.collect { color -> 39 | new Template("ion-small-button:$color", "A smaller button ($color)", "", ["title"]) 40 | } 41 | 42 | def largeButtons = colors.collect { color -> 43 | new Template("ion-big-button:$color", "A larger button ($color)", "", ["title"]) 44 | } 45 | 46 | def outlinedButtons = colors.collect { color -> 47 | new Template("ion-outline-button:$color", "A button with outline style, which also has a transparent background ($color)", "", ["title"]) 48 | } 49 | 50 | def clearButtons = colors.collect { color -> 51 | new Template("ion-clear-button:$color", "A button without border ($color)", "", ["title"]) 52 | } 53 | 54 | def iconButtons = null // TODO 55 | 56 | def clearHeaderButtons = new Template("ion-clear-header-buttons", "A header with clear buttons", "
\n" + " \n" + "
Header Buttons
\n" + " \n" + "
") 57 | 58 | 59 | //def buttonBar = new Template("ion-button-bar", "A button bar", "
\n" + " \n" + "
Header Buttons
\n" + " \n" + "
") 60 | //def buttonBarColors = new Template("ion-button-bar", "A button bar", "
\n" + " \n" + "
Header Buttons
\n" + " \n" + "
") 61 | 62 | 63 | 64 | 65 | def templates = [headers, subheader, footers, button, buttons, blockButtons, fullWidthBlockButtons, smallButtons, largeButtons, 66 | outlinedButtons, clearButtons, clearHeaderButtons].flatten() 67 | 68 | 69 | def template = """ 70 | ${templates.join("\n")} 71 | """ 72 | 73 | 74 | new File("resources/liveTemplates/Ionic.xml").text = template 75 | 76 | 77 | -------------------------------------------------------------------------------- /idea-ionic.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /resources/liveTemplates/Ionic.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 16 | 23 | 30 | 37 | 44 | 51 | 58 | 65 | 72 | 79 | 86 | 93 | 100 | 107 | 114 | 121 | 128 | 135 | 142 | 149 | 156 | 163 | 170 | 177 | 184 | 191 | 198 | 205 | 212 | 219 | 226 | 233 | 240 | 247 | 254 | 261 | 268 | 275 | 282 | 289 | 296 | 303 | 310 | 317 | 324 | 331 | 338 | 345 | 352 | 359 | 366 | 373 | 380 | 387 | 394 | 401 | 408 | 415 | 422 | 429 | 436 | 443 | 450 | 457 | 464 | 471 | 478 | 485 | 492 | 499 | 506 | 513 | 520 | 527 | 534 | 541 | 548 | 555 | 562 | 569 | 576 | 583 | -------------------------------------------------------------------------------- /src/com/intellij/plugin/ionic/IonicTemplatesProvider.java: -------------------------------------------------------------------------------- 1 | package com.intellij.plugin.ionic; 2 | 3 | import com.intellij.codeInsight.template.impl.DefaultLiveTemplatesProvider; 4 | import org.jetbrains.annotations.Nullable; 5 | 6 | /** 7 | * @author Erik Pragt 8 | */ 9 | public class IonicTemplatesProvider implements DefaultLiveTemplatesProvider { 10 | @Override 11 | public String[] getDefaultLiveTemplateFiles() { 12 | return new String[]{ 13 | "liveTemplates/Ionic" 14 | }; 15 | } 16 | 17 | @Nullable 18 | @Override 19 | public String[] getHiddenLiveTemplateFiles() { 20 | return null; 21 | } 22 | } 23 | 24 | 25 | -------------------------------------------------------------------------------- /src/nl/jworks/generator/Template.groovy: -------------------------------------------------------------------------------- 1 | package nl.jworks.generator 2 | 3 | import groovy.xml.XmlUtil 4 | 5 | class Template { 6 | String name, value, description 7 | boolean reformat, shortenFQNames 8 | List contexts, variables 9 | 10 | Template(name, description, value, variables = [], reformat = true, shortenFQNames = false, contexts = ["HTML_TEXT, HTML"]) { 11 | this.name = name 12 | this.description = description 13 | this.value = XmlUtil.escapeXml(value).replaceAll("\n"," ") 14 | this.reformat = reformat 15 | this.variables = variables 16 | this.shortenFQNames = shortenFQNames 17 | this.contexts = contexts 18 | } 19 | 20 | String toString() { 21 | String variables = variables.collect { var -> "" }.join("\n") 22 | 23 | """""" 30 | } 31 | } 32 | --------------------------------------------------------------------------------