For some odd reason, single and double quotes are not self closing.
Brackets and parentheses are working fine though.
VSCode Version: April 2017 (1.12)
OS Version: macOS Sierra (10.12.4)
@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?
NP @rebornix
Unfortunately, the same thing happens and no errors are shown in the console.
@vvinhas can you share the extensions list with me ? Or even better together with your settings file.
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
}
Using version 1.14.2
and the bug persist.
Same bug here. Version 1.15.1 and MacOS 10.12.5
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.
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
Same problem here with 1.15.1 (1.15.1) OSX El Capitan
@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
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.
@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.
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 ?
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
@CodeSigils yes this is a Vscode problem, all the other editors works just fine. Your solution is not for non-english languages.
I can confirm the issue. Right now I'm using keyboard layout set to "U.S International". ST and Atom work as expected.
Seems to be macOS specific problem, doesn't have this on VSCode 1.14.0 on Windows 7.
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.
@nighto True! I've tried on Windows 10, and even with English keyboard it works!
P.S. Atom on MacOS also works properly.
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.
Same issue here.
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.
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
Exactly same issue here =/
Macbook Pro 13" 2017 Touchbar
MacOS 10.12.6
VSCode 1.17.2
Keyboard Layout : US International PC
Same here :(
Macbook Pro 15" 2017 Touchbar
MacOS 10.13
VSCode 1.17.2
Keyboard Layout : US International PC
same here!
Mac OS High Sierra 10.13.1
I'm very disappointed, moving back to ST until VS Code get this fixed :-(
Same issue here.
Macbook running Mac OS Sierra 10.12.6
VS Code 1.16.1
Keyboard settings: U.S. International - PC
😞
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.
Reporting the same bug... happens regardless of file type.
With so many reports, this should be considered a severe bug. It's ruining the experience for Mac users.
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'"
}
}
I am experiencing this bug on a Windows 7 laptop, v1.18.1, all extensions disabled
Same here!!!
Mac High Sierra - International English Keyboard.
Same thing. 1.18.0, Windows 10.
Sorry, in my case it was due to React JSX extension. Without it works fine.
Same on High Sierra, US International keyboard
Same here on High Sierra, Brazilian Keys.
this bug is ruining my vscode experience..
macOS High Sierra, German layout
FUCK THIS IDE, ALLWAYS PROBLEM BUT THE WANT THERE FUCKING MONEY !!!!!
@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.
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.
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:
>
tag.Almost one year and no one has fixed this bug, because of that I'm still using Atom.
Same here. Doesn't work if I use a Brazilian Portuguese keyboard scheme. Thoughts?
Same here on High Sierra, Brazilian Keys.
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.
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.
@rebornix Any chance you can offer some feedback here? Seems like something that could be escalated and fixed.
Yep, the problem appears when there is a char after the quotes, example:
\
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\""
}
},
@andremacola this works fine, but when you try to select a word and press single or double quotes it rewrites with the quotes and does not wrap it around.
I had the same issue, just changed the language from "US International" to "US" and everything works fine now.
Really? Because I've always been on "US" and it's never worked.
@caiodv but with US layout you cant write words like á é à ó ú ñ ü ö ï... etc. You need US International
@andremacola on mac you can, you just need to use the alternative method of applying accents, press option+e and you get é, option+i and you get î, and so on...on a windows machine I have no idea.
I've created a keymap to solve this, you can use with selected texts as well.
{
"key": "ctrl+shift+'",
"command": "editor.action.insertSnippet",
"when": "editorTextFocus",
"args": {
"snippet": "\"${TM_SELECTED_TEXT}$1\""
}
},
{
"key": "ctrl+'",
"command": "editor.action.insertSnippet",
"when": "editorTextFocus",
"args": {
"snippet": "'${TM_SELECTED_TEXT}$1'"
}
},
{
"key": "ctrl+;",
"command": "editor.action.insertSnippet",
"when": "editorTextFocus",
"args": {
"snippet": "`${TM_SELECTED_TEXT}$1`"
}
}
@vitor-hugo great! Just adapt your keymap to works well on Mac keyboard.
{
"key": "shift+'",
"command": "editor.action.insertSnippet",
"when": "editorTextFocus",
"args": {
"snippet": "\"${TM_SELECTED_TEXT}$1"
}
},
{
"key": "cmd+'",
"command": "editor.action.insertSnippet",
"when": "editorTextFocus",
"args": {
"snippet": "'${TM_SELECTED_TEXT}$1'"
}
},
{
"key": "cmd+`",
"command": "editor.action.insertSnippet",
"when": "editorTextFocus",
"args": {
"snippet": "`${TM_SELECTED_TEXT}$1`"
}
}
How do you use it afterwards @dandeveloper?
Same thing here, looks like it will never be fixed. Atom is a much better editor, I just keep using vscode because of its performance. I will switch back to Atom when they solve it.
Same thing here..
Same problem here.
Learnt Portuguese a little bit (my first language doesn't have accents) and pushed a fix for this issue. The auto closing will be triggered when you press an acute accent like '
and press space. Please note that the auto closing logic is the same as when you use US keyboard layout.
Techinically auto close doens't kick in before the fix because inserting '
in US international or Portuguese will switch the IME to composition mode, a following space quits the composition mode but we didn't try to see if we should do an auto closing.
You can have the fix from tomorrow's Insiders and next month's Stable.
To verifiers (VSCode team member):
I am using a mac from the US, I guess the problem is the atom shortcut that I got, but it was a really good insight @rebornix .
@aeciolevy feel free to ping if the fix doesn't work for you, there are probably other issues that leads to unexpected behavior.
@rebornix I've made some tests and when I select and try to wrap the text with single or double quotes, the text is replaced by the quotes. Another strange behavior that I noticed happens when you are in a single line comment in a javaScript file for example, the single and double quotes doesn't work properly.
Hello, i solved this issue with this extension:
https://marketplace.visualstudio.com/items?itemName=konstantin.wrapSelection
i hope this feature could be by default in coming versions.
Thanks.
@rebornix, now its working in this last update! Thank you! I'm from Brazil, using Mac and Brazil Pro layout in US Int keyboard (PT_BR).
Still not working on Mac using US International keyboard layout
Guilherme, did you try the code-insiders ?
The insiders version is working for me - Mac US Intl keyboard.
On 11 July 2018 at 14:43:34, Guilherme Pacheco ([email protected])
wrote:
Still not working on Mac using US International keyboard layout
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/Microsoft/vscode/issues/26820#issuecomment-404253483,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ANmcrehKbOJfVpuwTAv1B3WJxUAKxpisks5uFjlEgaJpZM4Nd6tT
.
@lucheol the open and close the quotes bug was solved but there is another bug when you try to wrap a word with quotes.
@rebornix Did you read my comment about the bug when you select a word and try to wrap it with quotes?
@dandeveloper really, only the open and close quotes are solved. Wrap quotes still not working here too.
@CentaurWarchief Fiz uma alteração no keybiding da @Rumyra para funcionar com a configuração de teclado "Brazilian Pro" do Mac.
{
"key": "shift+'",
"command": "editor.action.insertSnippet",
"when": "editorTextFocus",
"args": {
"snippet": "$1\""
}
},
{
"key": "'",
"command": "editor.action.insertSnippet",
"when": "editorTextFocus",
"args": {
"snippet": "$1'"
}
}
Most helpful comment
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'" } }