Giter Club home page Giter Club logo

intellij-postfix-templates's Introduction

Custom Postfix Templates for Intellij IDEA

Custom Postfix Templates is an Intellij IDEA plugin that allows you to define your own custom postfix completion templates. At the moment it supports the following programming languages with : Java, Scala, SQL, PHP, Go, Groovy, Python, LaTeX, Kotlin (untyped templates), Dart (untyped templates), JavaScript (untyped templates), and Rust (untyped templates).

So what is the difference to IDEA's postfix templates?

Since IDEA 2018 you are now able to define your own postfix templates in the settings UI (Editor → General → Postfix Templates). However, this is a pretty new feature and it's less functional than this plugin. Here are some of the advantages of this plugin:

  • You can define different template rules for the same template name, e.g. .toList should behave differently for arrays and for sets.
  • You can use template variables (e.g. $varName$) which are filled by the user while applying the template.
  • You can use live template macros to automatically fill some of the template variables (e.g. $var:suggestVariableName()$) as well as you can define default values.
  • You can restrict the availability of templates or template rules to the availability of certain classes or libraries (e.g. expand "test".val to val s = "test" if Lombok is available).
  • It allows you to use static imports instead of class imports (e.g. array.toList can be expanded to asList(array) instead of Arrays.asList(array) if you add [USE_STATIC_IMPORTS] to the rule).
  • It comes with more than 500 editable postfix templates with more than 700 template rules, e.g.
    • string.toIntInteger.parse(string)
    • array.toListArrays.asList(array)
    • file.linesFiles.readAllLines(file.toPath(), Charset.forName("UTF-8"))
    • file.getName().valfinal String name = file.getName();
  • The text based format for defining your templates allows you to easily share them via copy and paste.

Screencast

Screen Cast

Download

You can download the plugin Custom Postfix Templates via Settings → Plugins → Browse Repositories.

Usage

The plugin comes with a predefined set of templates for Java and Scala (see below) which can be immediatly applied in Java/Scala files. For instance, write

"1".toInt

in a Java file. If the completion popup does not automatically show up, press Ctrl+SPACE. Select the .toInt template and see how it is expanded.

And if you want to see the template definition, just press Alt+ENTER in the completiion popup and select Edit '.toInt' template.

Kinds of template files

There are three different types of template files:

  • User template files: use them to define your own templates and/or override local or web template rules
  • Local template files: loaded from the local file system, read-only, and updated automatically when an IDEA project is opened
  • Web template files: loaded from the web, read-only, and updated automatically once a day

Order of template files/rules

Template rules are applied in a first-come-first-serve manner, i.e., more specific rules/files should be placed above more general rules/files. Reorder files in the tree by selecting them and by using the up/down buttons.

Predefined web templates files

The plugin comes with a set of so-called "web template files" which provide in total more than 200 useful templates. While web template files are read-only and shall not be edited by the user because of automatic updates, you can still edit or deactivate templates of these files.

To change or deactivate a predefined template you just have to start the template name completion with Ctrl+Space and then press ALT+Enter and select the third item (Edit .TEMPLATE_NAME template). The corresponding web template file is opened and you see the definition of the template rule. Since you cannot this template file directly you have to override the template rule by pressing Alt+Enter and selecting Override template rule. This overriding works in a way that your template rule needs to be loaded before the predefined template gets loaded. This is done by adding your rule to a user template file which is placed above the predefined web template file in the plugin settings. In case that you don't have a user template file which is loaded before, you are offered to create one. After you selected an existing user template or created a new one the template rule to override is automatically added to this file and you can start adapting it. To deactivate a template rule, replace the rigth side of the rule with [SKIP].

Edit the templates

Press Shift+Alt+P (or go to menu Tools → Custom Postfix Templates → Edit Templates of Current Language) to open the custom postfix templates for the programming language in your current editor. Here you can easily change, remove, or add new templates matching your needs. Note that you have to save the template file explicitly (via Ctrl+S) in order to update the postfix templates in the IDE.

Template definitions

The file may contain multiple template definitions of the form:

.TEMPLATE_NAME : TEMPLATE_DESCRIPTION
    TEMPLATE_RULE1
    TEMPLATE_RULE2
    ...

Each template definition consists of a template name, a template description and an arbitrary number of template rules. The template name is used as key in the code completion and the template description is shown as hint in the code completion popup. The template rules define on which types the template can be applied and how the application is performed.

Simple template rules

A simple template rule has the form

    MATCHING_TYPE  →  TEMPLATE_CODE

whereas

  • MATCHING_TYPE defines the type the template can be applied to, and
  • TEMPLATE_CODE defines how the template is applied (how the expression is replaced).

MATCHING_TYPE

