Visual Studio - Space after auto filling word - c#

recently moved over to visual studio
When I start typing a word, let's say "Tex" I get the popup with possible auto-fillings, and if I press enter, it automatically changes it to "TextBox"
The problem I have is, whenever I do that, I have to press 'space' to start typing the next word, something that get's pretty annoying if you type 10,000 words..
Is there an easy way to make the typing start one space after the autofilled word?
Thank you in advance :)
Pic1: http://prntscr.com/fbpzdq
Pic2: http://prntscr.com/fbpzlc

Yes, you can simply use the Spacebar to perform the auto-complete instead of pressing Enter. Both methods finish the completion of the word, but using the Spacebar will also add a space after the word.
It even works when using the "." character after a name; you still get the intellisense list of object members to choose from, and auto complete will magically remove the space(s) when you type a ; or closing brace }, or any other character that triggers line formatting.
Example
// This is what it looks like while typing, using Spacebar to complete the words
this .textBox1 .Text = "hello"
// And then as soon as the `;` is added, it's all fixed:
this.textBox1.Text = "hello";
And, for what it's worth, whitespace is allowed on either side of the . between an object and it's members. So even if the spaces were left as in the first example, the code still compiles and runs just fine.

Related

C#: Always Auto-Complete

When I implement auto-complete in textbox1 the usual way, I can complete only one word before auto-complete stops. For example, I have these items added to the auto-complete list (accessible from designer/GUI):
{ "print",
"messagebox",
"disassemble",
"virusscan",
"system.securitywarning" }
If I type "pr," I get print then that's it. How can I make the auto-complete feature continue with every space so that I can do:
I type "pr"
It auto-completes it as "print"
I press "space"
I type "system.secur"
It auto-completes it as "system.securitywarning"
I would really appreciate it if anyone can help :)

How to disable new line inserting after intellisence suggestion

I want to be able to type auto-property without such effect (inserting new line after I type ;):
This only occurs if intellisence shows its suggestions. Pressing Esc just before pressing ; helps (suggestion popup disappears and new line is not inserted), but it seems impossible to remember, I constantly fail.
Is there a way to remove that weird "new line" behavior? I don't remember such in previous VS.
Try this way:
Type: prop
Press tab 2 times
Change property type if needed
Press tab
Enter property name
You are done!

Enter in text editor set cursor at begin of line instead of tabs

