Spaces displayed as dots and tabs displayed as arrows - visual-studio-2012

In my Visual studio 2012 editor I erroneously pressed some obscure key combination (Ctrl-Alt-something or so) and now spaces are displayed as little dots and tabs are displayed as arrows.
I'd like to get rid of this, but I haven't found the corresponding option in TOOLS-Options-Text editor.

Go to Edit -> Advanced -> View White Space to rectify this. Alternatively, you may use the key combination Ctrl + R, Ctrl + W.

A quick tip:
An efficient way to find Visual Studio options and commands is to use the "Quick Launch" feature (Ctrl+Q - or just type in the box at the top right of the Visual Studio IDE) - in this case typing "white space" or just "space" in that box shows the command you need and lets you take the action from there too.

Related

Android Studio autocomplete on special character (space, period, etc.) like in Visual Studio

Is it possible to enable autocompletion of the selected suggestion when entering special characters like in Visual Studio?
For example:
When typing 'MenuI' Android Studio suggests 'MenuInflater' that I can autocomplete by hitting TAB after which I type SPACE to separate my variable name.
In Visual Studio I can type SPACE directly (instead of TAB) to get the autocompletion plus my space character. This works for other special characters like period, brackets and so on, too.
Yes, I have also faced the same issue in Android studio. And finally I found it here.
Open the Android Studio settings go to Editor --> General --> Code Completion
and check the option "Insert selected variant by typing dot, space, etc."
And uncheck the options "Basic completion (Ctrl+Space)" and "Smart Type Completion (Ctrl+Shift+Space)"
Check this Android studio settings image
Well, this is implemented, slightly.
If you have MenuInflater and type in MenuI, and then CTRL+SPACE, which means you tell the IDE that you want to use the autocomplete dropdown, and then press space, it works as you wish.
So, I could type in MenuIn, then I could either press the down key, or use CTRL+SPACE ("MenuInflater" Should now be highlighted in blue:
), and then press space, and it'll work as you wish.
I suck at explaining, so if you don't get it, I'll try more.

How to set max line length in Android Studio code editor?

