Forum Menu




 


Log in Problems?
New User? Sign Up!
AVR Freaks Forum Index

Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Author Message
pinguin_do
PostPosted: Jun 16, 2011 - 01:34 PM
Rookie


Joined: Jul 01, 2008
Posts: 38


Hello,

VS documentation says, that it should be possible to indent the code with <ctrl>k <ctrl>d.
Or with older VS <alt><F8>.

If I run it, it says (sometimes, when no Error is shown) "Ready" in the status bar but the code is not indented at all.

And again and again: was perfectly working in Studio32 Wink Let's go back to Eclipse...

Thanks for your help,

Daniel
 
 View user's profile Send private message  
Reply with quote Back to top
leon_heller
PostPosted: Jun 16, 2011 - 01:54 PM
Raving lunatic


Joined: Jul 27, 2001
Posts: 7429
Location: St. Leonards-on-Sea (UK)

You can do it with Edit > Advance > Increase Line Indent. No keyboard shortcut is shown.

_________________
Leon Heller
G1HSM
 
 View user's profile Send private message Send e-mail Visit poster's website 
Reply with quote Back to top
pinguin_do
PostPosted: Jun 16, 2011 - 01:59 PM
Rookie


Joined: Jul 01, 2008
Posts: 38


That's not what I want.
I intend to reindent the whole file.

<ctrl>k <ctrl>d is Edit > Advanced > Format Document.

(Eclipse: <ctrl>a <ctrl>i)

like in this description:
http://blogs.msdn.com/b/zainnab/archive/2010/05/19/format-the-current-document-or-selection-vstipedit0057.aspx
 
 View user's profile Send private message  
Reply with quote Back to top
leon_heller
PostPosted: Jun 16, 2011 - 02:11 PM
Raving lunatic


Joined: Jul 27, 2001
Posts: 7429
Location: St. Leonards-on-Sea (UK)

You want to "pretty-print" it, then, rather than simple indentation. Does VS do that?

Just out of interest, I tried Format with Microchip's MPLAB-X (based on NetBeans) and that worked on a block of C code from which I'd removed all the indentation. It can be done with Alt-Shift-F.

_________________
Leon Heller
G1HSM
 
 View user's profile Send private message Send e-mail Visit poster's website 
Reply with quote Back to top
pinguin_do
PostPosted: Jun 16, 2011 - 09:22 PM
Rookie


Joined: Jul 01, 2008
Posts: 38


But Studio 5 does not use NetBeans or Eclipse Sad

Nobody here with an idea to get this function running?

Another feature i'm missing (loving it in Studio32) #ifdef statements are grayed out depending on the preprocessor definitions.
Is it possible to have that also?


#define HUHU 1

#ifndef HUHU
Studio 5
#else
Studio 32
#endif

in Studio 32 the "Studio 5" would be shown gray and "Studio 32" in normal colors.
Stuidio 5 makes no extra highlighting.
Makes it easy ro read Code using massive dependant compilaion.

Found this comment on VassistX forum:
Quote:
"IDE tools menu -> Options -> Text Editor -> C/C++ -> Formatting -> Colorize inactive code blocks in a different color"

(Not implemented by Atmel for "AvrGCC"?)
 
 View user's profile Send private message  
Reply with quote Back to top
mjbcswitzerland
PostPosted: Jun 18, 2011 - 09:13 PM
Hangaround


Joined: May 01, 2009
Posts: 161
Location: Switzerland

Hi

1) In VS201 0 non-included code is greyed out. In Studio 5 IDE this is not the case so it must be that Studio 5 has not activated it/made use of it.

2) If you ar etrying to mode a block fo code by tab stops in or out the following standard VS method works:
- select the code block and hit the TAB key to mode it one tab in or hit the TAB key with SHIFT held down to move it out one TAB stop.

Regards

Mark
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
pinguin_do
PostPosted: Jun 19, 2011 - 09:25 AM
Rookie


Joined: Jul 01, 2008
Posts: 38


Quote:
2) If you ar etrying to mode a block fo code by tab stops in or out the following standard VS method works:
- select the code block and hit the TAB key to mode it one tab in or hit the TAB key with SHIFT held down to move it out one TAB stop.


That's clear.
What's not working is the button in the menu to reindent the whole file. (see post 3 in this thread)

Regards

Daniel
 
 View user's profile Send private message  
Reply with quote Back to top
leon_heller
PostPosted: Jun 19, 2011 - 09:28 AM
Raving lunatic


Joined: Jul 27, 2001
Posts: 7429
Location: St. Leonards-on-Sea (UK)

Forget the AVR and use PICs if you want pretty-printed files. Smile

_________________
Leon Heller
G1HSM
 
 View user's profile Send private message Send e-mail Visit poster's website 
Reply with quote Back to top
clawson
PostPosted: Jun 19, 2011 - 06:13 PM
10k+ Postman


Joined: Jul 18, 2005
Posts: 62324
Location: (using avr-gcc in) Finchingfield, Essex, England

Quote:

Forget the AVR and use PICs if you want pretty-printed files.

