microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
163.42k stars 28.95k forks source link

Auto close single and double quotes aren't working #26820

Closed vvinhas closed 6 years ago

vvinhas commented 7 years ago

For some odd reason, single and double quotes are not self closing. Brackets and parentheses are working fine though.

Screencast

VSCode Version: April 2017 (1.12) OS Version: macOS Sierra (10.12.4)

rebornix commented 7 years ago

@vvinhas can you try to run Code without any extension by code --disable-extensions? Besides, can you open Help --> Developer Tools and see if there is any error there?

vvinhas commented 7 years ago

NP @rebornix

Unfortunately, the same thing happens and no errors are shown in the console. VSCode Extensions Disabled

rebornix commented 7 years ago

@vvinhas can you share the extensions list with me ? Or even better together with your settings file.

vvinhas commented 7 years ago

Yup!

Extensions

FallenMax.mithril-emmet-0.6.1
HookyQR.beautify-1.0.2
KTamas.laravel-blade-0.0.1
Kasik96.format-indent-1.3.0
Shan.code-settings-sync-2.7.0
Shan.code-settings-sync-2.8.0
TwentyChung.jsx-0.0.1
WallabyJs.quokka-vscode-1.0.33
WallabyJs.quokka-vscode-1.0.34
abusaidm.html-snippets-0.1.0
christian-kohler.path-intellisense-1.4.2
dbaeumer.vscode-eslint-1.2.11
dkundel.vscode-new-file-3.0.2
donjayamanne.githistory-0.2.0
felixfbecker.php-debug-1.10.0
felixfbecker.php-intellisense-1.2.1
felixfbecker.php-intellisense-1.2.2
ikappas.phpcs-0.7.0
neilbrayfield.php-docblocker-1.1.0
onecentlin.laravel-blade-1.8.1
robertohuertasm.vscode-icons-7.7.0
robinbentley.sass-indented-1.4.1
xabikos.javascriptsnippets-1.4.0
xabikos.reactsnippets-1.3.0
zhuangtongfa.material-theme-2.7.8
zhuangtongfa.material-theme-2.8.0

Settings

{
    "editor.fontFamily": "Fira Code",
    "editor.fontLigatures": true,
    "editor.fontSize": 14,
    "editor.fontWeight": "300",
    "editor.lineHeight": 22,
    "editor.tabSize": 4,
    "editor.detectIndentation": false,
    "editor.insertSpaces": true,
    "editor.formatOnType": true,
    "files.exclude": {
        "**/*.cs.meta": true
    },
    "workbench.colorTheme": "One Dark Pro",
    "workbench.iconTheme": "vscode-icons",
    "workbench.editor.tabCloseButton": "right",
    "window.zoomLevel": 1,
    "emmet.syntaxProfiles": {
        "javascript": "jsx"
    },
    "newFile.defaultBaseFileName": "script",
    "newFile.defaultFileExtension": ".js",
    "[javascript]": {
        "editor.tabSize": 2
    },
    "[javascriptreact]": {
        "editor.tabSize": 2
    },
    "sync.gist": "", //hidden
    "sync.lastUpload": "", //hidden
    "sync.autoDownload": false,
    "sync.autoUpload": false,
    "sync.lastDownload": "",
    "sync.forceDownload": false,
    "sync.anonymousGist": false,
    "sync.host": "",
    "sync.pathPrefix": "",
    "sync.quietSync": false,
    "eslint.autoFixOnSave": false
}
vvinhas commented 7 years ago

Using version 1.14.2 and the bug persist.

melquic commented 7 years ago

Same bug here. Version 1.15.1 and MacOS 10.12.5

tormink commented 7 years ago

Same bug here. Version 1.15.1 and macOS 10.12.6. Maybe it has something to do with my keyboard using the double and single quotes key as also accent triggers, for letters such as é, á, ä? (in my case Portuguese).

Because for me the same thing also happens for backtick brackets, not only single and double quotes. However, this is not a keyboard isolated bug, since I tested Sublime and Atom and they did not show this behavior.

ghost commented 7 years ago

I wrote a keybinding to solve this

{
    "key": "shift+'",
    "command": "editor.action.insertSnippet",
    "when": "editorTextFocus",
    "args": {"snippet": "$1\""}
},
{
    "key": "'",
    "command": "editor.action.insertSnippet",
    "when": "editorTextFocus",
    "args": {"snippet": "$1'"}
}

So you can hit single or double quotes and then space

