Is there a way to disable removing space before parentheses when editing a function in VS Code?
Lets say I have a function
function render () { // some code here }
When I start editing it, VS Code removes the space before parentheses and transforms this code to:
function render() { // some code here }
Is there a way to disable this behavior?
In VS Code, press Ctrl+P and execute ext install insert-spaces .
On Windows Shift + Alt + F. On Mac Shift + Option + F. On Linux Ctrl + Shift + I.
"javascript.format.insertSpaceBeforeFunctionParenthesis": true
function render () { // some code here }
"javascript.format.insertSpaceBeforeFunctionParenthesis": false
function render() { // some code here }
"editor.formatOnType": true
I had opposite problem with anonymous functions. We use prettier extension. Auto-correct inserts a space before parenthesis. And then prettier complains about it.
var anonfunc = function() { // Expected syntax. } var autocorrected = function () { // Auto-correct inserts a space }
There is similar code option, which solves my problem:
"javascript.format.insertSpaceAfterFunctionKeywordForAnonymousFunctions": false
By default it is true
. Took me some time, until I was tired correcting auto-correct.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With