In VSCode, I have disabled the Editor: Accept Suggestions On Enter setting. This means I must use TAB to accept suggestions, and use ENTER for what it's meant for - to start a newline.
I'd like to do the same thing for the arrow keys. Normally they will navigate up/down the suggestion box, but I'd rather that they consistently navigate my code instead. I'd prefer to use TAB and SHIFT+TAB for navigating the suggestions box.
Is there such a setting to accomplish this in VSCode?
Note, I would not like to disable the suggestions box altogether, just change how you navigate it.
Related
In VSCode, the intellisense autocomplete suggestions occasionally pop up and prevent me from using the arrow keys to move my cursor up and down. Is there any way for me to disable the auto focusing of the suggestions until I push the tab key? (A.K.A: I want to be able to cycle through the autocomplete suggestions only after I push the tab key)
Under Preferences > Keyboard Shortcuts, find and remove the keyboard shortcuts that associate the up and down arrow with "Next Suggestion" and "Prev Suggestion". You should no longer get your arrows hijacked by the suggestions and can then use the default alternative of ctrl+up or ctrl+down to navigate them. It won't toggle on Tab like you want, but it's a good workaround.
Default VS Code Intellisense behaviour
User is presented with a menu of suggestions
User then has to press the Up or Down arrow keys to navigate through the menu
Finally user has to confirm with Enter to insert the suggestion and close the dialog
What I would like instead
Don't need to press Enter
Suggestions are automatically inserted (and cycled through) by pressing Up/Down
Pressing any other keys will close the dialog and resume typing
To be clear, I want to replicate the default behaviour of YouCompleteMe:
When you type, a completion menu pops up. If you like the completions, you use the <Tab> key (by default, can be changed to <Enter> or <Down> arrow or whatever) to select a completion string you want. The very act of "tabbing through" the list to select the item you want inserts the candidate string. When you tab to a different candidate, the editor code is replaced with the new candidate. There is no accept key because by the point where you have the candidate you want selected in the menu the candidate has already been inserted in the editor. There is nothing to "accept". You just keep typing, the candidate has already been inserted.
Is such behaviour possible with Visual Studio Code, either by default or through a plugin?
The editor.tabCompletion option is the closest thing currently available:
By default, tab completion is disabled. Use the editor.tabCompletion setting to enable it. These values exist:
off - (default) Tab completion is disabled.
on - Tab completion is enabled for all suggestions and repeated invocations insert the next best suggestion.
onlySnippets - Tab completion only inserts static snippets which prefix match the current line prefix.
(Emphasis mine)
... except that the first Tab press hides the suggestion window.
I did some digging about editor.tabCompletion, and I found that closing the suggestion window is part of the tab completion's option original design, and that while other users have asked about an option not to close the suggestion window or specifically YouCompleteMe-style behaviour, that this is currently not supported.
"editor.acceptSuggestionOnEnter": "off",
To disable Enter to accept suggestion.
When I use the autocomplete of Eclim in vim, it shows a hint window at the top of my vim.
How can I disable it, or better, make it disappear automatically?
I think you mean the preview window showing details about the current completion item. Use
:set completeopt-=preview
to turn this off.
I'm using Aptana Studio 3, with content assist on, and I have a really annoying problem.
Basically, I'll find myself within single quotes or some other context that one can "tab" out of, and I'll type something like, say, "login". So, when I finish typing login, I use tab to get out of the quotes, but because autocomplete has found the "LoginForm" object, instead of bringing me out of the quotes, pressing tab adds "Form" to my "Login," writing "LoginForm".
Basically, I would like to set up the editor so that "enter" autocompletes and tab simply indents or tabs out of quotes/braces/etc.
Press Esc then Tab, eventually you get used to it. I advise against editing your editor otherwise when you use another IDE you'll hit the same problem because that's what they all do.
If you really want to edit your aptanas keybindings: https://wiki.appcelerator.org/display/tis/Modifying+your+shortcut+keys
Here are the ways the Eclipse documentation states you can navigate the Content Assist list:
You can use the mouse or the keyboard
(Up Arrow, Down Arrow, Page Up, Page
Down, Home, End, Enter) to navigate
and select lines in the list.
But all of the options require you to move your hands significantly away from their natural place on the keyboard!
Are there any other, quicker ways I can navigate this list? Something like tab, or the j/k from vi?
This is a great feature, and you can implement it like so: bind movement keys in Eclipse's key binder and then use them in the content assist menu!
Preferences/General/Keys
Line Down: Bind to Ctrl+K
Line up: Bind to Ctrl+I
(both when 'Editing Java Source')
and then try moving with Ctrl-K/I when the content assist pops up!
In Kepler, as jed mentions in the comments, select "when editing text" instead and it should work.
If you try to fill in the content manually, Eclipse will move.
The search is quite advanced, e.g. "ArL" can match ArrayList, etc., so if you know what you are looking for, instead of navigation you could use search.
This is certainly not a solution for everyone, but if you switch to the Emacs keyboard layout you can just use the key bindings for the "previous line" and "next line" commands, e.g., Ctrl-P and Ctrl-N.