The options for MATCHING_TYPE may differ from programming language to programming language:

  • In Java the MATCHING_TYPE can be either a Java class name or one of the following special types:
    • ANY - any expression
    • VOID - any void expression
    • NON_VOID - any non-void expression
    • ARRAY - any Java array
    • BOOLEAN - boxed or unboxed boolean expressions
    • ITERABLE_OR_ARRAY - any iterable or array
    • NOT_PRIMITIVE - any non-primitive value
    • NUMBER - any boxed or unboxed number
    • BYTE - a boxed or unboxed byte value
    • SHORT - a boxed or unboxed short value
    • CHAR - a boxed or unboxed char value
    • INT - a boxed or unboxed int value
    • LONG - a boxed or unboxed long value
    • FLOAT - a boxed or unboxed float value
    • DOUBLE - a boxed or unboxed double value
    • NUMBER_LITERAL - any number literal
    • BYTE_LITERAL - a byte literal
    • SHORT_LITERAL - a short literal
    • CHAR_LITERAL - a char literal
    • INT_LITERAL - an int literal
    • LONG_LITERAL - a long literal
    • FLOAT_LITERAL - a float literal
    • DOUBLE_LITERAL - a double literal
    • STRING_LITERAL - a String literal
    • CLASS - any class reference
  • In Scala the MATCHING_TYPE can be either a Java class name or one of the following special types:
    • ANY - any expression
    • VOID - any void (Unit) expression
    • NON_VOID - any non-void (non-Unit) expression
    • BOOLEAN - scala.Boolean or java.lang.Boolean
    • NUMBER - any Scala or Java number value
    • BYTE - scala.Byte or java.lang.Byte
    • SHORT - scala.Short or java.lang.Short
    • CHAR - scala.Char or java.lang.Char
    • INT - scala.Int or java.lang.Integer
    • LONG - scala.Long or java.lang.Long
    • FLOAT - scala.Float or java.lang.Float
    • DOUBLE - scala.Double or java.lang.Double
  • In SQL the MATCHING_TYPE can be either a Java class name or one of the following special types:
    • ANY - any expression
    • UNKNOWN - unknown expression
    • DEFAULT - ?
    • INTEGER - integer expression
    • REAL - real expression
    • STRING - string expression
    • BOOLEAN - boolean expression
    • DATE_TIME - date-time expression
    • DATE - date expression
    • TIME - time expression
    • TIMESTAMP - timestamp expression
    • INTERVAL - interval expression
    • BYTES - bytes expression
    • REFERENCE - ?
    • ARRAY - array expression
    • COLLECTION - collection expression
    • TABLE - table reference
    • RECORD - ?
    • SETO - ?
  • In PHP the MATCHING_TYPE can be either a PHP class name or one of the following special types:
    • ANY - any expression
    • empty
    • null
    • string
    • boolean
    • int
    • float
    • object
    • callable
    • resource
    • array
    • iterable
    • number
    • void
    • unset
    • static
    • \Closure
    • \Exception
    • \Throwable
  • In Go the MATCHING_TYPE can be one of the following special types:
    • ANY - any expression
    • ARRAY - any array
    • BOOLEAN - any boolean expression
    • STRING - any string expression
    • INT - any integer expression
    • INT64 - any 64 bit integer expression
    • UINT - any unsigned integer expression
    • FLOAT - any floating point expression
    • FLOAT32 - any 32 bit floating point expression
    • FLOAT64 - any 64 bit floating point expression
    • BYTESLICE - any byte slice expression
    • ERROR - any error expression
    • COMPLEX - ???
    • NIL - any expression of type Nil
  • In Groovy the MATCHING_TYPE can be either a Java/Groovy class name or one of the following special types:
    • ANY - any expression
    • ARRAY - any Java array
    • BOOLEAN - boxed or unboxed boolean expressions
    • ITERABLE_OR_ARRAY - any iterable or array
    • NUMBER - any boxed or unboxed number
    • BYTE - a boxed or unboxed byte value
    • SHORT - a boxed or unboxed short value
    • CHAR - a boxed or unboxed char value
    • INT - a boxed or unboxed int value
    • LONG - a boxed or unboxed long value
    • FLOAT - a boxed or unboxed float value
    • DOUBLE - a boxed or unboxed double value
    • CLASS - any class reference
  • In Python the MATCHING_TYPE can be one of the following special types:
    • ANY - any expression
      • object
      • list
      • dict
      • set
      • tuple
      • int
      • float
      • complex
      • str
      • unicode
      • bytes
      • bool
      • classmethod
      • staticmethod
      • type
  • In Kotlin the MATCHING_TYPE has to be ANY.
  • In Dart the MATCHING_TYPE has to be ANY.
  • In JavaScript the MATCHING_TYPE has to be ANY.
  • In Rust the MATCHING_TYPE has to be ANY
  • In Latex the MATCHING_TYPE can be one of the following types:
    • ANY - any expression in any context
    • TEXT - any expression that is not within a math environment
    • MATH - any expression that is within a math environment

TEMPLATE_CODE

The TEMPLATE_CODE can be any text which may also contain template variables used as placeholder.

  • Simple template variables have the format $NAME$.
  • The following template variables have a special meaning:
    • $expr$ - the expression the template shall be applied to
    • $END$ - the final cursor position after the template application
  • All other variables will be replaced interactively during the template expansion.
  • If you want to change the order of variables, set default values or use live template macros for filling the variables automatically, you can use the following variable format:
    $NAME#NO:EXPRESSION:DEFAULT_VALUE$
    
    • NAME - name of the variable; use a * at the end of the name to skip user interaction
    • NO (optional) - number of the variable (defining in which order the variables are expanded)
    • EXPRESSION (optional) - a live template macro used to generate a replacement (e.g. suggestVariableName())
    • DEFAULT_VALUE (optional) - a default value that may be used by the macro
  • If you want to create multi-line templates you can use a backslash (\) at the end of a line to indicate that the template code continues at the next line.

Template Examples

  • Artificial example showing variable reordering, variable reusage, interaction skipping, macros, and default values:
    .test : test
        NON_VOID → "$user*#1:user()$: $second#3:className()$ + $first#2::"1st"$ + $first$" + $expr$
    
  • Real world example: Write a variable to the debug log, including the developer name, the class name, and method name:
    .logd : log a variable
        NON_VOID → Log.d("$user*:user():"MyTag"$", "$className*:className()$ :: $methodName*:methodName()$): $expr$="+$expr$);
    
  • Multi-line template:
    .for : iterate over ...
        ITERABLE_OR_ARRAY → for ($ELEMENT_TYPE:iterableComponentType(expr):"java.lang.Object"$ $VAR:suggestVariableName()$ : $expr$) {\
          $END$\
        }
    

While writing the templates you can use the code completion for completing class names, variable names, template macros and arrows (→).

Advanced template rules

In the chapter above some options have been omitted for simplicity. If you need more functionality here is the full format of template rules including two optional parameters:

    MATCHING_TYPE [REQUIRED_CLASS]  →  TEMPLATE_CODE [FLAG]
  • REQUIRED_CLASS (optional) is a name of a class that needs to be available in the module to activate the template rule (see next section for a detailed explaination)
  • FLAG (optional) can be one of the following flags:
    • SKIP - skips the rule
    • USE_STATIC_IMPORTS - adds static method imports automatically if possible (Java only)
    • IMPORT ... - adds an import to the file header (Scala only)