I have a strange behaviour with VS2015.
In C# code (the file is .cs) when I hit the enter, the cursor will always begin on position 0 of the next line. No tabs will be inserted to push the cursor to the same position of the previous line where code started.
public class Fake
{
public void Test() (here I hit enter)
{ <-- no tabs are automatic inserted before {
}
I have done: repair VS2015, Reset user Environment settings VS.
Someone an idea to reset the behaviour to default C# text editor?
Find the parameter - /ResetUserData - which Removes all user settings and makes you set them again. From http://msdn.microsoft.com/en-us/library/bb245788%28v=vs.80%29.aspx#vs05idetips_topic6
I got a similar issue here and it was about files.autoSaveDelay setting.
Issue:
After breaking line my cursor does go to the right indentation but after 1 sec goes straight to the beginning of the current line.
Cause:
So it happens because VSC (Visual Studio Code) erases any tab or spaces within a line if there is only these type of chars.
Solution
What you can do in order to solve it is either set a higher delay to files.autoSaveDelay or disable files.autoSave.

RichTextBox replacing input with "random" unicode character

I have an application that allows users to browse through data. I have menu items controlling navigation and a RichTextBox displaying the data. Very straightforward.
tl;dr version
It mostly works except for one strange problem. There are instances where the RichTextControl will replace the first character typed with a random unicode character. Feel free to download this sample app and see for yourself:
http://www.technitivity.com/stackoverflow/RichTextFocusTest.zip
Full Explanation
The issue happens when navigating between rows. It's best described with a few use cases:
Use Case 1
Navigate anywhere into the dataset.
Press back.
Press next.
Type any letter, say, "F".
Result: "F" appears in the RichTextBox as expected.
Use Case 2
Navigate anywhere into the dataset.
Press back twice.
Press next twice.
Type the letter "F".
Result: instead of "F", "ᅲ" appears in the RichTextBox.
Use Case 3
Navigate anywhere into the dataset.
Press next twice.
Press back twice.
Type the letter "F".
Result: instead of "F", "᧴" appears in the RichTextBox.
The navigation process entails nothing more than:
// either forward
i++;
// or backward
i--;
// then update
RichTextBox1.Text = MyData[i];
Procedurally speaking:
// This works
RichTextBox1.Text = MyData[3];
// This works
RichTextBox1.Text = MyData[3];
RichTextBox1.Text = MyData[2];
RichTextBox1.Text = MyData[3];
// This doesn't work
RichTextBox1.Text = MyData[3];
RichTextBox1.Text = MyData[2];
RichTextBox1.Text = MyData[1];
RichTextBox1.Text = MyData[2];
RichTextBox1.Text = MyData[3];
Granted, that's not what's actually happening, but it is what's effectively happening.
It's important to note that this doesn't happen if the RichTextBox loses focus between updates. It only happens if the RichTextBox retains focus while its Text attribute is updated in accordance with the above description.
I'm at a complete loss about what's causing this, how to fix it, or why I can't seem to find anyone else with this problem.
I've reproduced it on 64-bit Windows 7 and 32-bit Windows Vista. This is on .NET Framework 4 though I was also able to reproduce on a .NET Framework 2 project.
Here's hoping someone else has run across this (and solved it!)
Edit:
Here's a screenshot:
http://www.technitivity.com/stackoverflow/RichTextBox-Screenshot1.png
As mentioned in the comments, to reproduce this in the sample app, you have to use the keyboard menu shortcuts. If you click on the menu items (or the toolbar buttons), the RichTextBox loses focus and the problem goes away. But if you navigate through the items using Alt+Left or Alt+Right (back/next) and then type, you should see something like what's shown in the above screenshot.
I hesitate to call this an "answer", but I couldn't find a "Post a Hack" button and this hack does get me by for now. I'm not thrilled about it, but sometimes you just have to move on. Here it is.
Since the problem went away when the RichTextBox lost focus, I tried an experiment:
I created a visible, 0-pixel wide textbox, called Hacktastic.
I added a KeyPress event to the RichTextBox.
On KeyPress:
Hacktastic.Focus();
Hacktastic.Text = KeyChar.ToString();
MyRichTextBox.Focus();
This worked and (at least for now) I'm sticking with this as a solution. If anyone could still try out my sample project and reproduce and/or solve this, I would love further feedback:
http://www.technitivity.com/stackoverflow/RichTextFocusTest.zip
Steps to repro in the test project:
Using Alt+Right arrow, move through the dataset to, say, the fourth record.
Using Alt+Left arrow, move back through the dataset two places, to the second record.
Using Alt+Right arrow, move back to the fourth record.
Press any KeyChar.
Observe KeyChar is replaced with a "random", large-value unicode character.
I say "random" because a specific set of navigation (back/next) keystrokes will insert the exact same unicode character. However, depending on where you start in the set or how far back you go, you'll get a different character.
Also, note that only going back one record and forward one record does not cause the problem. You have to move at least two records for this to happen.

Visual Studio: How to show Overloads in IntelliSense?

Once code has been written, the only way I know of to view the overloads for a method is to actually edit the method by deleting the Parenthesis () and reopening them.
Is there a shortcut key that I could press to activate this instead of having to edit my files?
For an example, please reference the ShowDialog Overload screen shot below:
With your cursor inside the parentheses, use the keyboard shortcut Ctrl-Shift-Space. If you changed the default, this corresponds to Edit.ParameterInfo.
Example:
Ctrl+Shift+Space shows the Edit.ParameterInfo for the selected method, and by selected method I mean the caret must be within the method parentheses.
Here is the Visual Studio 2010 Keybinding Poster.
And for those still using 2008.
Tested only on Visual Studio 2010.
Place your cursor within the (), press Ctrl+K, then P.
Now navigate by pressing the ↑ / ↓ arrow keys.
The default key binding for this is Ctrl+Shift+Space.
The underlying Visual Studio command is Edit.ParameterInfo.
If the standard keybinding doesn't work for you (possible in some profiles) then you can change it via the keyboard options page
Tools -> Options
Keyboard
Type in Edit.ParameterInfo
Change the shortcut key
Hit Assign
It happens that none of the above methods work. Key binding is proper, but tool tip simply doesn't show in any case, neither as completion help or on demand.
To fix it just go to Tools\Text Editor\C# (or all languages) and check the 'Parameter Information'. Now it should work
Great question; I had the same issue. Turns out that there is indeed a keyboard shortcut to bring up this list: Ctrl+Shift+Space (a variation of the basic IntelliSense shortcut of Ctrl+Space).
The command Edit.ParameterInfo (mapped to Ctrl+Shift+Space by default) will show the overload tooltip if it's invoked when the cursor is inside the parameter brackets of a method call.
The command Edit.QuickInfo (mapped to Ctrl+KCtrl+I by default) will show the tooltip that you'd see if you moused over the cursor location.
I know this is an old post, but for the newbies like myself who still hit this page this might be useful.
when you hover on a method you get a non clickable info-box whereas if you just write a comma in the method parenthesis the IntelliSense will offer you the beloved info-box with the clickable arrows.
Every once and a while the suggestions above stop working, if I restart Visual Studio they start working again though.
you mean's change overload.
just Press Shift + ↑ / ↓
Mine showed up in VS2010 after writing the first parenthesis..
so, prams.Add(
After doings something like that, the box with the up and down arrows appeared.

Categories

Resources