How can I change the line style of the indent guides? - visual-studio-2017

Visual Studio 2017 comes with built-in support for indent guides:
Indent Guides ­– dotted, gray vertical lines act as landmarks in code to provide context within your frame of view. You may recognize these from the popular Productivity Power Tools.
Here's a screenshot demonstrating this:
I've been using Steve Dower's Indent Guides extension for years now, which supports changing the line style:
Is it possible to change the line style in VS 2017? I had a look in the Options but couldn't find anything relevant.

From everything I can see, there is unfortunately no way to do this, aside from using a different extension. If you use ctrl+Q to search (FYI, ctrl+Q is a great feature that many people don't notice), and search for "guide" you will see it only returns a single configuration option:
Text Editor -> General -> Show structure guide lines
So apparently, all you can do is turn it on or off and change the color of the lines. This can be done by going to Environment -> Fonts and Colors and looking for "Structure Guide Lines."

Related

Excessive cursor reference highlighting VS Community

so I have been using VS Community for a while now to code in c++ and somehow must have activated reference hightlighting. Now every time my cursor is inside a word it highlights every occurence in the entire file. This gets very confusing especially inside nested loops:
I tried looking for reference highlighting but could only find it in the C# section in the options.
I also tried changing the background color of the highlight to the background color of the plain text but this still draws the rectangle highlight box around it.
Is there no way to disable this cursor highlighting for c++? Basicly I only want the highlight to show when I actually hightlight stuff.
If you want to disable all cursor highlighting, you could set True in Tools->Options->Text Editor->C/C++->Advanced->References->Disable Reference Highlighting.
If you want to customize the cursor highlighting, here is a solution for reference.
This tip was proposed by Sairama Jamalapuram. Syntax coloring for user-defined keywords is used for C++ files only.
Here are the steps you need to take to enable syntax coloring for user-defined keywords. The steps are taken from the online help.
In the same directory as msdev.exe (for Visual Studio .Net search
for ...\Microsoft Visual Studio.NET\Common7\IDE\devenv.exe), use the
Text editor or Windows Notepad to create a text-only file named
usertype.dat.
Add your keywords to usertype.dat, one keyword per line. Note: The
usertype.dat file is read during initialization. It cannot be
renamed, nor can it be reloaded during an editing session. The
syntax coloring mechanism checks the usertype.dat file last. Thus,
all previously defined color settings take precedence over the
user-defined keywords.
Save the file as a text-only file, exit, and then restart Visual
Studio.
From the Tools menu, choose Options.
Select the Format tab.
In the Colors box, select User Defined Keywords.
Set the font, font size, foreground color, and background color to
your preferences.
Click OK.
Restart DevStudio.

Vim isnt highlighting basic types in c/c++

I have recently started using vim and i see my syntax files are located in /usr/share/vim/vim74 (I'm on linux Mint) and my c.vim seems to make the basic things like int and double keywords however when I edit any c or c++ files none of the types are highlighted however some things like const are highlighted. I am not sure why this is happening. Can anyone help me out?
To check whether the syntax parsing works as expected, check (when editing a C / C++ file) with
:syntax list
that those keywords (like int) are defined. You'll also get a preview of the highlight coloring there. Alternatively, the colors are shown via
:highlight
To change those, you have to switch to another :colorscheme or edit / augment the current one.
For advanced troubleshooting, I recommend the SyntaxAttr.vim - Show syntax highlighting attributes of character under cursor plugin.

Commit C++ Intellisense suggestion with space bar in VS 2013

I have recently been exploring C++ some after using C# exclusively for quite awhile. I'm using Visual Studio 2013 and the one thing that is bugging me to death is the inability to commit an Intellisense suggestion by pressing the space bar. I have tried to edit the commit character list in Options -> Text Editor -> C/C++ -> Advanced to accept the space bar but so far I've had no luck. Coming from C# this is very aggravating. Does anybody know if it's possible to make such a change? I know I can use Tab or Enter, but in my opinion using Space is far more fluid.
Any information would be greatly appreciated.
UPDATE: Space seems to commit some suggestions but not others. if I type "std::stri", it commits "std::string". Unfortunately, Intellisense won't commit anything created by me or even common keywords. It just adds a space after what I already typed.
Further to my comment on your question, I have installed the trial version of Visual Studio 2013 (Ultimate), and can confirm that space bar does work to complete IntelliSense suggestions. Combining all comments, it would appear that it works in the following versions:
VS 2010
VS 2012
VS 2013
Here is a screenshot of my IntelliSense settings located at Tools > Options > Text Editor > C/C++ > Advanced:
As a last resort you may want to try changing all your settings back to default, as suggested in this answer:
Tools > Import and Export Settings > Reset all settings
UPDATE: After reading JoshC's comments, I have experimented a bit more and I get the problem too. It appears to be related to whether or not the item you are trying to autocomplete is a member of a type or namespace. If it is (e.g. std::string) then space will work. If it is not (e.g. void) then it will not work (but for some reason, tab will work). As per this link, you can manually invoke the "List Members feature" by pressing CTRL+J in which case on a blank line it will include items which are in the global namespace - however this is clearly not a practical solution.
I have no idea why it discriminates between space and tab in this way. If anyone is aware of a workaround please let me know and I will edit this answer again.
The following would seem to imply that there is no solution for C++:
http://visualstudio.uservoice.com/forums/121579-visual-studio/suggestions/2656132-support-committed-by-pressing-the-space-bar-in-c
When using Visual Studios 2012 for coding in C++, how do you autocomplete code selected in IntelliSense? (see comments)

How do I turn off auto-formatting in VS2013 for C++?

VS2013 has added auto-formatting for C++. My personal opinion on auto-formatting is that it's ultimately harmful for developers but I have to accept not everyone agrees. What bugs me is that I can't seem to disable auto-formatting completely. I have unchecked every checkbox under Tools->Text Editor->C/C++->Formatting->General yet when I type:
void f ()
VS2013 replaces this with
void f()
That's not the code-standard in this specific project which means I have to go back and insert a space. There are other examples where I have to fight against VS.
I don't want to change the spacing settings because
I work in multiple projects with different code standards
I don't believe in auto-formatting so I just want it to get out of my way
I just want VS to not modify my code automatically.
PS. I am not against that VS can format code but I want to invoke that manually
You can turn off automatic C / C++ /C# code formatting by going to the Options dialog from the Tools menu, selecting the Text Editor → C / C++ / C# → Formatting → General page, and unchecking all the boxes there. You'll still be able to manually format when all of the auto-formatting settings are turned off.
I know this isn't exactly the answer you're looking for, but you can preserver that void f () formatting if you go to Tools > Options > Text Editor > C/C++ > Formatting > Spacing and under Spacing for function parantheses you check the option Insert space between function names and opening parentheses of argument list.
I also had this problem and unchecking all the checkboxes in the formatting options did not help.
It turned out that this was caused by an option in the plugin “Visual Assist X” from Whole Tomato Software.
In my case this problem could be solved by going to “Visual Assist Options”-->”Corrections” and unchecking the Checkbox “Format after paste”.
It's a bug in VS 2013 beta that it cannot be turned off completely, see issue submitted by FuleSnabel: http://connect.microsoft.com/VisualStudio/feedback/details/797716/turning-off-auto-formatting-for-vs2013-c-only-seems-to-partial-disable-auto-formatting.
Some possible workarounds:
If you just peek into some projects which have different/weird style: if an unwanted auto-formatting happens, then you can perform one undo step, this should undo only the auto formatting part of the operation and not your contribution. Fortunately these two (or sometimes more auto formatting steps) are not grouped together into one command probably for this exact reason: you can go back and override it. It is annoying though if that happens all the time. You can configure the behavior to match your style, but you say you have project with different code styles.
Tools/Import and Export Settings... - you can export the specific settings for a certain project and then import it later. This will save .vssettings XML format file. If it's about just a specific file type, than it can be just a few kilobytes long. Unfortunately this requires manual steps. The best would be if these settings could be overridden from the solution configuration file or even the project configuration file, could be part of them.
Note, that this second point is problematic if you really work parallel in your projects with simultaneously open Visual Studios. In this case that settings will be saved finally what the last closed VS instance had I think.
Having different auto formatting saved for solutions can be a feature request for next release (certainly not make it to VS 2013). What I usually come across is the tab/space indentation behavior differences, it's the most common difference in project styles. Indentation also can be configured individually for most file types, but as as in your case, projects can differ, and then it becomes annoying.
Just remember that resharper can also override the indentation/formatting settings. You can turn that off by doing this
ReSharper -> Options -> Environment -> Editor -> Editor Behaviour -> Auto-format on closing brace (un-check this).
To turn off automatic brace completion, go to:
Tools > Options > Text Editor > All Languages > General > Automatic brace completion
...then uncheck "Automatic brace completion".
Go to:
Tools->Options->Text Editor->C/C++->Formatting->Spacing
Then deselect or select the boxes that pertain to the code type you are writing.

Eclipse copy code with syntax highlighting

I'm writing a document of programming guidelines for my developers team. I use MS Word. We work with Eclipse CDT (C++). I need to copy-paste C++ code with syntax highlighting from Eclipse to Word. I've tried Notepad++ and it can export text with syntax highlighting, but it's highlighting is limited to basic syntax (it doesn't know about defined class, enum etc...).
Eclipse syntax highlighting is very powerful and I wish to export directly from Eclipse to Word using it's syntax highlighting.
Is there any Eclipse plugin that achieve this purpose? Or some trick to do it (without taking a screen snapshot)?
When you copy the code to word document, you can choose the option "keep source formatting" and the highlighting will be the same as the one in eclipse.
EDIT:
As mentioned in the comments below, this won't work on folded code, so you can right click on the line numbers and select Folding > Expand All
EDIT 2:
Also mentioned in the comments, as of eclipse oxygen, the code is automatically copied with syntax highlighting
When I copy from Eclipse straight to PowerPoint some of the formatting is messed up. Bold and color seems to "keep going". But if I copy from Eclipse to Word -- and then from Word to PowerPoint (with the keep source formatting CNTRL-K) -- the formatting is correct. I recently upgraded Eclipse to Mars and Office to 2013. I still have to go through Word first.
I was trying it too and for some reason not every compile unit would keep the formating.
After a while I've seen that you also won't get the formating kept if there are parts of the code hidden, so for the ones that cannot make it work with the answers above, just make sure that there are no "+" signs on the left of your code (mine were where the imports at the beggining).
Copying of formatting is supported since version 3.2
Note that everything is copied: highlighting of spelling errors, marked variables/types/etc and underscoring of warnings/errors.
To avoid that, turn off spell checking, "Mark Occurrences" and "Report problems as you type" respectively.