Writing library specific template rules via REQUIRED_CLASS

Sometimes you may want to write library specific template rules, i.e. rules that shall be only applied when a certain library is included in the project. For instance, take a look at the .val template provided with this plugin:

.val : extract as value
	NON_VOID [lombok.val]    →  val $var:suggestVariableName()$ = $expr$;
	NON_VOID                 →  final $type*:expressionType(expr))$ $var:suggestVariableName()$ = $expr$;

It can be applied to any non-void expression and expands either to

val myVar = myExpression;

if lombok is available, or to

final MyType myVar = myExpression;

if you're using Java without lombok.

In this exmaple template the [lombok.val] part after the matching type is used to restrict the rule appliction to those cases where the class lombok.val is available in the class path.

In general you can use any class name between the square brackets you want to define a restriction on.

FLAGs

SKIP

You can use the [SKIP] flag for deactivating the template rule for a given matching type.

Example:

.sort : sort naturally
	de.endrullis.lazyseq.LazySeq  →  [SKIP]
	java.util.List                →  java.util.Collections.sort($expr$)

In this example a postfix template .sort is defined. The first rule tells the plugin that there shall be no completition for expressions of type LazySeq. The second rule defines how List expressions shall be completed.

USE_STATIC_IMPORTS

If you tag a template rule for Java with [USE_STATIC_IMPORTS] all static methods that are used will be automatically imported and your code gets more compact. For instance, lets take the following template rule:

.toList : convert to List
	ARRAY  →  java.util.Arrays.asList($expr$) [USE_STATIC_IMPORTS]

Since the rule is tagged with [USE_STATIC_IMPORTS] expanding of array.toList does not lead to Arrays.asList(array) but to asList(array) and the following line is added to your import statements:

import static java.util.Arrays.asList;
IMPORT

If you tag a template rule for Scala with [IMPORT FULLY_QUALIFIED_CLASSNAME] the given class (or method) import is automatically added to the file header when the template gets applied:

.printStream : get PrintStream
	java.io.File  →  new PrintStream($expr$)   [IMPORT java.io.PrintStream]

Note that you can use the IMPORT flag multiple times.

Update templates and open plugin settings

Go to Settings → Editor → Custom Postfix Templates or Tools → Custom Postfix Templates → Open Settings / Upgrade Templates. There you can chose between two different lambda styles and check/uncheck the template files you want to enable/disable.

Contribute

Any contributions are welcome. Just fork the project, make your changes and create a pull request.

Here are some guides:

See also

intellij-postfix-templates's People

Contributors

1bytee avatar alshain avatar bystroushaak avatar cassiuscai avatar cnfn avatar edge790 avatar fishermans avatar fnsne avatar foso avatar gejun123456 avatar goodwinnk avatar ikopysov avatar induwarabas avatar jimytc avatar maksimr avatar martin-tarjanyi avatar nachtalb avatar philipgriggs avatar remorsecs avatar tldzyx avatar xylo avatar ytyubox avatar zacsweers avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

intellij-postfix-templates's Issues

Apply to function

I'd like to use the tool to refactor method. For example, annotate with custom annotation with a value taken from method. Is there a way to do it?

Wrong format and postfix in JavaScript and typescript

I write a template in JavaScript(which also applies for typescript)

.forPost : for of in postfix templates
    ANY  →  ( let item of $expr$ ){ }

[].forPost

in ts file:

result:(note the trailing,which is wrong)

(let
item;
of [];
)
{
}

in js file (note the format )

(let
item
of []
)
{
}

Read access is allowed from event dispatch thread or inside read-action only

