Exported Live Templates have no newline
已回答
Hi I'm trying to add a live template to a plugin. The template works as intended when I created it for my instance. However when exporting the template the newlines are gone and when I run the plugin the newlines are not there, subsequently.
What I want to happen when activating the template in java:
// %open[]
// %close[]
What happens:
// %open[] // %close[]
How I define it in Settings>Editor>LiveTemplates
$COMMENT$ %open[$VAR$] $END_COMMENT$
$SELECTION$$END$
$COMMENT$ %close[$VAR$] $END_COMMENT$
And here is how the xml gets defined when I export it:
-<template
useStaticImport="true"
toShortenFQNames="true"
toReformat="false"
description="&begin[]"
value="$COMMENT$ %open[$VAR$] $END_COMMENT$ $SELECTION$$END$ $COMMENT$ %close[$VAR$] $END_COMMENT$"
name="open">
<variable name="COMMENT" alwaysStopAt="false" defaultValue="" expression="commentStart()"/>
<variable name="VAR" alwaysStopAt="true" defaultValue="" expression=""/>
<variable name="END_COMMENT" alwaysStopAt="false" defaultValue="" expression="commentEnd()"/>
-<context>
<option value="true" name="OTHER"/>
</context>
</template>
请先登录再写评论。
Johan, when exporting templates created within the IDE, they're saved with HTML entity, which is LF (line feed).
Could you please make sure that you're providing line feeds with your bundled templates?
Please file an issue in our bugtracker and specify IDE version, Thanks! https://youtrack.jetbrains.com/issues/IDEA
added an issue here Exported Live Templates have no newline : IDEA-269148 (jetbrains.com)
Jakub Chrzanowski Thanks I added that and it works I would expect IntelliJ to automatically add those characters in the future though!