How can I set a maximum length for Android Studio's code editor, or may be set a word wrap?
In my Android Studio, no matter how long a statement I type on a single line, it never automatically goes to the next line, but rather a horizontal scroll bar appears.
When I autoformat using the Ctrl+Alt+L (reference), nothing happens.
My SO or Google search found a lot of material on this for Eclipse, but not for Android Studio.
If you need not a soft wrap,
but actually, brake one long line onto several lines you need:
Go to Preferences(mac) or Settings(windows) -> Editor -> Code style -> Java/Kotlin -> Wrapping and braces (tab) -> Check "Ensure that right margin is not exceeded"
Now try to reformat your code:
press
OPTION (ALT) + CMD + L on your Mac
(or CTRL + ALT + L on PC)
Edit 13.02.19
As noted in comments this option seems not available in settings for Kotlin.
However, there is a workaround to manually add it.
Here is what it takes to make it work:
Export the settings scheme.
Open saved xml file.
Find <codeStyleSettings language="kotlin"> tag (or create)
Add the WRAP_LONG_LINES setting manually:
<codeStyleSettings language="kotlin">
...
<option name="WRAP_LONG_LINES" value="true" />
</codeStyleSettings>
Save edits and and import back the scheme.
Here you go!
MacOS:
Click on Android Studio ( left top corner )
Click Preferences
Type Code Style in search
Click on Code Style
There is a filed right to the 'Hard wrap at' - you can enter needed about of symbols you need
In File | Settings, select "Editor", then "Code Style". There is an option "Wrap when typing reaches right margin".
Edit: Just tried it, and it doesn't seem to work. Anyway, maybe the option "Use soft wrap" in the "General" group is more what you want.
#Solace, actually #Fahim Faysal's answer is quite close to what you need, but since you want to solve the problem no matter how long a statement I type on a single line, it never automatically goes to the next line, 2 more steps you need to follow:
[Step 9] type the max length you prefer at `"Hard wrap at" ()
[Step 10] change "Wrap on typing" from Default: No or No to Yes
With version 4.1.2 and with Dart language you need to go to "File/Settings/Editor/Code Style/Dart" and modify the "Line length" to the preferred number.
In Android Studio:
File->Setting->
Editor->code Style->java->Wrapping and braces(tab:right side)->keep when reformatting->Line break(make unchecked)
You can change the max column width from:
File > Settings > Editor > Code Style > Right Margin (columns)
Android Studio 3.5:
Mac -
Android Studio > Preferences > Editor > CodeStyle > HardWrap at: ____
The existing answers already answer the question in straight forward way. As a different approach you could set the style guide to kotlin style guide code style. Then if you do alt + ctrl + l as you did, you'll see auto wrap as you expected.
Just open the settings, search for kotlin and look for kotlin under code style.
On the top right hand side of the settings window you'll see Set from..., click on it.
Then on predifined style > kotlin style guide
If you'd like to follow the kotlin formatting style this could reduce more effort. For more information: https://developer.android.com/kotlin/style-guide
My Environment:
Ubuntu 18.04
AndroidStudio 3.3.2
My operate:
File -> Settings -> Editor -> Code Style
Scheme -> select Project
Hard wrap at '120'
Apply
To move the grey vertical line, that tells Android Studio where to wrap your code, go to
Settings- Editor- Code Style- Java or Kotlin- Wrapping and Braces- Hard wrap at
and enter the number of characters, where the line should be.
For dart
settings => code style => Dart => Line length
In settings/code style/kotlin/wrapping and braces replace the "do not wrap" values with "wrap if long"
You can change the Hard wrap at param

Visual Studio 2012 Keyboard Shortcut to cancel Edit.CompleteWord (opposite of Ctrl + Space)

In the text editor I have IntelliSense on and most of the time it is great for completing your word. I like it coming up when I start typing.
I also often use Ctrl + Space to bring up the suggestions.
I want to know if it is possible to 'cancel' the suggestions if you don't want to use the suggestions that particular time without using the mouse.
I currently have to click on the screen to take the focus away from the IntelliSense pop up so that when i press 'space' it doesn't populate the word with its suggestion.
Is there any way to do this other than unticking "Show completion list after a character is typed" in "Options \ Text Editor \ C# \ IntelliSense"?
Hitting escape should clear the suggestions list.

Releasing the find and replace pane in visual studio 2012

In Visual Studio 2012 the find and replace window has Docking alignment to the top right side, how to release it?
The "quick find" window isn't docked in the usual sense. Press Esc to dismiss it and also make the yellow-orange search result highlighting go away.
Alternatively, click the X in the top right of the mini window.
Edit.Find = docked Find window
Edit.Replace = docked Replace window
Edit.FindinFiles = undocked Find window
Edit.ReplaceinFiles = undocked Replace window
so for undocked windows you can press Ctrl + Shift + F or Ctrl + Shift + H
or alternatively change shortcuts in Options > Environment > Keyboard to reach desired windows easier.
This is not possible unfortunately, which really drives me nuts when trying to find something in a minified file (single line) since the find window commonly blocks the found result.
Last post I could find about it:
https://visualstudio.uservoice.com/forums/121579-visual-studio-ide/suggestions/3636907-let-me-undock-the-find-and-replace
The best solution I can find is copy and past file into notepad and find there (for my needs).
In Visual Studio 2012 all docked windows can be released as follows;
Docked Window's Header right click menu (or click Window Position Icon what located the far right of the header)> Float menu
If the usual things, as already suggested, won't work, here are two other ideas I have found to work with oddities in Visual Studio.
Disable all plugins and try again (had a weird case of VS crashing on Ctrl+S and it was a faulty plugin)
Try a repair on the install, could have some faulty files.

Is there a way to disable Quick Find in Visual Studio 2012?

I just upgraded to Visual Studio 2012 from 2010 and cannot stand the fact that Cntrl + F brings up the new Quick Find dialog in the upper right hand corner of the editor. I typically just dock the Find and Replace window and prefer to use that. Is there a way to disable Cntrl + F from bringing up the new Quick Find window and instead have it move focus to the Find and Replace window similar to how VS 2010 did it?
Yes there is. You can assign the keyboard shortcut ctrl+f to edit.findinfiles in tools>options>environment>keyboard. So far it works for me.
Instead of modifying the default keyboard shortcuts consider using
Ctrl+Shift+F for "Find in files"
Ctrl+Shift+H for "Replace in files"
Sometimes it's not always possible/advisable to change the default shortcuts. Like when working on another persons computer.

Resources