Read access is allowed from event dispatch thread or inside read-action only (see com.intellij.openapi.application.Application.runReadAction())
Details: Current thread: Thread[ApplicationImpl pooled thread 10,4,main] 1370032623
; dispatch thread: false; isDispatchThread(): false
SystemEventQueueThread: Thread[AWT-EventQueue-0 2017.2.3#IU-172.3968.1 IDEA, eap:true, os:Linux 4.12.7-1-manjaro, java-version:JetBrains s.r.o 1.8.0_152-release-915-b10,6,main] 1441282274
java.lang.Throwable
	at com.intellij.openapi.diagnostic.Logger.error(Logger.java:150)
	at com.intellij.openapi.application.impl.ApplicationImpl.assertReadAccessAllowed(ApplicationImpl.java:1075)
	at com.intellij.psi.impl.file.impl.FileManagerImpl.findFile(FileManagerImpl.java:397)
	at com.intellij.psi.impl.PsiManagerImpl.findFile(PsiManagerImpl.java:188)
	at de.endrullis.idea.postfixtemplates.templates.CustomPostfixTemplateProvider.loadTemplatesFrom(CustomPostfixTemplateProvider.java:134)
	at de.endrullis.idea.postfixtemplates.templates.CustomPostfixTemplateProvider.loadTemplatesFrom(CustomPostfixTemplateProvider.java:117)
	at de.endrullis.idea.postfixtemplates.templates.CustomPostfixTemplateProvider.lambda$reloadTemplates$0(CustomPostfixTemplateProvider.java:103)
	at java.util.Optional.ifPresent(Optional.java:159)
	at de.endrullis.idea.postfixtemplates.templates.CustomPostfixTemplateProvider.reloadTemplates(CustomPostfixTemplateProvider.java:101)
	at de.endrullis.idea.postfixtemplates.templates.CustomPostfixTemplateProvider.reload(CustomPostfixTemplateProvider.java:93)
	at de.endrullis.idea.postfixtemplates.templates.CustomPostfixTemplateProvider.<init>(CustomPostfixTemplateProvider.java:84)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
	at org.picocontainer.defaults.InstantiatingComponentAdapter.newInstance(InstantiatingComponentAdapter.java:193)
	at com.intellij.util.pico.CachingConstructorInjectionComponentAdapter.doGetComponentInstance(CachingConstructorInjectionComponentAdapter.java:103)
	at com.intellij.util.pico.CachingConstructorInjectionComponentAdapter.instantiateGuarded(CachingConstructorInjectionComponentAdapter.java:80)
	at com.intellij.util.pico.CachingConstructorInjectionComponentAdapter.getComponentInstance(CachingConstructorInjectionComponentAdapter.java:63)
	at com.intellij.openapi.extensions.AbstractExtensionPointBean.instantiate(AbstractExtensionPointBean.java:75)
	at com.intellij.openapi.extensions.CustomLoadingExtensionPointBean.instantiateExtension(CustomLoadingExtensionPointBean.java:47)
	at com.intellij.lang.LanguageExtensionPoint.access$000(LanguageExtensionPoint.java:28)
	at com.intellij.lang.LanguageExtensionPoint$1.compute(LanguageExtensionPoint.java:42)
	at com.intellij.openapi.util.NotNullLazyValue.getValue(NotNullLazyValue.java:39)
	at com.intellij.lang.LanguageExtensionPoint.getInstance(LanguageExtensionPoint.java:53)
	at com.intellij.codeInsight.template.postfix.settings.PostfixTemplatesConfigurable.<init>(PostfixTemplatesConfigurable.java:88)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
	at org.picocontainer.defaults.InstantiatingComponentAdapter.newInstance(InstantiatingComponentAdapter.java:193)
	at com.intellij.util.pico.CachingConstructorInjectionComponentAdapter.doGetComponentInstance(CachingConstructorInjectionComponentAdapter.java:103)
	at com.intellij.util.pico.CachingConstructorInjectionComponentAdapter.instantiateGuarded(CachingConstructorInjectionComponentAdapter.java:80)
	at com.intellij.util.pico.CachingConstructorInjectionComponentAdapter.getComponentInstance(CachingConstructorInjectionComponentAdapter.java:63)
	at com.intellij.openapi.extensions.AbstractExtensionPointBean.instantiate(AbstractExtensionPointBean.java:75)
	at com.intellij.openapi.options.ConfigurableEP$ClassProducer.createElement(ConfigurableEP.java:341)
	at com.intellij.openapi.options.ConfigurableEP.createConfigurable(ConfigurableEP.java:267)
	at com.intellij.openapi.options.ex.ConfigurableWrapper.a(ConfigurableWrapper.java:58)
	at com.intellij.openapi.options.ex.ConfigurableWrapper.getConfigurable(ConfigurableWrapper.java:117)
	at com.intellij.openapi.options.ex.ConfigurableWrapper.cast(ConfigurableWrapper.java:98)
	at com.intellij.openapi.options.ex.ConfigurableCardPanel.prepare(ConfigurableCardPanel.java:42)
	at com.intellij.openapi.options.ex.ConfigurableCardPanel.prepare(ConfigurableCardPanel.java:35)
	at com.intellij.ui.CardLayoutPanel.a(CardLayoutPanel.java:128)
	at com.intellij.openapi.application.impl.ApplicationImpl$2.run(ApplicationImpl.java:342)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)

NoClassDefFoundError: com/intellij/openapi/vfs/VirtualFileContentsChangedAdapter

