In Visual C# 2008 Express, the IntelliSense is great, e.g. I only have to type Conso.( and it will insert Console.Write(
That works as follows:
(i) Conso is enough disambiguation to select Console in the list; (ii) typing . automatically inserts that highlighted word and adds the dot too; (iii) now the dropdown list shows Console's members, defaulting to Write [based on my usage frequency?], (iv) now typing ( automatically inserts that highlighted word and adds the bracket too.
Note that I did not need to type any of the letters of Write, nor all of Console, nor did I have to press Space, Tab, Enter etc. to confirm anything.
I have now upgraded to VS 2017 and the autocomplete works differently. You have to press special keys (Tab, Enter etc.) to insert the word from the list. It won't insert the highlighted item for you automatically as soon as you move on to the next punctuation.
Having to select all these list items manually is murdering my productivity. I can see some autocomplete options in the Tools>Options but I find nothing that can achieve what I had in C# 2008. Is it still possible? How?
It seems this issue was removed from the VS 2017 and VS 2015, I tried to help you report this user voice to the VS Product Team, please check this: C#>Intellisense: please auto pre-select the common used members like the previous VS version and you can also add a comment in there to trace the feedback from the VS Product Team engineers.
Related
I use both Delphi and Visual Studio (C#), and I've noticed a difference in how code-completion works which I find really annoying. In Delphi, if you edit existing code so that you change the variable you're using, code completion will give hints based on the code before your cursor. For instance, inserting an "I" into myString to become myIString would give a code hint to show any available variables starting with "myI". Selecting one will then overwrite myString with the new one.
In Visual Studio doing the same thing brings up a code-completion menu with all available variables, and none selected so you see the top of the list. You have to completely delete the variable you're using and start again before you get meaningful code completion.
I seem to make changes like this quite often (maybe I should just get it right in the first place!) so it gets a bit annoying having to remove code, and can be trickier on longer lines with lots of parts to them.
Here's some screenshots which (hopefully) illustrate the difference. I was struggling how best to word this!
Code completion in Delphi
Code completion in Visual Studio
I've tried playing with the Intellisense settings in Visual Studio and there's nothing there which seems to change the behaviour. Is there any way of replicating it in C#?
I've tried playing with the Intellisense settings in Visual Studio and
there's nothing there which seems to change the behaviour. Is there
any way of replicating it in C#?
For now, VS doesn't support for this behavior. The auto completion won't work when we insert a character into existing variable. It will take effect when we type a character in a empty place.
Type character in a new place, the intellisense works.
Insert character,the intellisense not works.
In my opinion your suggestions is really meaningful. I think it could be better if we have a new option to support for auto-completion when insert character, so I suggest you can Go=>Help=>Seed Feedback=>Provide a suggestion to post your idea there.
We who interested in it will vote for you if you share the link here.
As alternative ways:
You can go Tools=>Options=>Text Editor=>C#=>Intellisense=>Enable Show Completion list after a character is deleted option.
Then you can insert 'i', the statement could be myiSring1.GetType(); And delete any or all characters in the String1,it would show the intellisense like below:(e.g:I delete 'r'.) Apparently, this is what you really want, but as I mentioned above, VS itself doesn't support this behavior for now, hope you can use 'delete option' saves some time. Sorry for the inconvenience.
Also, you can check if ReSharper can meet your needs,since it's a third-party tool which seems to charge after xx-days trial, I have no further details for it.
Hope all above helps :)
Whenever I use Go To on Visual studio 2017 and I start typing something it will just find the first occurrence of whatever I typed and go to that file without showing me a list of Classes / Methods like it used to do before. Right now I don't see any list of possible results and it's making it pretty hard to navigate my code. I have been looking online and couldn't find a solution to this. What can I do to get that list of results to show up?
In Visual Studio Professional 2010 whenever I type the following:
new {
It automatically changes to:
new object {
Is there a way to make it not do this? "Object" does not have the properties of the object I want to anonymously create.
https://connect.microsoft.com/VisualStudio/feedback/details/584429/autocomplete-on-new-is-interpreted-as-a-new-function-instead-of-anonymous-class
I'm pretty sure it's a bug, so I went ahead and reported it. Was going to do it sooner or later anyway :)
Hope that's okay with you.
You can disable the IntelliSense completing when you type the bracket.
On the Tools menu select Options. Then, on the right hand side, expand Text Editor then C# then IntelliSense. Remove the { from the textbox under the Committed by typing the following characters:
You may also have to uncheck the Committed by pressing the space bar or get in the habit of writing new{ and relying on the auto formatting when you close the bracket (though I've never done any ASPX stuff so don't know how good the auto formatting is compared to a normal code file.)
I've just gotten in the habit of typing "new{}". Intellisense doesn't kick in then. And since I'm always reformatting the page anyways with crtl-k;crtl-d, it spaces it out correctly later on.
This question already has answers here:
Closed 13 years ago.
Possible Duplicate:
How do I stop visual studio from automatically inserting asterisk during a block comment?
When adding a multi-line comment in Visual Studio, it automatically places an asterisk (*) at the beginning of a new line (on enter) inside the comment block. I personally find this a nuisance. Does anyone know how to disable it? Thanks.
Found this answer for you online (see here):
This works with Visual Studio 2005 and 2008:
in the IDE, go to Tools->Import and Export Settings; then Export selected environment settings; deselect everything except Options->Text Editor; save to a new file.
Edit your exported settings file in some text editor. Search for the string "AutoComment". There's a PropertyValue tag with value 1, change it to 0, and save the file.
in the IDE, import this new file using Tools->Import and Export Settings. It should stop formatting comments right away.
To be clear, I haven't tested it myself yet . . . please let us know if it works for you.
Update:
Another way, as posted in the previous question on this (linked by Rob van Groenewoud, above)
Tools > Options... > Text Editor > C# > Advanced > Uncheck "Generate XML Documentation comments for ///".
(Of course, in addition to getting rid of the automatic * in block comments, this will disable the autoformatting when you type "///", as it says.)
It sounds like the solution I gave above does the same thing, but by editing the settings file itself instead of using the menu options.
I would have left this as a comment on John Saunders' answer, but alas, my rep is not high enough :)
Vertical Selections
If you'd rather not be editing settings files, or you want to keep the automatic xml comment generation on typing "///", you could use vertical highlighting to select all the asterices and hit delete. Visual Studio, like Microsoft Office, gives you the ability to select a "column" of text: just hold alt and click-drag your selection across several lines.
It's possible you know this already, but it's still worth mentioning.
When user the "Implement Inteface X" context menu feature, the inserted code gets surrounded by a
#region [interfacename] Members
#endregion
pair. I always end up deleting this, is there a way I can permanently turn it off? I had a quick search through the snippets directory, but wasn't sure if this was the right place. There's pp_region.snippet that I guess I could modify, but I got the feeling that would turn off the #region/#endregion completely. I thought I'd ask here before I go doing things that will have me re-installing VS...
You can turn it off via Tools / Options
Then, in the option-window, you select 'Text Editor', then the language of your choice (C# for ex).
Then, you select 'Advanced', and then, you have a checkbox which says:
'Surround generated code with #region'
Also, if you're using Resharper you can fully configure the layout of your classes so they'll look exactly the way you want. One of the options is to completely remove the region tags whenever it finds any. It's awesome to open any c# project and have it reformatted just by doing [CTRL+E, C]