andremacola commented 7 years ago

Same problem here with 1.15.1 (1.15.1) OSX El Capitan

andremacola commented 7 years ago

@vtr83 the problem with this approach is that in languages like portuguese, we accentuation in words for exemple á é í ó ú and we do that with the same single quote key

tormink commented 7 years ago

I also use a Brazilian keyboard (Brazilian Pro is the name of the keyboard configuration in macOS). I just added the standard U.S. keyboard, and it no longer bugs with quotes, however, I can no longer use accented characters such as á, é, í, ó, ú that way, because the keyboard now treats the quotes simply as quotes, not helper keys for accents. I do not wish to need to keep switching around all the time while coding, when I need to write a string in Portuguese. So the problem is VS Code can't handle that keyboard configuration for some reason. Other editors I've tested have that behavior for quotes if you press once and then space, which is the expected behavior in that case.

ghost commented 7 years ago

@andremacola I know, i'm from Brazil, the Atom editor has the best behavior in this situation, if you type a single (or double) quote and then you type a vowel or 'c' it will be used as accent, but if you press 'space' or other letter it will be wrapped in quotes, I wrote the keybinding as a provisional solution, the best would be vscode to have the same behavior as Atom does.

CodeSigils commented 7 years ago

Same Here with VS Code version 1.16.1 in OSX Sierra 10.12.6. However I have noticed the same problem in IntelliJ IDEA. Maybe a general OS encoding problem ?

CodeSigils commented 7 years ago

Edited for future reference: This is a VSCode problem: Try setting the language to "U.S." instead of "U.S. International - PC" in the language menu of the menu bar (keyboard -> Input Sources). It seems The "international" option adds special characters and interacts with quotation symbols. Changing to "US" temporarily solved it for me, until bug fixed. Ref: https://discussions.apple.com/thread/2784664?start=0&tstart=0

andremacola commented 7 years ago

@CodeSigils yes this is a Vscode problem, all the other editors works just fine. Your solution is not for non-english languages.

hugw commented 7 years ago

I can confirm the issue. Right now I'm using keyboard layout set to "U.S International". ST and Atom work as expected.

nighto commented 7 years ago

Seems to be macOS specific problem, doesn't have this on VSCode 1.14.0 on Windows 7.

blairdow commented 7 years ago

Similar issue here... brackets, parentheses, etc autoclose properly. I have found that double and single quotes autoclose properly UNLESS they are typed inside an html tag, ie. to add a class name.

ghost commented 7 years ago

@nighto True! I've tried on Windows 10, and even with English keyboard it works!

P.S. Atom on MacOS also works properly.

darqueos commented 7 years ago

Same issue. Running macOS 10.13 and VSCode 1.17.1. I also use U.S. International - PC as the default keyboard configuration. All other editors don't have this issue though.

tocvieira commented 6 years ago

Same issue here.

Heckthor commented 6 years ago

I hate "same here" posts but same here. Autocompletion doesn't work inside HTML tags. I tried quotes, double quotes, parenthesis, brackets, curly braces.

It does work inside HTML files but outside tags.

dandeveloper commented 6 years ago

Same issue here, when type single or double quotes the Auto close isn't working. Macbook Air OS: MacOS 10.13 VSCode Version: 1.17.2 Keyboard Layout: US International - PC

LeReverandNox commented 6 years ago

Exactly same issue here =/

Macbook Pro 13" 2017 Touchbar MacOS 10.12.6 VSCode 1.17.2 Keyboard Layout : US International PC

rubencherbit commented 6 years ago