java.lang.NoClassDefFoundError: com/intellij/openapi/vfs/VirtualFileContentsChangedAdapter
	at java.lang.ClassLoader.defineClass1(Native Method)
	at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
	at java.lang.ClassLoader.defineClass(ClassLoader.java:642)
	at com.intellij.util.lang.UrlClassLoader._defineClass(UrlClassLoader.java:272)
	at com.intellij.util.lang.UrlClassLoader.defineClass(UrlClassLoader.java:268)
	at com.intellij.util.lang.UrlClassLoader._findClass(UrlClassLoader.java:237)
	at com.intellij.ide.plugins.cl.PluginClassLoader.loadClassInsideSelf(PluginClassLoader.java:119)
	at com.intellij.ide.plugins.cl.PluginClassLoader.tryLoadingClass(PluginClassLoader.java:73)
	at com.intellij.ide.plugins.cl.PluginClassLoader.loadClass(PluginClassLoader.java:62)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
	at de.endrullis.idea.postfixtemplates.templates.CustomPostfixTemplateProvider.<init>(CustomPostfixTemplateProvider.java:62)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
	at org.picocontainer.defaults.InstantiatingComponentAdapter.newInstance(InstantiatingComponentAdapter.java:193)
	at org.picocontainer.defaults.ConstructorInjectionComponentAdapter$1.run(ConstructorInjectionComponentAdapter.java:220)
	at org.picocontainer.defaults.ThreadLocalCyclicDependencyGuard.observe(ThreadLocalCyclicDependencyGuard.java:53)
	at org.picocontainer.defaults.ConstructorInjectionComponentAdapter.getComponentInstance(ConstructorInjectionComponentAdapter.java:248)
	at com.intellij.util.pico.CachingConstructorInjectionComponentAdapter.getComponentInstance(CachingConstructorInjectionComponentAdapter.java:58)
	at com.intellij.openapi.extensions.AbstractExtensionPointBean.instantiate(AbstractExtensionPointBean.java:75)
	at com.intellij.openapi.extensions.AbstractExtensionPointBean.instantiate(AbstractExtensionPointBean.java:68)
	at com.intellij.openapi.extensions.AbstractExtensionPointBean.instantiate(AbstractExtensionPointBean.java:63)
	at com.intellij.openapi.extensions.CustomLoadingExtensionPointBean.instantiateExtension(CustomLoadingExtensionPointBean.java:47)
	at com.intellij.lang.LanguageExtensionPoint.access$000(LanguageExtensionPoint.java:28)
	at com.intellij.lang.LanguageExtensionPoint$1.compute(LanguageExtensionPoint.java:42)
	at com.intellij.openapi.util.NotNullLazyValue.getValue(NotNullLazyValue.java:39)
	at com.intellij.lang.LanguageExtensionPoint.getInstance(LanguageExtensionPoint.java:53)
	at com.intellij.openapi.util.KeyedExtensionCollector.buildExtensions(KeyedExtensionCollector.java:155)
	at com.intellij.openapi.util.KeyedExtensionCollector.buildExtensions(KeyedExtensionCollector.java:128)
	at com.intellij.codeInsight.template.postfix.templates.LanguagePostfixTemplate.buildExtensions(LanguagePostfixTemplate.java:42)
	at com.intellij.codeInsight.template.postfix.templates.LanguagePostfixTemplate.buildExtensions(LanguagePostfixTemplate.java:28)
	at com.intellij.openapi.util.KeyedExtensionCollector.forKey(KeyedExtensionCollector.java:116)
	at com.intellij.lang.LanguageExtension.allForLanguage(LanguageExtension.java:75)
	at com.intellij.codeInsight.template.postfix.templates.PostfixLiveTemplate.isApplicable(PostfixLiveTemplate.java:165)
	at com.intellij.codeInsight.template.impl.TemplateManagerImpl.isApplicable(TemplateManagerImpl.java:300)
	at com.intellij.codeInsight.template.impl.TemplateManagerImpl.listApplicableCustomTemplates(TemplateManagerImpl.java:556)
	at com.intellij.codeInsight.template.impl.LiveTemplateCompletionContributor.ensureTemplatesShown(LiveTemplateCompletionContributor.java:151)
	at com.intellij.codeInsight.template.impl.LiveTemplateCompletionContributor.access$100(LiveTemplateCompletionContributor.java:50)
	at com.intellij.codeInsight.template.impl.LiveTemplateCompletionContributor$2.lambda$addCompletions$0(LiveTemplateCompletionContributor.java:93)
	at com.intellij.codeInsight.completion.CompletionResultSet.passResult(CompletionResultSet.java:69)
	at com.intellij.codeInsight.completion.JavaNoVariantsDelegator$ResultTracker.consume(JavaNoVariantsDelegator.java:206)
	at com.intellij.codeInsight.completion.JavaNoVariantsDelegator$1.consume(JavaNoVariantsDelegator.java:49)
	at com.intellij.codeInsight.completion.JavaNoVariantsDelegator$1.consume(JavaNoVariantsDelegator.java:46)
	at com.intellij.codeInsight.completion.CompletionResultSet.passResult(CompletionResultSet.java:69)
	at com.intellij.codeInsight.completion.impl.CompletionServiceImpl$CompletionResultSetImpl.addElement(CompletionServiceImpl.java:135)
	at com.intellij.codeInsight.completion.JavaCompletionContributor.lambda$addKeywords$6(JavaCompletionContributor.java:462)
	at com.intellij.codeInsight.completion.JavaKeywordCompletion.addClassKeywords(JavaKeywordCompletion.java:434)
	at com.intellij.codeInsight.completion.JavaKeywordCompletion.addKeywords(JavaKeywordCompletion.java:273)
	at com.intellij.codeInsight.completion.JavaCompletionContributor.addKeywords(JavaCompletionContributor.java:460)
	at com.intellij.codeInsight.completion.JavaCompletionContributor.addIdentifierVariants(JavaCompletionContributor.java:301)
	at com.intellij.codeInsight.completion.JavaCompletionContributor.fillCompletionVariants(JavaCompletionContributor.java:231)
	at com.intellij.codeInsight.completion.CompletionService.getVariantsFromContributors(CompletionService.java:81)
	at com.intellij.codeInsight.completion.CompletionResultSet.runRemainingContributors(CompletionResultSet.java:132)
	at com.intellij.codeInsight.completion.CompletionResultSet.runRemainingContributors(CompletionResultSet.java:125)
	at com.intellij.codeInsight.completion.JavaNoVariantsDelegator.fillCompletionVariants(JavaNoVariantsDelegator.java:61)
	at com.intellij.codeInsight.completion.CompletionService.getVariantsFromContributors(CompletionService.java:81)
	at com.intellij.codeInsight.completion.CompletionResultSet.runRemainingContributors(CompletionResultSet.java:132)
	at com.intellij.codeInsight.completion.CompletionResultSet.runRemainingContributors(CompletionResultSet.java:125)
	at com.intellij.codeInsight.template.impl.LiveTemplateCompletionContributor$2.addCompletions(LiveTemplateCompletionContributor.java:90)
	at com.intellij.codeInsight.completion.CompletionProvider.addCompletionVariants(CompletionProvider.java:36)
	at com.intellij.codeInsight.completion.CompletionContributor.fillCompletionVariants(CompletionContributor.java:155)
	at com.intellij.codeInsight.completion.CompletionService.getVariantsFromContributors(CompletionService.java:81)
	at com.intellij.codeInsight.completion.CompletionService.performCompletion(CompletionService.java:110)
	at com.intellij.codeInsight.completion.CompletionProgressIndicator.calculateItems(CompletionProgressIndicator.java:776)
	at com.intellij.codeInsight.completion.CompletionProgressIndicator.access$500(CompletionProgressIndicator.java:90)
	at com.intellij.codeInsight.completion.CompletionProgressIndicator$1CalculateItems.run(CompletionProgressIndicator.java:758)
	at com.intellij.codeInsight.completion.AsyncCompletion.lambda$null$0(CompletionThreading.java:87)
	at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:848)
	at com.intellij.codeInsight.completion.AsyncCompletion.lambda$null$1(CompletionThreading.java:84)
	at com.intellij.openapi.progress.impl.CoreProgressManager$3.run(CoreProgressManager.java:170)
	at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:494)
	at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:443)
	at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:54)
	at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:155)
	at com.intellij.codeInsight.completion.AsyncCompletion.lambda$startThread$2(CompletionThreading.java:82)
	at com.intellij.openapi.application.impl.ApplicationImpl$2.run(ApplicationImpl.java:307)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ClassNotFoundException: com.intellij.openapi.vfs.VirtualFileContentsChangedAdapter PluginClassLoader[de.endrullis.idea.postfixtemplates, 1.0.2]
	at com.intellij.ide.plugins.cl.PluginClassLoader.loadClass(PluginClassLoader.java:64)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
	... 82 more