Or simply fallback to WinAVR and use indent.exe (be warned it does not know about avr-gcc's 0bNNNNN extension)

_________________
 
 View user's profile Send private message  
Reply with quote Back to top
M0rg0th
PostPosted: Jun 21, 2011 - 01:40 PM
Newbie


Joined: Jan 08, 2011
Posts: 3


Same issue with indenting here http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&t=107859
 
 View user's profile Send private message  
Reply with quote Back to top
saaadhu
PostPosted: Jun 25, 2011 - 07:08 PM
Hangaround


Joined: Jul 04, 2010
Posts: 161


pinguin_do wrote:
But Studio 5 does not use NetBeans or Eclipse Sad

Nobody here with an idea to get this function running?

Another feature i'm missing (loving it in Studio32) #ifdef statements are grayed out depending on the preprocessor definitions.
Is it possible to have that also?


#define HUHU 1

#ifndef HUHU
Studio 5
#else
Studio 32
#endif



I added this to the latest version of Naggy ( https://github.com/downloads/saaadhu/na ... 0v0.2.vsix ) - do check it out. The "lowlighter" kicks in a second after you stop typing, and in the above example, you should see the Studio 5 line getting dimmed.

_________________
Regards
Senthil
 
 View user's profile Send private message  
Reply with quote Back to top
ruserimd
PostPosted: Nov 14, 2011 - 01:43 PM
Newbie


Joined: Nov 14, 2011
Posts: 2


I also found this unpleasant bug in the new AVRStudio 5. I could not find a way to make the default VS code formatting to work, so I made it with o workaround.

Here is how I did it, may be it will be helpful for anybody else:

For formatting the source code I used an external command line and freeware tool AStyle ( http://astyle.sourceforge.net/ ), which has a lot of options.

In AVRStudio go to:
Tools > External Tools.
In the new window click Add button and fill up the fields like this:
Title: AStyle (or whatever you like)
Command: the path to the .exe file of the tool, in my case D:\Tools\AStyle\bin\AStyle.exe
Arguments: Arguments for the tool according to the formatting style you like (check documentation), in my case: -y --indent=spaces=2 --style=ansi --errors-to-stdout --suffix=none $(ItemDir)$(ItemFileName)$(ItemExt)
(Last 3 parameters represent full path to source file you are currently editing in VS.)
Use output window: checked
Treat output as Unicode: unchecked
Prompt for arguments: unchecked

Now click Apply and Ok. Now the new tool can be used from Tools > AStyle command in AVRStudio 5.

To make life easier, you can add a keyboard shortcut for this:
Go to Tools > Options
In the new window go to Environment > Keyboard
Now choose command Tools.ExternalCommand1 (or other if you have more external tools set) and assign a new shortcut (I used CTRL+SHIFT+ALT+F)

Now when you want to use the code beautifier:
1. Save the file (because the tools will overwrite the latest version of the file saved on the hard drive and not the currently unsaved version in AVRStudio5).
2. Apply the tool, using the command or the keyboard shortcut.
3. A popup appears saying that: 'This file has been modified outside of the source editor. Do you want to reload it?' Click Yes, and enjoy the nicely formatted source code.
4. In the standard output window you can see messages from the tool when you use it.

Hopefully this will be useful to anybody.

If there is any other way to use the code style formatting options in AVRStudio5, please share your knowledge!
 
 View user's profile Send private message  
Reply with quote Back to top
teachop
PostPosted: Apr 23, 2012 - 11:50 AM
Newbie


Joined: Oct 31, 2009
Posts: 7


ruserimd wrote:
I also found this unpleasant bug in the new AVRStudio 5. I could not find a way to make the default VS code formatting to work, so I made it with o workaround.

Here is how I did it, may be it will be helpful for anybody else:

For formatting the source code I used an external command line and freeware tool AStyle ( http://astyle.sourceforge.net/ ), which has a lot of options.

In AVRStudio go to:
Tools > External Tools.
In the new window click Add button and fill up the fields like this:
Title: AStyle (or whatever you like)
Command: the path to the .exe file of the tool, in my case D:\Tools\AStyle\bin\AStyle.exe
Arguments: Arguments for the tool according to the formatting style you like (check documentation), in my case: -y --indent=spaces=2 --style=ansi --errors-to-stdout --suffix=none $(ItemDir)$(ItemFileName)$(ItemExt)
(Last 3 parameters represent full path to source file you are currently editing in VS.)
Use output window: checked
Treat output as Unicode: unchecked
Prompt for arguments: unchecked

Now click Apply and Ok. Now the new tool can be used from Tools > AStyle command in AVRStudio 5.

To make life easier, you can add a keyboard shortcut for this:
Go to Tools > Options
In the new window go to Environment > Keyboard
Now choose command Tools.ExternalCommand1 (or other if you have more external tools set) and assign a new shortcut (I used CTRL+SHIFT+ALT+F)

Now when you want to use the code beautifier:
1. Save the file (because the tools will overwrite the latest version of the file saved on the hard drive and not the currently unsaved version in AVRStudio5).
2. Apply the tool, using the command or the keyboard shortcut.
3. A popup appears saying that: 'This file has been modified outside of the source editor. Do you want to reload it?' Click Yes, and enjoy the nicely formatted source code.
4. In the standard output window you can see messages from the tool when you use it.

Hopefully this will be useful to anybody.

If there is any other way to use the code style formatting options in AVRStudio5, please share your knowledge!

This works nicely, thanks. Works in AS6 too.
 
 View user's profile Send private message  
Reply with quote Back to top
lukami
PostPosted: Apr 26, 2012 - 06:40 AM
Newbie


Joined: Oct 13, 2010
Posts: 3


Another option is to use my extension that integrates AStyle more tightly to VS and AS:
http://visualstudiogallery.msdn.microsoft.com/2f3f04cd-2866-4e47-a671-d1cc9cc3fb02?SRC=VSIDE
 
 View user's profile Send private message  
Reply with quote Back to top
mailtosarathy
PostPosted: Apr 26, 2012 - 08:29 AM
Wannabe


Joined: May 01, 2009
Posts: 91


Next release of Atmel Studio will have Code Indenting using Ctrl+K Ctrl+F for the selected code.

Smile
 
 View user's profile Send private message  
Reply with quote Back to top
Display posts from previous:     
Jump to:  
All times are GMT + 1 Hour
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Powered by PNphpBB2 © 2003-2006 The PNphpBB Group
Credits