|
|
|
Re: Xtext templates [message #1740361 is a reply to message #1740360] |
Fri, 12 August 2016 09:29 |
|
In your "lang.ui" project:
* create the folder "templates"
* create the file "templates/templates.xml"
* edit the file with something similar to:
<?xml version="1.0" encoding="UTF-8" ?>
<templates>
<template
name="def"
description="public method"
id="def"
context="io.sarl.lang.SARL.Member"
enabled="true"
autoinsert="false">def ${name}(${params}) {
${cursor}
}</template>
<template
name="protecteddef"
description="protected method"
id="protected_def"
context="io.sarl.lang.SARL.Member"
enabled="true"
autoinsert="false">protected def ${name}(${params}) {
${cursor}
}</template>
</templates>
[Updated on: Fri, 12 August 2016 09:30] Report message to a moderator
|
|
|
|
Re: Xtext templates [message #1740365 is a reply to message #1740363] |
Fri, 12 August 2016 09:53 |
|
Hi,
I have this templates.xml it resides in the templates folder in the ui project of my plugin and it is enabled in the build section for binary builds.
if I run my plugin in a runtime eclipse the templates are not loaded.
I cannot see my mistake:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<templates>
<template autoinsert="true"
context="de.mdsd.xtext.formatter2.model.FormatterModel.FormatterDefinition"
deleted="false" description="keyword "." ":""
enabled="true" name="keyworddot" id="keyworddot">keyword "." ":" {
format dot {
nospace around
}
}
</template>
<template autoinsert="true"
context="de.mdsd.xtext.formatter2.model.FormatterModel.FormatterDefinition"
deleted="false" description="keyword "," " enabled="true"
name="keywordkomma" id="keywordkomma">keyword "," {
format komma {
nospace before
space " " after
}
}
</template>
<template autoinsert="true"
context="de.mdsd.xtext.formatter2.model.FormatterModel.FormatterDefinition"
deleted="false" description="keyword ";"" enabled="true"
name="keywordsemicolon" id="keywordsemicolon">keyword ";" {
format semicolon {
nospace before
linewrap(2,0,1) after
}
}
</template>
<template autoinsert="true"
context="de.mdsd.xtext.formatter2.model.FormatterModel.FormatterDefinition"
deleted="false" description="format linewrapAround(2,1,1)" enabled="true"
name="linewrapAround" id="linewrapAround">format linewrapAround linewrap (2, 1,1)
around</template>
<template autoinsert="true"
context="de.mdsd.xtext.formatter2.model.FormatterModel.FormatterDefinition"
deleted="false" description="pair "(" ")" "[" "]""
enabled="true" name="pair()"id="pairparenteses">pair "(" ")" "[" "]" {
format openParentesis {
nospace around
}
format closingParentesis {
nospace before
}
}
</template>
<template autoinsert="true"
context="de.mdsd.xtext.formatter2.model.FormatterModel.FormatterDefinition"
deleted="false" description="pair "{" "}" "
enabled="true" name="pair{}" id="pairbaces">pair "{" "}" {
format openBrace {
space " " before
linewrap(2, 0, 0) after
indent after
}
format closingBrace {
linewrap(2, 1, 1) before
deindent before
}
}
</template>
<template autoinsert="true"
context="de.mdsd.xtext.formatter2.model.FormatterModel.FormatDefinition"
deleted="false" description="use closingBrace" enabled="true"
name="useclosingBrace" id="useclosingBrace">use closingBrace</template>
<template autoinsert="true"
context="de.mdsd.xtext.formatter2.model.FormatterModel.FormatDefinition"
deleted="false" description="use closingParentesis" enabled="true"
name="useclosingParentesis"id="useclosingParentesis">use closingParentesis</template>
<template autoinsert="true"
context="de.mdsd.xtext.formatter2.model.FormatterModel.FormatDefinition"
deleted="false" description="use dot" enabled="true" name="usedot" id="usedot">use dot
</template>
<template autoinsert="true"
context="de.mdsd.xtext.formatter2.model.FormatterModel.FormatDefinition"
deleted="false" description="use komma" enabled="true" name="usekomma"id="usekomma">use komma
</template>
<template autoinsert="true"
context="de.mdsd.xtext.formatter2.model.FormatterModel.FormatDefinition"
deleted="false" description="use semicolon" enabled="true" name="useksemicolon"id="useksemicolon">use
semicolon</template>
<template autoinsert="true"
context="de.mdsd.xtext.formatter2.model.FormatterModel.FormatDefinition"
deleted="false" description="use linewrapAround" enabled="true"
name="uselinewrapAround"id="uselinewrapAround">use linewrapAround ${Max_Min_Default}</template>
<template autoinsert="true"
context="de.mdsd.xtext.formatter2.model.FormatterModel.FormatDefinition"
deleted="false" description="use openBrace" enabled="true" name="useopenBrace"id="useopenBrace">use
openBrace</template>
<template autoinsert="true"
context="de.mdsd.xtext.formatter2.model.FormatterModel.FormatDefinition"
deleted="false" description="use openParentesis" enabled="true"
name="useopenParentesis"id="useopenParentesis">use openParentesis</template>
</templates>
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04280 seconds