Conflicting template names

Some template names are conflicting with inbuilt postfix templates (maybe since 2017.3 EAP).

e.g. .format, .stream

Stacktrace:

Duplicated postfix completion key '.format' for language JAVA. Possible you need to disable one of the plugins: , de.endrullis.idea.postfixtemplates
java.lang.Throwable: Duplicated postfix completion key '.format' for language JAVA. Possible you need to disable one of the plugins: , de.endrullis.idea.postfixtemplates
	at com.intellij.openapi.diagnostic.Logger.error(Logger.java:136)
	at com.intellij.codeInsight.template.postfix.templates.LanguagePostfixTemplate.a(LanguagePostfixTemplate.java:55)
	at com.intellij.codeInsight.template.postfix.templates.LanguagePostfixTemplate.buildExtensions(LanguagePostfixTemplate.java:43)
	at com.intellij.codeInsight.template.postfix.templates.LanguagePostfixTemplate.buildExtensions(LanguagePostfixTemplate.java:28)
	at com.intellij.openapi.util.KeyedExtensionCollector.forKey(KeyedExtensionCollector.java:116)
	at com.intellij.lang.LanguageExtension.allForLanguage(LanguageExtension.java:87)
	at com.intellij.codeInsight.template.postfix.templates.PostfixLiveTemplate.isApplicable(PostfixLiveTemplate.java:158)
	at com.intellij.codeInsight.template.impl.TemplateManagerImpl.isApplicable(TemplateManagerImpl.java:305)
	at com.intellij.codeInsight.template.impl.TemplateManagerImpl.listApplicableCustomTemplates(TemplateManagerImpl.java:568)
	at com.intellij.codeInsight.template.impl.LiveTemplateCompletionContributor.a(LiveTemplateCompletionContributor.java:158)
	at com.intellij.codeInsight.template.impl.LiveTemplateCompletionContributor.access$200(LiveTemplateCompletionContributor.java:49)
	at com.intellij.codeInsight.template.impl.LiveTemplateCompletionContributor$2.addCompletions(LiveTemplateCompletionContributor.java:98)
...

Shortened the stacktrace since only the error message is important

Error when trying to get into settings

Getting this error after trying to get into settings. Settings -> Editor -> Custom Postfix Templates

