From 410c40f937acfc30c509547d7666673240a7ba24 Mon Sep 17 00:00:00 2001 From: JohnHake Date: Tue, 17 Mar 2020 18:38:07 -0700 Subject: [PATCH] Add title case macro docs IJSDK-698 --- live_templates/build.gradle | 5 +---- .../org/intellij/sdk/liveTemplates/TitleCaseMacro.java | 3 ++- live_templates/src/main/resources/META-INF/plugin.xml | 10 ++-------- .../src/main/resources/liveTemplates/Markdown.xml | 2 +- 4 files changed, 6 insertions(+), 14 deletions(-) diff --git a/live_templates/build.gradle b/live_templates/build.gradle index 8fb178b60..5ebac6956 100644 --- a/live_templates/build.gradle +++ b/live_templates/build.gradle @@ -16,12 +16,9 @@ repositories { // See https://github.com/JetBrains/gradle-intellij-plugin/ intellij { - version 'LATEST-EAP-SNAPSHOT' - - // Sets in plugin.xml + version '201-EAP-SNAPSHOT' sameSinceUntilBuild = true } patchPluginXml { - // Sets in plugin.xml version = project.version } \ No newline at end of file diff --git a/live_templates/src/main/java/org/intellij/sdk/liveTemplates/TitleCaseMacro.java b/live_templates/src/main/java/org/intellij/sdk/liveTemplates/TitleCaseMacro.java index 527261c80..0e384ca22 100644 --- a/live_templates/src/main/java/org/intellij/sdk/liveTemplates/TitleCaseMacro.java +++ b/live_templates/src/main/java/org/intellij/sdk/liveTemplates/TitleCaseMacro.java @@ -8,7 +8,6 @@ import com.intellij.openapi.util.text.StringUtil; import org.jetbrains.annotations.NotNull; public class TitleCaseMacro extends MacroBase { - public TitleCaseMacro() { super("titleCase", "titleCase(String)"); } @@ -22,9 +21,11 @@ public class TitleCaseMacro extends MacroBase { @Override protected Result calculateResult(@NotNull Expression[] params, ExpressionContext context, boolean quick) { + // Retrieve the text from the macro or selection, if any is available. String text = getTextResult(params, context, true); if (text != null) { if (text.length() > 0) { + // Capitalize the start of every word text = StringUtil.toTitleCase(text); } return new TextResult(text); diff --git a/live_templates/src/main/resources/META-INF/plugin.xml b/live_templates/src/main/resources/META-INF/plugin.xml index 86e64d89a..6d3e0fbbb 100644 --- a/live_templates/src/main/resources/META-INF/plugin.xml +++ b/live_templates/src/main/resources/META-INF/plugin.xml @@ -2,15 +2,12 @@ + org.intellij.sdk.liveTemplates SDK: Live Templates Sample Project - - - - com.intellij.modules.lang @@ -34,11 +31,8 @@ IntelliJ Platform SDK - - - + - diff --git a/live_templates/src/main/resources/liveTemplates/Markdown.xml b/live_templates/src/main/resources/liveTemplates/Markdown.xml index 779ff5509..991f6e3c4 100644 --- a/live_templates/src/main/resources/liveTemplates/Markdown.xml +++ b/live_templates/src/main/resources/liveTemplates/Markdown.xml @@ -15,7 +15,7 @@ description="SDK: Convert to title case" toReformat="true" toShortenFQNames="false"> - +