<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: LPCXpresso - templates - code formatter in LPCXpresso IDE</title>
    <link>https://community.nxp.com/t5/LPCXpresso-IDE/LPCXpresso-templates-code-formatter/m-p/537322#M5488</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You need to tweak the Indent options related to 'switch', 'case' and 'break' in the Indentation tab of the active profile in your&amp;nbsp; Code Style - Formatter.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To get what you what I think that you probably need 'switch' unticked and 'case' and 'break' ticked. You might also want to look at the tab settings here vs what you are putting into your template.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The other thing to try is leaving the "use code formatter" check box unticked, and seeing if that helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Aside - the Code Templates and Formatter are standard Eclipse/CDT - there is nothing LPCXpresso IDE specific about them. So if you are still having issues, it might be worth doing an internet search.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;LPCXpresso Support&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 19 Aug 2016 06:54:14 GMT</pubDate>
    <dc:creator>lpcxpresso_supp</dc:creator>
    <dc:date>2016-08-19T06:54:14Z</dc:date>
    <item>
      <title>LPCXpresso - templates - code formatter</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/LPCXpresso-templates-code-formatter/m-p/537321#M5487</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;At the moment I have problems with code templates in conjunction with the formatter.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- I have edited an own profile for the formatter (Preferences-&amp;gt;C/C++-&amp;gt;Code Style-&amp;gt;Formatter)&lt;/P&gt;&lt;P&gt;- I have configured the code templates (Preferences-&amp;gt;C/C++-&amp;gt;Editor-&amp;gt;Templates) to "use code formatter"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ("use code formatter" check box is active.&amp;nbsp; Thus I expect LPCXpresso to 'ignore' the format of the&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; existing templates and use the Code Style, which I have edited in the formatter. )&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So I think, LPCXpresso will format my code in the same way,&lt;/P&gt;&lt;P&gt;if I use "auto-complete" (CTRL+Space) or if I use the formatter&lt;/P&gt;&lt;P&gt;for existing code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But these two methods lead to different code formatting:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Exampe for "switch" statement:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Using auto-complete (typing "sw" and pressing CTRL+Space) results in:&lt;/P&gt;&lt;P&gt;(this is &lt;STRONG style="text-decoration: underline;"&gt;&lt;SPAN style="color: #3d3d3d; text-decoration: underline;"&gt;NOT&lt;/SPAN&gt; &lt;/STRONG&gt;the result I want to have)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;switch (key)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;{&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; case value:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; break;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; default:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; break;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;}&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Using the formatter afterwards (mark the code + SHIFT+CTRL+F) results in:&lt;/P&gt;&lt;P&gt;(this is the result I want to have)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;switch (key)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;{&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;case value:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; break;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;default:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; break;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;}&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It seems, that the auto-complete function catches &lt;SPAN style="text-decoration: underline;"&gt;some&lt;/SPAN&gt; rules, but&lt;/P&gt;&lt;P&gt;&lt;SPAN style="text-decoration: underline;"&gt;not ALL&lt;/SPAN&gt; rules from the formatter...?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Or am I missing something?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;------------------------------------------------------------&lt;/P&gt;&lt;P&gt;PS:&lt;/P&gt;&lt;P&gt;I'm using:&lt;/P&gt;&lt;P&gt;- Win7&lt;/P&gt;&lt;P&gt;- LPCxpresso v7.9.2&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The template for "switch" is defined like this (Preferences-&amp;gt;C/C++-&amp;gt;Editor-&amp;gt;Templates):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;switch (${key}) {&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; case ${value}:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ${cursor}&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; break;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; default:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; break;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;}&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Aug 2016 08:27:47 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/LPCXpresso-templates-code-formatter/m-p/537321#M5487</guid>
      <dc:creator>andreasklockner</dc:creator>
      <dc:date>2016-08-18T08:27:47Z</dc:date>
    </item>
    <item>
      <title>Re: LPCXpresso - templates - code formatter</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/LPCXpresso-templates-code-formatter/m-p/537322#M5488</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You need to tweak the Indent options related to 'switch', 'case' and 'break' in the Indentation tab of the active profile in your&amp;nbsp; Code Style - Formatter.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To get what you what I think that you probably need 'switch' unticked and 'case' and 'break' ticked. You might also want to look at the tab settings here vs what you are putting into your template.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The other thing to try is leaving the "use code formatter" check box unticked, and seeing if that helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Aside - the Code Templates and Formatter are standard Eclipse/CDT - there is nothing LPCXpresso IDE specific about them. So if you are still having issues, it might be worth doing an internet search.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;LPCXpresso Support&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 19 Aug 2016 06:54:14 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/LPCXpresso-templates-code-formatter/m-p/537322#M5488</guid>
      <dc:creator>lpcxpresso_supp</dc:creator>
      <dc:date>2016-08-19T06:54:14Z</dc:date>
    </item>
  </channel>
</rss>