Wrong line separators: '\r\n## numbe...' at offset 0
java.lang.AssertionError: Wrong line separators: '\r\n## numbe...' at offset 0
	at com.intellij.openapi.util.text.StringUtil.assertValidSeparators(StringUtil.java:2597)
	at com.intellij.openapi.editor.impl.DocumentImpl.b(DocumentImpl.java:612)
	at com.intellij.openapi.editor.impl.DocumentImpl.a(DocumentImpl.java:534)
	at com.intellij.openapi.editor.impl.DocumentImpl.a(DocumentImpl.java:965)
	at com.intellij.openapi.command.impl.CoreCommandProcessor.a(CoreCommandProcessor.java:149)
	at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:109)
	at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:99)
	at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:85)
	at com.intellij.openapi.editor.impl.DocumentImpl.setText(DocumentImpl.java:970)
	at de.endrullis.idea.postfixtemplates.settings.CptPluginSettingsForm.lambda$setPluginSettings$3(CptPluginSettingsForm.java:107)
	at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:1031)
	at de.endrullis.idea.postfixtemplates.settings.CptPluginSettingsForm.setPluginSettings(CptPluginSettingsForm.java:107)
	at de.endrullis.idea.postfixtemplates.settings.CptPluginConfigurable.reset(CptPluginConfigurable.java:73)
	at com.intellij.openapi.options.ex.ConfigurableWrapper.reset(ConfigurableWrapper.java:179)
	at com.intellij.openapi.options.ex.ConfigurableCardPanel.reset(ConfigurableCardPanel.java:124)
	at com.intellij.openapi.options.ex.ConfigurableCardPanel.a(ConfigurableCardPanel.java:82)
	at com.intellij.openapi.application.ReadAction.compute(ReadAction.java:47)
	at com.intellij.openapi.options.ex.ConfigurableCardPanel.createConfigurableComponent(ConfigurableCardPanel.java:69)
	at com.intellij.openapi.options.ex.ConfigurableCardPanel.create(ConfigurableCardPanel.java:55)
	at com.intellij.openapi.options.newEditor.ConfigurableEditor$1.create(ConfigurableEditor.java:70)
	at com.intellij.openapi.options.newEditor.ConfigurableEditor$1.create(ConfigurableEditor.java:67)
	at com.intellij.ui.CardLayoutPanel.a(CardLayoutPanel.java:88)
	at com.intellij.ui.CardLayoutPanel.a(CardLayoutPanel.java:116)
	at com.intellij.ui.CardLayoutPanel.b(CardLayoutPanel.java:132)
	at com.intellij.openapi.application.TransactionGuardImpl$2.run(TransactionGuardImpl.java:314)
	at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.a(LaterInvocator.java:416)
	at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.run(LaterInvocator.java:399)
	at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
	at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:762)
	at java.awt.EventQueue.access$500(EventQueue.java:98)
	at java.awt.EventQueue$3.run(EventQueue.java:715)
	at java.awt.EventQueue$3.run(EventQueue.java:709)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:732)
	at com.intellij.ide.IdeEventQueue.e(IdeEventQueue.java:821)
	at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:649)
	at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:365)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:109)
	at java.awt.WaitDispatchSupport$2.run(WaitDispatchSupport.java:190)
	at java.awt.WaitDispatchSupport$4.run(WaitDispatchSupport.java:235)
	at java.awt.WaitDispatchSupport$4.run(WaitDispatchSupport.java:233)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.awt.WaitDispatchSupport.enter(WaitDispatchSupport.java:233)
	at java.awt.Dialog.show(Dialog.java:1084)
	at com.intellij.openapi.ui.impl.DialogWrapperPeerImpl$MyDialog.show(DialogWrapperPeerImpl.java:736)
	at com.intellij.openapi.ui.impl.DialogWrapperPeerImpl.show(DialogWrapperPeerImpl.java:458)
	at com.intellij.openapi.ui.DialogWrapper.invokeShow(DialogWrapper.java:1686)
	at com.intellij.openapi.ui.DialogWrapper.show(DialogWrapper.java:1635)
	at com.intellij.openapi.options.newEditor.SettingsDialog.a(SettingsDialog.java:83)
	at com.intellij.openapi.application.TransactionGuardImpl.a(TransactionGuardImpl.java:86)
	at com.intellij.openapi.application.TransactionGuardImpl.submitTransactionAndWait(TransactionGuardImpl.java:151)
	at com.intellij.openapi.options.newEditor.SettingsDialog.show(SettingsDialog.java:83)
	at com.intellij.ide.actions.ShowSettingsUtilImpl.showSettingsDialog(ShowSettingsUtilImpl.java:97)
	at com.intellij.ide.actions.ShowSettingsAction.perform(ShowSettingsAction.java:63)
	at com.intellij.ide.actions.ShowSettingsAction.actionPerformed(ShowSettingsAction.java:52)
	at com.intellij.openapi.actionSystem.ex.ActionUtil$1.run(ActionUtil.java:216)
	at com.intellij.openapi.actionSystem.ex.ActionUtil.performActionDumbAware(ActionUtil.java:233)
	at com.intellij.openapi.actionSystem.impl.ActionMenuItem$ActionTransmitter.a(ActionMenuItem.java:310)
	at com.intellij.openapi.wm.impl.FocusManagerImpl.runOnOwnContext(FocusManagerImpl.java:911)
	at com.intellij.openapi.wm.impl.IdeFocusManagerImpl.runOnOwnContext(IdeFocusManagerImpl.java:136)
	at com.intellij.openapi.actionSystem.impl.ActionMenuItem$ActionTransmitter.actionPerformed(ActionMenuItem.java:300)
	at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)
	at com.intellij.openapi.actionSystem.impl.ActionMenuItem.a(ActionMenuItem.java:117)
	at com.intellij.openapi.application.TransactionGuardImpl.a(TransactionGuardImpl.java:86)
	at com.intellij.openapi.application.TransactionGuardImpl.a(TransactionGuardImpl.java:109)
	at com.intellij.openapi.application.TransactionGuardImpl.submitTransaction(TransactionGuardImpl.java:118)
	at com.intellij.openapi.application.TransactionGuard.submitTransaction(TransactionGuard.java:122)
	at com.intellij.openapi.actionSystem.impl.ActionMenuItem.fireActionPerformed(ActionMenuItem.java:117)
	at com.intellij.ui.plaf.beg.BegMenuItemUI.a(BegMenuItemUI.java:513)
	at com.intellij.ui.plaf.beg.BegMenuItemUI.access$300(BegMenuItemUI.java:45)
	at com.intellij.ui.plaf.beg.BegMenuItemUI$MyMenuDragMouseHandler.menuDragMouseReleased(BegMenuItemUI.java:560)
	at javax.swing.JMenuItem.fireMenuDragMouseReleased(JMenuItem.java:586)
	at javax.swing.JMenuItem.processMenuDragMouseEvent(JMenuItem.java:483)
	at javax.swing.JMenuItem.processMouseEvent(JMenuItem.java:429)
	at javax.swing.MenuSelectionManager.processMouseEvent(MenuSelectionManager.java:329)
	at com.intellij.ui.plaf.beg.BegMenuItemUI$MyMouseInputHandler.mouseReleased(BegMenuItemUI.java:535)
	at java.awt.Component.processMouseEvent(Component.java:6541)
	at javax.swing.JComponent.processMouseEvent(JComponent.java:3324)
	at java.awt.Component.processEvent(Component.java:6306)
	at java.awt.Container.processEvent(Container.java:2237)
	at java.awt.Component.dispatchEventImpl(Component.java:4897)
	at java.awt.Container.dispatchEventImpl(Container.java:2295)
	at java.awt.Component.dispatchEvent(Component.java:4719)
	at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4889)
	at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4526)
	at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4467)
	at java.awt.Container.dispatchEventImpl(Container.java:2281)
	at java.awt.Window.dispatchEventImpl(Window.java:2746)
	at java.awt.Component.dispatchEvent(Component.java:4719)
	at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:764)
	at java.awt.EventQueue.access$500(EventQueue.java:98)
	at java.awt.EventQueue$3.run(EventQueue.java:715)
	at java.awt.EventQueue$3.run(EventQueue.java:709)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:90)
	at java.awt.EventQueue$4.run(EventQueue.java:737)
	at java.awt.EventQueue$4.run(EventQueue.java:735)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:734)
	at com.intellij.ide.IdeEventQueue.e(IdeEventQueue.java:821)
	at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:645)
	at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:365)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)

Allow templates on types in Scala

I'd like to create templates that work on types instead of expressions. E.g. I tried:

.seqT : wrap type in Seq[ ]
    ANY  Seq[$expr$]

to achieve something like def foo(x: Bar.seq) -> def foo(x: Seq[Bar]) but the .seqT template is not available in this context.

Replacing parts of expressions

Is this possible?
String s = someString.nn -> String s = requireNonNull(someString)

The only usable variable I find is $expr$ but this replaces whole expression leaving only requireNonNull(someString)

Exception when opening templates file for the first time after installation

