Indenting c++ in visual studio - visual-studio

I am using Visual Studio 2005 team edition. I come from a unix background using gvim.
It would appear that formatting/indenting code seems to be a lot harder.
Can anyone suggest a good option. VI with its autoindent/smartindent settings spoilt me.
thanks

ctrl K-F formats the selected code
Go to tools->options->Text editor->c/c++ to set formatting details

Related

Visual Studio Community 2022 inline hints shortcut

What is the inline hints on/off shortcut in visual studio 2022?
I checked these checkboxes and it works but the shortcut Alt+F1 not work. (Visual Studio Community 2022 (64-bit) - Preview
Version 17.2.0 Preview 2.1)
I found your question because I was having the same issue. I think I've figured out what's going on.
Are you coding in C# or C/C++ ?
If you're doing C#, HOLDING DOWN the alt-F1 keys will TEMPORARILY show ALL the types of hints available; i.e. those you haven't told it to show all the time. When you release alt-F1 the 'extra' hints will disappear. If, as in your image, you've chosen to show almost everything all the time, holding down alt-F1 probably won't display anything different. (try diabling some of the stuff below the first line and see if there's a difference when you hold down alt-F1)
On my system it reacts rather slowly; if you just tap quickly you might not see any change.
(if that doesn't work, you might want to check to see if any extensions you're using are overriding the alt-F1 shortcut)
If you're using C/C++ the inline hints works a bit differently. Here alt-F1 or ctrl-ctrl can TOGGLE hints.
The options settings for C/C++ are located in "Text Editor/ C/C++ / IntelliSense", and the list of inline hint settings are quite a bit more limited than those listed for C#.
On vanilla Visual Studio 2022 press ctrl twice.
If you are using Visual Assist press Alt + F1

Visual Studio 2019 C# code colours in Visual Studio 2017

I have a question. I need to use VS 2017 in my work but i love VS 2019 code colouring. It is so much easier to read. My question is did someone seen some code colours themes like VS2019/VS CODE (JavaScript) themes?
Or there is easy solution, for example import code colours from VS2019 to VS2017?
Thanks for help
You can personalize your VS2017 with the "Color Theme Editor" extension available on the Visual Studio Market Place for free.
https://marketplace.visualstudio.com/items?itemName=VisualStudioPlatformTeam.VisualStudio2017ColorThemeEditor
EDIT :
For Syntax Highlighting you can choose in the gallery here :
https://marketplace.visualstudio.com/search?term=tag%3Asyntax%20highlighting&target=VS&category=All%20categories&vsVersion=vs15&sortBy=Relevance
Use color coder https://marketplace.visualstudio.com/items?itemName=Xellarix.ColorCoder
extension
also, you can customize the color for different types
I use VS2019 as my personal IDE but for my company labtop I still use 2017 because they provide professional license.
I want to have the same text color theme on my both IDE for consistency and I found this extension.
https://marketplace.visualstudio.com/items?itemName=StanislavKuzmichArtStea1th.EnhancedSyntaxHighlighting
This theme is pretty similar to the theme when you enable "use enhanced colors for c# and basic" in VS2019.
My understanding is that this is a new feature in the C# and VB language editors - in other words, these are new features/settings in VS2019 that simply don't exist in VS2017.

Shortcuts don't work in Fortran (Visual Studio 2013)

I'm programming in Fortran90 within the environment Visual Studio 2013.
I want to format my code in a clever and easy way and I tried to use shortcuts (like Ctrl + I Matlab smart indent) but it didn't work out. It's actually really strange as I tried to use Ctrl+K, Ctrl+D but it is not working and I don't understand why...
Is there someone that can help?
Many thanks,
Antonio
Each language in Visual Studio has its own predefined shortcuts, and of course you can add your own key combinations. For Intel Fortran there is no "smart indent" but there is an indent option for which no shortcut is predefined. To see what's available, select some text and then do Edit > Advanced. For example, CTRL-K,CTRL-C will comment the selection.

Coderush express seems doesn't work

I installed Coderush express and I can see that it is installed. (I can see that Camel Case Navigation works). But I can see any other feature works. Based on this page: http://community.devexpress.com/blogs/markmiller/archive/2009/06/25/coderush-xpress-for-c-and-visual-basic-2008.aspx
I cannot see any of these feature to works:
Tab to Next Reference : no effect when I put caret on a variable and press tab ( a tab inserted at the middle of my variable name!)
Highlight All References: pressing ctrl+alt +u add a ascii character to source code.
Quick Navigation: Ctrl +Shift + Q has no effect.
Quick File Navigation : Ctrl +Alt +F brings up F# interactive
Selection Increase and Selection Reduce doesn't work: generate a beep
Declare: ctrl +` has no effect.
and ...
Any idea why this is happening? I am using VS2010.
Presumably due to your using a different version of Visual Studio.
The page you linked to is pretty clear about it being for Visual Studio 2008, but you've included the visual-studio-2010 tag.
CodeRush Xpress fully supports all language features of Visual Basic and C# in Visual Studio 2008.
Edit
Version of Visual Studio wasn't the problem after all.
It appears to just be that the tool makes very little visible change to the Visual Studio user interface, so it looks like it hasn't loaded.
It seems that your installation is corrupt. I would recommend you contact DevExpress Support directly. The support team is better equipped to resolve any issues you face with their products. They offer a very short response time and high qualification. I would also recommend that you reinstall the product.
The features you are asking about, were removed on purpose from VS2010 version of Coderush XPress. More info here:
Experience with Coderush XPress and Visual Studio 2010?

In Visual Studio 2008, how can I make control+click do a "Go To Definition"?

In the Delphi IDE, you can hold control and click on a method to jump to its definition. In VS2008, you have to right-click and select "Go To Definition".
I use this function quite often, so I'd really like to get VS to behave like Delphi in this regard - its so much quicker to ctrl+click.
I don't think there's a way to get this working in base VS2008 - am I wrong? Or maybe there's a plugin I could use?
Edit: Click then F12 does work - but isn't really a good solution for me.. It's still way slower than ctrl+click.
I might try AutoHotkey, since I'm already running it for something else.
Edit: AutoHotkey worked for me. Here's my script:
SetTitleMatchMode RegEx
#IfWinActive, .* - Microsoft Visual Studio
^LButton::Send {click}{f12}
Not for Visual Studio 2008, but if you upgrade to Visual Studio 2010, you can use the free
Visual Studio 2010 Pro Power Tools from Microsoft to achieve this.
You could create an Autohotkey script that does that. When you ctrl-click a word, send a doubleclick then a F12.
I don't have AHK handy so I can't try and sketch some code but it should be pretty easy; the AHK recorder should have enough features to let you create it in a point 'n' click fashion and IIRC it is smart enough to let you limit this behaviour to windows of a certain class only.
When you have your script ready just run the script in the background while you code. It takes just an icon in the Notify bar.
Visual Studio 2008 defaults this to F12, but you can set it in Tools | Options | Environment | Keyboard, and change Edit.GoToDefinition - however, I'm not sure how you can get it to CTRL+mouseclick.
Resharper does that but it's not free.
Highly recommended plugin though, most experienced .NET developers use it.
Just a quick note that the following AutoHotkey script works for me in Visual C++ 2010 Express.
SetTitleMatchMode 2
#IfWinActive, Microsoft Visual C++ 2010 Express
^LButton::Send {click}{f12}
I also changed the shortcuts for View.NavigateForward and View.NavigateBackward to Alt+Right/Left Arrow since I am used to Eclipse.
Yes, both Resharper (a must have!) and Productivity Power Tools have this feature.
Interesting quirk, though.
If you just go with the defaults on both tools (if you install both tools) you can experience a frequent double-jump problem (jump to definition from where you first click and then jump again from what your cursor is above upon getting to that first definition) until you turn off one of the Ctrl-Click features of these add-ons.
Put the mouse cursor on the method name or any identifier, and press F12

Resources