Reputation: 1885
I am using vs-code along with vscodevim extension and seeing strange behaviour and I am not sure what's causing that behaviour.
Suppose I have a following code and imagine _
represents cursor position
sample = {
"key": "some value",_ #my cursor is at the end of line
"another_key": some value"
}
When I press enter at the end of the line, the comma moves to next line instead of staying on the same line
sample = {
"key": "some value"
, #when pressed enter it inserts new line and moves comma to new line
"another_key": some value"
How can prevent this behaviour and make the comma stay at same line.
Here are my keybindings file and vscodevim settings file:
// keybindings.json
[
{
"key": "\\ a",
"command": "workbench.view.explorer",
"when": "!editiorTextFocus",
}
,
]
//vscodevimsettings.json
{
"vim.vimrc.path": "filepath",
"vim.leader": "<space>",
"vim.normalModeKeyBindingsNonRecursive": [
{
"before": [
"<leader>",
"a"
],
"commands": [
"workbench.view.explorer"
]
}
],
"vim.smartRelativeLine": true
}
Upvotes: 8
Views: 20679
Reputation: 11
I had the same issue before and i figured out that it was actually the problem of an extension named Save typing which is used to automatically save the code but now vs code have it as built in feature. so when i disable the above mentioned extension everything went back for normal. If this error happens make sure to check all the extensions you have installed . Thankyou.....
Upvotes: 1
Reputation: 201
Easiest non-debug solution is to click on "Extensions" and reload them one by one.
Upvotes: 0
Reputation: 98
For me, the extension vscode-styled-components
was causing this problem, disabling it solved to me.**
In general, it's related to some extension you've installed.
I tried to disable each extension to figure out which was causing this error and then I had to uninstall it.
Upvotes: 8
Reputation: 147
In your settings.json add
"editor.acceptSuggestionOnEnter": "on"
Or,
"editor.acceptSuggestionOnEnter": "smart"
If you want to turn it off ( I don't know why would you do that )
"editor.acceptSuggestionOnEnter": "off"
Reload vscode and you're good to go
editor.acceptSuggestionOnEnter
Controls whether suggestions should be accepted on Enter, in addition to Tab. Helps to avoid ambiguity between inserting new lines or accepting suggestions.
Upvotes: 2
Reputation: 191
One work around is "ctrl + Enter" instead of only pressing enter. Try this
Upvotes: 6
Reputation: 686
I had the same issue but on MacOS, thought it might be helpful for you to check https://marketplace.visualstudio.com/items?itemName=adammaras.overtype.
Upvotes: 0