I'm using Visual Studio 2017 to edit the scripts for Unity 3D Project.
In a script, I want to create a new function "Move", but I get a problem with autocomplete.
If I write "public void Move"
I get a a proposal "OnAnimatorMove", but I don't need this function!
Now, after "Move" I enter a space character " ", but my function name is then automatically replaced by "OnAnimatorMove" and the "{","}" are automatically inserted.
Same happens, if I try to insert "(" character after "Move".
How can I prevent it?
U can click escape to disable the autocompletion or u can disble it all together by going to
VS > Tools > Options > Tools for unity > and under 'code edition' disable Unity massage code completion.
after that restart
I can solve it, going to Edit->Preferences->External Tools, and in External Script Editor, select Visual Studio 2017 (Enterprise)
Related
I downloaded and installed visual studio on my mac to work with xamarin and every time I try to use the text editor I just can't.
This is how the layout looks like:
Visual studio text editor
And this is how it looks like when I use monoDevelop instead:
MonoDevelop text editor
Now, I want to use xamarin and I can't seem to find a solution to the brackets acting they way they do. If anyone can help I would much appriciate it. It's been bothering me for a while now.
It seems like the tabs for C# were not set up correctly within your Visual Studio.
Please try the following:
a) On the 'Tools' menu, click 'Options'.
b) Click 'Text Editor'.
c) Open C# and click 'Tabs'.
d) Make sure that 'Smart' Indentation is selected.
For further information please check out: https://msdn.microsoft.com/en-us/library/999b219z(v=vs.71).aspx
Note
You can automatically let Visual Studio indent your code:
Autoformat selection: Ctrl+K, Ctrl+F
Autoformat document: Ctrl+K, Ctrl+D
In Visual Studio you can use Tab + Tab to automatically create a foreach (or other) structure.
Does VSCode have something similar?
Yes, VSCode does support snippets. They appear in the completion list, and you can insert them by pressing Tab or just Enter. Alternatively, you can use the Insert Snippet command found in the command palette.
The snippet shown in the .gif above is provided by the C# extension.
Is there a way to organize C# usings (remove and sort, in separate or together) via a shortcut in Visual Studio for one or more files of a project?
I know that this can be done via the menu for one file by selecting
Edit > IntelliSense > Organize Usings > Remove and Sort
but I want to do this much faster.
I am using Visual Studio 2013 Express for C# development (wondering how this can be done in older & other versions too though). Thank you in advance.
Since VS2017, it's a builtin shortcut. Simply press Ctrl + R, Ctrl + G. Credit goes to Emanuel Ve, who mentioned this first in the comments; I'm putting the advice into an answer for greater visibility.
Go to Tools => Options => Environment => Keyboard
Enter the key combination you want to use (click the Press shortcut keys: textbox, press your key combo as you would execute it while editing)
Then type "usings" in the Show commands containing: textbox
And now you can assign whichever version of these remove/sort usings commands that you like to the key combination.
This works for pretty much every command in Visual Studio, and from any addons you have installed. Just type a word involved in the command name to find the command. Assign away!
In addition to #Will's answer,
Productivity Power Tools
is a great addon that has all this - and lots lots more!
Using: Visual Studio Pro 2013
Previous research: [1], [2], [3]
I'm used to working in Java with Eclipse.
My usual flow is:
object. CTRL+SPACE + ENTER
which autocompletes the method and places the correct curly brackets & method inputs in there:
object.myMethod();
or
object.myMethod(input1,input2);
I'm trying to get the same behaviour with VS in C#. I can get the method, but it doesn't want to include the final brackets for some reason.
I get:
object.myMethod
Is there a way to enable this?
When doing autocomplete, instead of just hitting ENTER, you can instead press the key combination "Shift + (" and it will autocomplete and add () all in the one.
You can turn on Automatic Brace Completion at: Tools->Options->Text Editor->C#->General .
Tools->Options->Text Editor->C#->IntelliSense is for auto-completion of variables and keywords.
With the current version of Visual Studio 2019 (Version 16.10.x), press the Tab key twice to insert arguments (also brackets). This is an experimental feature and needs to be enabled in Options -> Text Editor -> C# -> IntelliSense -> Tab twice to insert arguments (experimental).
Even though the question was for Visual Studio 2013, on Visual Studio 2017 you can install ReSharper plugin by JetBrains that among other things, it automatically add brackets to methods when auto-completing.
In Visual Studio, is there a keyboard shortcut to navigate (move cursor) to the last edited position (like PyCharm's Ctrl+Shift+Backspace)?
The CTRL + - shourtcut moves to the last position (not the last edited position), which is less useful for me.
This shortcut was added in VS2017 version 15.8:
Ctrl + Shift + Backspace
It's near impossible to find via google, I just stumbled across it when reading the VS news and release notes.
Go To Last Edited Location
We all know the feeling of starting to
write a feature and then realizing we need some more information from
elsewhere in the solution. So, we open another file from Solution
Explorer or Go to Definition in a few places and suddenly, we’re far
off from where we started with no easy way back unless you remember
the name of file you were working in originally. In Visual Studio 2017
version 15.8, you can now go back to your last edited location via
Edit > Go To > Go To Last Edit Location (Ctrl + Shift + Backspace).
https://blogs.msdn.microsoft.com/visualstudio/2018/08/30/improving-your-productivity-in-the-visual-studio-editor/
You can use Ctrl + - (View.NavigateBackward) shortcut.
In my VS I can use CTRL + -. I am not sure if this Works in all Versions and With different keyboard layout.
You can do Ctrl + z, Ctrl + y.
This does an undo/redo, so your code will not be affected, but your code window will be moved to the last edit location.
I have Visual Studio 2010, and this does the trick for me.
I always use Ctrl+Shift+Backspace.
Additionally you can use Ctrl + Shift + - (View.NavigateForward) shortcut.
There is a free extension for Visual Studio 2015, 2017, 2019 that includes it :
Hot Commands
Edit.GoToLastEditLocation
Takes the caret back to the last place an edit occurred during that
session.
The default Keyboard shortcut is : Ctrl + Shift + Backspace
This can be changed any time under Tools - Options - Environment - Keyboard - Edit.GoToLastEditLocation
Edit: Extension now also support VS2019
Many of the answers mention VisualStudio 2017 or a plugin to VisualStudio 2015.
I found the following shortcuts in VisualStudio 2015.
View.NavigateBackward
View.ForwardBackward
Map nicely to pycharm's
Last Edit Location
Next Edit Location