I want that Visual Studio Intellisense accept the suggested keyword after pressing enter. I could not find any option to toggle that.
By Default you can autocomplete the suggested keyword by pressing space or tabulator or an interpunctation.
I edited the settings.json in $HOME/Library/Application Support/Code/User/settings.json on MacOs
{
"telemetry.enableTelemetry": false,
"window.zoomLevel": 0,
"editor.suggestSelection": "first",
"vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue",
/* Controls if suggestions should be accepted on 'Enter' - in addition to 'Tab'.
Helps to avoid ambiguity between inserting new lines or accepting suggestions.
The value 'smart' means only accept a suggestion with Enter when it makes a textual change
*/
"editor.acceptSuggestionOnEnter": "on"
}
I expected that after saving the settings.json and restarting the Editor the changes are applied but nothing changed.
Related
I like intellisense however I don't like how when I finish typing something like a method name that has the name "Press" tries to autocomplete to "buttonpress" and when I press space bar to go to the next word or part of the code, it autocompletes to that and it's super frustrating. Is there any way to disable pressing spacebar for autocompleting but keep Tab to autocomplete?
Edit: I found the way to disable Enter or Tab for this (acceptSelectedSuggestion), but it doesn't list Space as one of the buttons that accepts the autocomplete suggestion.
Go to File -> Preferences -> Settings -> Text Editor -> Suggestions -> Quick Suggestions -> Edit in settings.json and add this line
"editor.acceptSuggestionOnCommitCharacter": false
I'm getting quite annoyed with a feature of Resharper that I just cannot find how to disable independently.
With Resharper turned off, whenever I type prop in VS2015 and press TAB, I get the following auto-generated code:
public int MyProperty { get; set; }
and I'm then able to switch between int and MyProperty repeatedly by pressing TAB again.
I'm also able to use autocomplete to fill in the variable type as I type.
For example, lets say I wanted to create a property called "test" of type "string", I would do the following:
type prop
press TAB to generate the property code template
type stri
press TAB to autocomplete the variable type with string
press TAB to move to the variable name placeholder
type test
press Return to finish
perfect.
However, with Resharper enabled, whilst steps 1,2 and 3 still work, it all goes to pot after that!
If I press TAB to try and autocomplete the variable type, the cursor simply moves over to the variable name, leaving the variable type as stri.
If I then press TAB (or even SHIFT+TAB) again to try and get back to it, it simply finishes the line.
To make things clearer, I've included two gifs demonstrating my problem.
This first one shows what happens with Resharper disabled:
Whilst this one illustrates the frustration I'm currently experiencing with Resharper enabled:
I understand this is an old(er) question and already has an answer; however, I wanted to provide a solution for future SO readers that would allow one to continue using Visual Studio's IntelliSense as opposed to Resharper's.
I had the same issue as the OP (original poster) and found the issue to be caused by a conflict with Resharper's Live Templates. With Resharper enabled, the resolution of prop after Tab + Tab, resolves Resharper's prop Live Template and not Visual Studio's prop snippet. You might have notice that in OP's 2nd screen cap (the one with Resharper enabled) that the resolution of prop has a datatype shown as TYPE instead of int. This is because Resharper's Live Template has set this parameter name to TYPE, while Visual Studio's snippet has the same parameter set to int by default. This is what lead me to look at Resharper's Live Templates for a resolution; lo and behold turning off the prop Live Template fixes the issue.
Go to Resharper's Template Explorer (Resharper -> Tools -> Templates Explorer) you will see there is a Live Template named prop. Simply clear the check box for the prop Live Template and Visual Studio's prop snippet resolution, and datatype resolution for that matter, will start working again.
It looks like you have an intellisense setting conflict.
Re-Enable Resharper and then change this setting:
Resharper->Options->IntelliSense->General
Change the selection from "Visual Studio" to "Resharper", hit Save and the desired behaviour should be yours.
I find those shortcuts still work without disabling anything however sometimes this functionality stops working.
Currently using R# 2018.2 with the default keyboard mappings set to IntelliJ IDEA scheme (as I also use java) and the shortcuts are all available, but when they stop working closing all tabs and reopening the tab you are working on normally fixes it.
No restart or reset is needed.
I have a simple search field on a form that is set as multiline (which I understand is the only way to change a text box's height) and has the flag AcceptsReturn set to false.
However, when I press enter within that control, instead of it activating the default button as it should, it puts in a return character.
Now, I've also attempted using the KeyPress event to check if the Enter key has been pressed to activate the search-button click function in the hope that it would override this return behaviour - but it hasn't. Now it just runs the search AND inserts a return character.
I'm running Visual Studio 2010 (although this problem seemed to be present in 2008 too before I converted it) and C# .NET 2.0. Any solutions?
I see that an answer has already been posted, which mentions the AcceptButton property, but I figure I would state more clearly why that's necessary: quoth MSDN, on AcceptsReturn, "If there is no default button for the form, the ENTER key will always create a new line of text in the control, regardless of the value of this property." (I just tried it out on a dummy form - by "default button", they did in fact mean the form's AcceptButton property. With one set, the value of AcceptsReturn made a difference; without one, it had no effect.)
As for KeyPress, while that is obviously not the best way in this case, I have had to use tricks like that in the past - did you remember to set e.Handled to true in the case that you handled the event yourself?
The form has a property called AcceptButton. Is that pointing to the button you are calling the default button?
I just wrote a little test and it seems to work for me.
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.
I am trying to set my own hotkey combination for the action Edit.FindNext in visualstudio 2008 under:
Tools.Customize -> Keyboard
but these simply dont take effect, so as soon as i close the dialog my VS keeps working with the default combination: Ctrl + F3, and the one i set is just ignored, although its still set in the configuration.
restart didnt help.
Any ideas?
Thank you.
I found the problem,
i tried to set the Ctrl + Left Arrow for the find next action but the Left-Arrow can not be used in global as microsoft states:
The following keys cannot be assigned
to a command in Global: PRINT SCRN/SYS
RQ, SCROLL LOCK, PAUSE/BREAK, TAB,
CAPS LOCK, INSERT, HOME, END, PAGE UP,
PAGE DOWN, Windows logo keys,
Application key, any of the ARROW
keys, or ENTER; NUM LOCK, DEL, or
CLEAR on the numeric keypad; or
CTRL+ALT+DELETE.
so i had to set this to the texteditor context, and it worked.
Setting a hotkey in VS can be tricky. Be aware of the following: The same hotkey can be used for different things, depending on the context.
For example, it is possible, that you defined the hotkey for "Global", but for "Text Editor" your default hotkey is still registered and the new one might even be registered for something else in the context of "Text Editor". So when you enter your new hotkey, check out the Combobox "Shortcut currently used by", maybe it will show you what the problem is.