Same here :(

Macbook Pro 15" 2017 Touchbar MacOS 10.13 VSCode 1.17.2 Keyboard Layout : US International PC

betorobson commented 6 years ago

same here! Mac OS High Sierra 10.13.1

I'm very disappointed, moving back to ST until VS Code get this fixed :-(

victorpedrocs commented 6 years ago

Same issue here. Macbook running Mac OS Sierra 10.12.6 VS Code 1.16.1 Keyboard settings: U.S. International - PC 😞

bloqhead commented 6 years ago

I am on version 1.18.1 and am encountering the same bug. Completely disabled all extensions and the bug persists. I also tried clearing out my custom settings and restarted but to no avail.

It seems to only be happening in Twig for me, even when I had all extensions disabled. Tested in other file types and it works just dandy. I was able to have a colleague recreate the issue.

I'm on macOS High Sierra and using the standard US format keyboard type.

stephenpc commented 6 years ago

Reporting the same bug... happens regardless of file type.

vvinhas commented 6 years ago

With so many reports, this should be considered a severe bug. It's ruining the experience for Mac users.

Rumyra commented 6 years ago

The keybinding @vtr83 made above doesn't work as I would expect to fix this...

I modified it - this is how I would want my quotes to work (I add one and one appears after and the cursor stays in the middle)

{
    "key": "shift+'",
    "command": "editor.action.insertSnippet",
    "when": "editorTextFocus",
    "args": {
      "snippet": "\"$1\""
    }
  },
  {
    "key": "'",
    "command": "editor.action.insertSnippet",
    "when": "editorTextFocus",
    "args": {
      "snippet": "'$1'"
    }
  }
rvkempf commented 6 years ago

I am experiencing this bug on a Windows 7 laptop, v1.18.1, all extensions disabled

robertotcestari commented 6 years ago

Same here!!! Mac High Sierra - International English Keyboard.

artem-p commented 6 years ago

Same thing. 1.18.0, Windows 10.

artem-p commented 6 years ago

Sorry, in my case it was due to React JSX extension. Without it works fine.

pedrotorchio commented 6 years ago

Same on High Sierra, US International keyboard

morcegon commented 6 years ago

Same here on High Sierra, Brazilian Keys.

ghost commented 6 years ago

this bug is ruining my vscode experience..

macOS High Sierra, German layout

Maffelz commented 6 years ago

FUCK THIS IDE, ALLWAYS PROBLEM BUT THE WANT THERE FUCKING MONEY !!!!!

bloqhead commented 6 years ago

@Maffelz did you pay for Code? If you did, someone screwed you. Perhaps give civility and logic a try (and maybe even a grammar checker).

Back on topic, I'm still encountering this in PHP and Twig. I even pared down my plugin list considerably. Every other file format works fine.

leelandmiller commented 6 years ago

This is the second time I've tried switching from Atom to Code in the past year. It starts out somewhat satisfying (for a couple hours) and then is ruined by something so small like this. Things that I never even thought twice about not having when using Atom. Apparently Code is just not ready for actual use yet.

proimage commented 6 years ago

It's not being inside or outside of HTML that causes this behavior. Quotes autocomplete (or not) according to the char before and after them. From my testing:

dandeveloper commented 6 years ago

Almost one year and no one has fixed this bug, because of that I'm still using Atom.

andreyvital commented 6 years ago

Same here. Doesn't work if I use a Brazilian Portuguese keyboard scheme. Thoughts?

screen shot 2018-03-07 at 21 31 48
andersonsantos commented 6 years ago

Same here on High Sierra, Brazilian Keys.

Toisen commented 6 years ago

Same in Win10 with Ru/En layout. The editor can't auto close quotes in 2018 (almost a YEAR since bug report!!!)... Not even funny. One of my collegues suggested me to try VS Code instead of WebStorm. You know what? I'm almost done with it! Intellisense and autocompletion breaks if closing tag in front of a caret so I need to put space for some strange reason, there is no syntax highliting for Angular 5 properties in html templates even with Angular Language Service extension, refactorings not exist and I don't even want to tell you how big is my config file became in that two days of pain. Looks like the only thing that done right with this product is marketing strategy.

lavandongen commented 6 years ago

Still an issue as of today :/ not cool. Code runs a lot better on my low-end hardware, but this and many other autocomplete bugs/features just totally ruin my coding experience. Switching back to Atom for now where this behaviour is perfect.

Will see in a year or so if this has changed.

dsudduth commented 6 years ago

@rebornix Any chance you can offer some feedback here? Seems like something that could be escalated and fixed.

BraisC commented 6 years ago

Yep, the problem appears when there is a char after the quotes, example: \<div class="> //Not autocomplete \<div class=" > //Autocomplete correctly, notice the space before the closing >

andremacola commented 6 years ago

After one year, the VSCode team still do not care about non english programmers.

Here is my workaround so far. Because ' key is the same for accented characters such as á, é, í, ó, ú I use key binding cmd+' to auto close single quote and for double quotes the normal shift+' (maybe is not the ideal for people who needs words like ü ä ö)

{ "key": "cmd+'", "command": "editor.action.insertSnippet", "when": "editorTextFocus", "args": {"snippet": "'$1'"} },

{ "key": "shift+'", "command": "editor.action.insertSnippet", "when": "editorTextFocus", "args": { "snippet": "$1\"" } },