VS Code C# XML Documentation [duplicate] - c#

This question already has answers here:
XML Auto Commenting C# in Visual Studio Code
(3 answers)
Closed 8 months ago.
I'm on Visual Studio Code and I'm wondering what the shortcut is for creating documentation in C# for functions, variables, and classes since in VS Studio it's just pressing / three times.

Update Dec 16, 2020
This is now included in the default c# extension as of v1.23.8
You'll have to go to Preferences > Text Editor > Formatting and enable Format on Type
Or add the following in your settings.json file:
{
"editor.formatOnType": true,
}
Then adding three slashes /// above a member will auto-generate the XML doc comment.

I didn't find any shortcuts in VS Code. I tried search on Stack but it gave me "how to toggle the function comment on hover".
I looked up on the extensions and saw this
https://marketplace.visualstudio.com/items?itemName=k--kato.docomment
It works similar to Visual Studio where you have to press / three times.

Related

Visual Studio Code - Why is it removing my indentation? [duplicate]

This question already has answers here:
How to prevent VS Code from auto-deleting tabs on an empty line?
(2 answers)
Closed 1 year ago.
I have this problem that Visual Studio Code doesn't detect indentation properly when moving around with cursor, and actually removes indentation automatically that I have manually added.
Why is it doing this? How do you configure it? Can't seem to find the setting!
Maybe is one of your extensions, have you tried to disable some of then to see if helps ?

Visual studio no collapse / expand option [duplicate]

This question already has an answer here:
Visual Studio 2017 does not show collapse icon for js file
(1 answer)
Closed 2 years ago.
Im using visual studio community and i cant collapse / expand parts of my code anymore. The plus / minus symbol is just gone. So now i cant collapse functions, loops etc.
Go to Settings and set
"editor.folding": true
"editor.foldingStrategy": "auto"
"editor.showFoldingControls": "always"

Typing "ctor" to create constructor [duplicate]

This question already has answers here:
How do I generate a constructor from class fields using Visual Studio (and/or ReSharper)?
(12 answers)
Code snippet or shortcut to create a constructor in Visual Studio
(17 answers)
Closed 5 years ago.
I've seen a video here where a coder types "ctor" at 4:42, and the IDE automatically creates a constructor for him.
I tried to do the same, but for me, the IDE doesn't do that. IntelliSense does offer "ctor", but when I select it, nothing happens.
What is the trick that I'm missing?
Can you please check your Code Snippets Manager (Ctrl + K, Ctrl + B) if there are Visual C# file in Csharp language?
Code Snippets Manager
Go to menu Tools → Options → Text Editor → C# → IntelliSense, under the Snippets behaviour section: Make sure "Always include snippets" is selected.

how to export code from visual studio as a document [duplicate]

This question already has answers here:
Visual Studio: Export C# Code into a PDF file and keep the formatting + colors?
(4 answers)
Closed 6 years ago.
I have a code that I need to put in a document for my coursework but I would like to keep all the formatting and line numbers. Is there any way of doing that?
Copy and paste it.
Ms Word will retain the formatting.
Other text editors might as well.

Can Visual Studio editor convert from all-caps to camel case? [duplicate]

This question already has answers here:
Is it possible to replace to uppercase in Visual Studio?
(3 answers)
Closed 9 years ago.
Is there a command or an addin in Visual Studio 2012 that would convert a selected piece of C# source code from SOME_NAME to SomeName?
I use resharper 7.0. It has rules on naming conventions so when I have stuff named SOME_NAME it will let me know and It will change it to the name based on the rule convention.
it will also apply naming convention to change that variable name to the code in which uses it.
I have no idea if resharper will do it all for you at once though. I've only used it for one off stuff.
When I had to do this in the past, I used the following steps:
Select the text OME_NAME and press Ctrl+U (convert text to lower case).
Select the text _n and type N.
Press Alt+Shift+F10 (show smart tag) to apply a rename refactoring.
Short answer no, but You can do a macro and use it or use some productivity tools as resharper.
As far as I know the only built in case shortcuts are to change to all uppercase or all lowercase. Here's the MSDN documentation for the case shortcuts in Visual Studio 2012: http://msdn.microsoft.com/en-us/library/ms165341.aspx

Categories