java.util.NoSuchElementException: No value present
	at java.util.Optional.get(Optional.java:135)
	at de.endrullis.idea.postfixtemplates.actions.OpenJavaTemplatesAction.actionPerformed(OpenJavaTemplatesAction.java:15)
	at com.intellij.openapi.actionSystem.ex.ActionUtil$1.run(ActionUtil.java:216)
	at com.intellij.openapi.actionSystem.ex.ActionUtil.performActionDumbAware(ActionUtil.java:233)
	at com.intellij.openapi.actionSystem.impl.ActionMenuItem$ActionTransmitter.a(ActionMenuItem.java:310)
	at com.intellij.openapi.wm.impl.FocusManagerImpl.runOnOwnContext(FocusManagerImpl.java:911)
	at com.intellij.openapi.wm.impl.IdeFocusManagerImpl.runOnOwnContext(IdeFocusManagerImpl.java:136)
	at com.intellij.openapi.actionSystem.impl.ActionMenuItem$ActionTransmitter.actionPerformed(ActionMenuItem.java:300)
	at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)
	at com.intellij.openapi.actionSystem.impl.ActionMenuItem.a(ActionMenuItem.java:117)
	at com.intellij.openapi.application.TransactionGuardImpl.a(TransactionGuardImpl.java:86)
	at com.intellij.openapi.application.TransactionGuardImpl.a(TransactionGuardImpl.java:109)
	at com.intellij.openapi.application.TransactionGuardImpl.submitTransaction(TransactionGuardImpl.java:118)
	at com.intellij.openapi.application.TransactionGuard.submitTransaction(TransactionGuard.java:122)
	at com.intellij.openapi.actionSystem.impl.ActionMenuItem.fireActionPerformed(ActionMenuItem.java:117)
	at com.intellij.ui.plaf.beg.BegMenuItemUI.a(BegMenuItemUI.java:513)
	at com.intellij.ui.plaf.beg.BegMenuItemUI.access$300(BegMenuItemUI.java:45)
	at com.intellij.ui.plaf.beg.BegMenuItemUI$MyMouseInputHandler.mouseReleased(BegMenuItemUI.java:533)
	at java.awt.Component.processMouseEvent(Component.java:6533)
	at javax.swing.JComponent.processMouseEvent(JComponent.java:3324)
	at java.awt.Component.processEvent(Component.java:6298)
	at java.awt.Container.processEvent(Container.java:2236)
	at java.awt.Component.dispatchEventImpl(Component.java:4889)
	at java.awt.Container.dispatchEventImpl(Container.java:2294)
	at java.awt.Component.dispatchEvent(Component.java:4711)
	at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4888)
	at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4525)
	at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4466)
	at java.awt.Container.dispatchEventImpl(Container.java:2280)
	at java.awt.Window.dispatchEventImpl(Window.java:2746)
	at java.awt.Component.dispatchEvent(Component.java:4711)
	at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
	at java.awt.EventQueue.access$500(EventQueue.java:97)
	at java.awt.EventQueue$3.run(EventQueue.java:709)
	at java.awt.EventQueue$3.run(EventQueue.java:703)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:90)
	at java.awt.EventQueue$4.run(EventQueue.java:731)
	at java.awt.EventQueue$4.run(EventQueue.java:729)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
	at com.intellij.ide.IdeEventQueue.e(IdeEventQueue.java:821)
	at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:645)
	at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:365)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)

can i differentiate the ` java.lang.String `or `"string"`

this is my templates

.timber : logcat with timber
	NON_VOID → Timber.d("$expr$ = %s",$expr$$END$);

if i have a String variable ,use the templates ,i will get this

String string = "String";
//string.timber
Timber.d("string = %s", string);

but if i hava a character string ,i will get this

//"String".timber
Timber.d(""String" = %s", "String");

try change templates like this ,but not working for me

.timber : logcat with timber
	java.lang.String → Timber.d($expr$,$expr$$END$);
	NON_VOID → Timber.d("$expr$ = %s",$expr$$END$);

can i can i differentiate the java.lang.Stringor "string"

Settings storage location

Hello.

If I'm not mistaken, all plugins and the Intellij store the settings in Library/Preferences/IntelliJIdea2017.3. Is there any known reason to be stored in Library/Application Support/IntelliJIdea2017.3/custom-postfix-templates/templates?

Is it possible to integrate with IDE Settings Sync?

Replace arrow (→)

Maybe it's just me, but I'm always copying and paste the arrow. Can't you use an easier symbol to type? examples: -> or =>

Thank you.

Use static imports if possible in templates

As in Live Templates you can choose to use static import if possible for each template. This should also be possible with postfix-templates.

As an example I have theses useful cases

.ass : Truth.assertThat
  NON_VOID                 → com.google.common.truth.Truth.assertThat($expr$)

.mock : Mock
  CLASS                    → org.mockito.Mockito.mock($expr$.class)

.rnn : requireNonNull
  NON_VOID                 → java.util.Objects.requireNonNull($expr$, "$END$")

unix soft link problems

I use soft link to ensure the portability of my templates.
But it does not work.

  • If I use soft link for the whole templates dir, I have to restart to update the templates even if I have pressed ctrl s(which is command s in mac osx) to save the edited files.

  • If I use soft link for specific file such as java.postfixTemplates

templates ll
total 32
lrwxr-xr-x  1 Yao  staff   107B  2 10 17:38 java.postfixTemplates -> /Users/Yao/codegit/Java/JavaRTDemo/src/main/java/velocity/templates/postfix/templates/java.postfixTemplates

The templates in file java.postfixTemplates cannot even be loaded.

Add Scala support

At the moment adding Scala support is not really trivial, since the Scala plugin of IDEA is not yet written in Scala 2.12. Thus it is not compatible with Java 8 and several important functions are not callable from Java 8 code. So we either have to wait for the Scala plugin to get upgraded to Scala 2.12 or we have to write a "wrapper" in Scala 2.10 which calls the functions of the Scala plugin that we need and provides a Java 8 compatible interface for those (using simple types and interfaces) and then call those functions from our Java 8 code.

I would rather suggest to wait for the Scala plugin to get upgraded than doing a temporary and costly hack. So let's wait, I would say.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.