Is there a way to hide the clumsy and verbose namespace expression from the Quick Info of classes in VS?
I don't want this:
I want this:
Is there a way to make the class names displayed a bit cleaner like this? It is plain unreadable for the moment. I am thinking of some plugins like ReSharper, CodeRush, JustCode etc.
If you are adding a new class in your code then you may need to add the correspondence namespaces. To do it, you may either manually type the Using Namespace or you just right click on the class name and select Resolve > Namespace. But using “Ctrl+.” you can automatically add the namespace in your code.
IntelliSense is a code-completion aid that includes a number of features: List Members, Parameter Info, Quick Info, and Complete Word. These features help you to learn more about the code you're using, keep track of the parameters you're typing, and add calls to properties and methods with only a few keystrokes.
Could you please confirm which version (and any updates) of Visual Studio you are using? I do see Visual Sudio 2013 as a tag in your question.
Also, is it possible to provide a screenshot of the code without the Quick Info displayed, but, highlight the exact location in your code that you were trying to display Quick Info for?
As mentioned elsewhere, Resharper can be used to enhance intellisense. i.e. one can choose whether or not to use the default Visual Studio, or Resharper, intellisense provider. But, while Resharper enhances syntax completion and display of parameters, this does not affect Quick Info, in the example given in the question. Quick Info is a tooltip, that by default, is displayed automatically when mousing over a symbol or variable.
In Visual Studio 2010, it was possible to write an extension to override intellisense, to display your own custom tooltip.
IntellisensePresenter
In Visual Studio 2013, there is no built in option to allow customisation.
Visual Studio Ultimate 2013, with Update 4, without Resharper:
Displays the following Quick Info for a Generic Dictionary:
In Visual Studio 2015 (currently Release Candidate), the intellisense tooltip for Quick Info is altered, with increased readability:
Revisiting the example given in the question, and using a simple line of code as a test with a Dictionary containing another Dictionary:
Dictionary<string, Dictionary<string, int>> dict;
In Visual Studio 2013 Ultimate, Update 4, with or without Resharper latest, the following is displayed:
In Visual Studio 2015 RC, with or without Resharper latest, the following is displayed:
Note that Visual Studio 2015 has changed the way that Quick Info is displayed, and is close to the desired outcome. In this instance, ReSharper, although an excellent tool, does not affect Quick Info.
Visual Studio 2015 RC Quick Info behaviour
To validate that custom types exhibit the same behaviour as described above in Visual Studio 2015 RC, a simple class is created, in a new namespace:
namespace StackAnswer
{
class MyClass
{
public int MyProperty
{
get; set;
}
}
}
Referencing the type using its 'fully qualified' name (i.e without a using statement):
Dictionary<string, Dictionary<string, StackAnswer.MyClass>> dict;
Displays the following:
Adding a using statement:
using StackAnswer;
And altering the reference to the type to not be 'fully qualified':
Dictionary<string, Dictionary<string, MyClass>> dict;
Indicates that Visual Studio 2015 RC displays the name according to the reference declaration:
This is possibly behaviour allowed by use of the Rosyln compiler.
Resharper's "Quick Documentation"
If using Resharper's "Quick Documentation" feature that is opened via a key combination (which is not Visual Studio Quick Info that is displayed on mouse over, as mentioned in the question), the namespaces are indeed shortened. Two screenshots below taken in Visual Studio 2013:
Additional note: background information regarding Quick Info
Visual Assist, an extension for Visual Studio, does possess the ability to enhance, and potentially replace the Quick Info tooltip - if built-in Quick Info is turned off.
Quick Info in Visual Assist
However, currently, in Visual Studio (up to and including 2015 RC), the ability to turn off the built in Quick Info is only available for the C/C++ language; therefore it is unlikely that any tool will presently be able to achieve the exact desired behaviour as mentioned in the original question, which is related to the C# language.
(If using C/C++ this can be found via Tools > Options > Text Editor > C/C++ > Advanced >Auto Quick Info.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With