Visual Studio - autocomplete a symbol from any namespace (alternative to Resharper) - visual-studio-2012

Is there any way beside Resharper to get autocompletion on symbols that are not currently imported in a file?
Current behavior is that I can get autocompletion on all imported symbols, for example by using first letter of every part of symbol's name.
Visual Studio is aware of namespaces though, as it offers import when you write exact name of non-imported symbol.

Related

Is there a way to enable interactive search in properties window?

I just started to use Android Studio and wondering if there is a way to search interactively in property window.
I mean like Xcode does. (It's not a properties, though.)
Is there a plugin or configuration for the function like this?
Android Studio actually has a search tool for properties similar to the one in Xcode. But it's implemented in a very unusual and un-intuitive way. Which makes it hard to find.
In Android Studio version 1.5.1, you have to click either on the 'Properties' header or any property-name below the header, and then you need to start typing the property you want, even though there is no text-box or any other indication that your typing will produce any effect.
When you do this, then a text-box appears with the characters you've typed in. And Android Studio highlights all the properties that contain your character sequence. You can then look only at the highlighted properties to find the one you want.
There is no filter like in Xcode, but if you start typing property name the selection will jump to the first match and the rest of the matches will be highlighted.

%(AdditionalIncludeDirectories) meaning

Think this will be rather simple but somehow I could not find a reference saying about this.
In the MSVC Include directories, there is an Additional Include Directories setting. The setting reads like this
..\Project1; %(AdditionalIncludeDirectories)
Understand the first part is the path for the program to search for additional program header includes. What about " %(AdditionalIncludeDirectories) " ? what does it mean?
It does not seem to be a macro which I understand is headed by "$" eg $MACRO
Thanks
Answer
In the documentation for Working with Project Properties there is a section on "item macros":
Item macros
Has the syntax %(name). For a file, an item macro applies only to that file—for example, you can use %(AdditionalIncludeDirectories) to specify include directories that apply only to a particular file. This kind of item macro corresponds to an ItemGroup metadata in MSBuild. When it's used in the context of a project configuration, an item macro applies to all files of a certain type. For example, the C/C++ Preprocessor Definitions configuration property can take a %(PreprocessorDefinitions) item macro that applies to all .cpp files in the project. This kind of item macro corresponds to an ItemDefinitionGroup metadata in MSBuild. For more information, see Item Definitions.
Discussion
I had exactly the same problem in a project I am taking over from a former developer : his Additional Include Directories are C:\Users\t-tshmit\Downloads\DirectXTK;$(ProjectDir);$(IntermediateOutputPath);%(AdditionalIncludeDirectories)
And oddly the %(AdditionalIncludeDirectories) element is not included in the edit box
Looking around the web I could not find much on this, but it is clearly a pattern in use, for example the screenshot used in http://www.steptools.com/support/stdev_docs/help/settings_vc10.html may contain the %(AdditionalIncludeDirectories) element.
The documentation for both the Additional Include Directories compiler options and the AdditionalIncludeDirectories VCCL Compiler Tool property contain no mention of this %(NAME) pattern.
https://learn.microsoft.com/en-us/cpp/build/reference/common-macros-for-build-commands-and-properties?view=vs-2019
They are called "item metadata macros."
The build system for C++ was significantly changed between Visual
Studio 2008 and Visual Studio 2010. Many macros used in earlier
project types have been changed to new ones. These macros are no
longer used or have been replaced by one or more equivalent properties
or item metadata macro (%(name)) values. Macros that are marked
"migrated" can be updated by the project migration tool. If the
project that contains the macro is migrated from Visual Studio 2008 or
earlier to Visual Studio 2010, Visual Studio converts the macro to the
equivalent current macro. Later versions of Visual Studio can't
convert projects from Visual Studio 2008 and earlier to the new
project type. You must convert these projects in two steps; first
convert them to Visual Studio 2010, and then convert the result to
your newer version of Visual Studio. For more information, see
Overview of potential upgrade issues.

How to get XML comments to appear in Visual Studio Class Wizard decriptions

I have put XML comments in a C++ source file that IntelliSense appears to pick up and use. It creates a project xml file, and IntelliSense works when I edit the original source file (showing me comments when I'm selecting a member function or entering parameters).
But, when I go to the Class Wizard in Visual Studio 2012 Express, the entered descriptions don't appear anywhere (on the methods, for example, down at the bottom of the dialog, where description remains sadly empty). For that matter, IntelliSense only works in the original file(s), so when using a call in a separate file, none of my XML comments get picked up. Why does it only work in the original source file? What have I neglected to do?
I don't think you've neglected to do anything, unfortunately.
The Class Wizard was built long before Visual Studio supported XML doc comments, so it's more likely that no one remembered/cared to go back add support for them to the Class Wizard dialog.
In my experience, although it sounds like you've had slightly better luck, XML doc comments are not particularly well supported when using C++. For example, VS 2012 was the first version to support them in IntelliSense (and even that is incomplete). You get nothing in VS 2010 and earlier versions, despite the fact that they'll happily output a project XML file. That pathetic lack of support, combined with the angle bracket tax, drove me to switch to Doxygen when writing C++ code.

Specify include paths individually per source file for Visual Studio C++

Is it possible to specify include paths individually for each soucre *.cpp file?
Eclipse uses this method for code assistance, see Discovery Options properties
In Visual Studio 2010, all I can see is that one can only define the include paths project-wide.
It would be nice if this individual information could then be used for the IntelliSense compiler to parse only the current active source file.
As far as I know IntelliSense parses all files at once, which I think is not appropriate for verly large projects.

How to tell ReSharper to sort usings with system namespaces NOT at the top?

Visual Studio has an option to place system directives at the top when sorting them.
When this setting is unchecked, sorting using statements by right-clicking on them and using the Organize Usings feature, places System namespaces alphabetically along all other namespace imports.
However, ReSharper does not seem to honor this setting, nor does it have anything similar on its own Namespace Imports options page. It always behaves as if you want System namespaces at the top. This is especially annoying when you already have some at the bottom and you let ReSharper suggest a namespace to import, then you end up with some at both ends of the list.
Is there some way to fix this? Or is this just a bug/oversight in ReSharper?
I am using ReSharper 7 and at least for me ReSharper takes the "System directive sorting option" from Visual Studio options.
Sometimes when VS and ReSharper settings get messed it helps to reset Visual Studio settings from Tool->Import and Export Settings->Reset all settings.
I was testing this again under ReSharper 8 to see if it's been fixed, and I noticed something interesting:
If my existing namespaces already have System items first, then ReSharper will insert new namespaces below them.
If my existing namespaces have at least one item before the System items, then ReSharper will insert new namespaces alphabetically.
ReSharper's behavior is the same regardless of the setting of Visual Studio. It only takes into consideration the existing namespaces - not the setting of Visual Studio.
So if I have the following:
using A;
using System;
using Z;
Then if I use a class from namespace B and alt-enter to let ReSharper add the namespace, it will end up as:
using A;
using B;
using System;
using Z;
BUT, if I just have this:
using System;
using Z;
And I do the same exact thing, then I'll get:
using System;
using B;
using Z;
And it doesn't matter what VS's setting is.
I assume this is what was happening in ReSharper 7 also and I just didn't notice.
If I cut all the usings, then I paste them where they were, and then do the sorting, it seems to respect the option:
Place 'System' directives first when sorting usings
I'm testing this on Visual Studio Community 2017 and Resharper 2018.3.4.
Versions: Resharper 2021.2 and VS Studio 2019 Professional
The setting concerned with the issue was checked by default on Resharper:
However, this alone did not put 'System' usings first.
But upon checking the VS Studio setting, Ctrl+R,Ctrl+ G works as expected:
ReSharper | Options | Code Editing | C# | Syntax Style | Reference Qualification and 'using' Directives | Place 'System.*' and 'Windows.*' namespaces first when sorting 'using' directives
Deselect it.
See also this ReSharper help document: Code Syntax Style: Namespace Imports - Configure namespace imports preferences
For ReSharper 2019.2.3
ReSharper -> Options -> Code Editing -> C# ->
Code Style -> Reference Qualification and 'using' Directives
and then uncheck the checkbox
🔲 Place 'System.*' and 'Windows.*' namespaces first when sorting 'using' directives

Resources