Vetur: insertSpaceBeforeFunctionParenthesis setting is not working for standard function

Created on 6 Jun 2017  路  4Comments  路  Source: vuejs/vetur

  • Platform: macOS
  • Vetur version: 0.7.0
  • VSCode version: 1.12.2

I have the following config setting:

"vetur.format.js.InsertSpaceBeforeFunctionParenthesis": false

when formatting the following code:

<script>
var add = function (a, b) {
  return a + b;
};

export default {
  name: 'hello',
  methods: {
    login(event) {
      console.log(event);
    }
  },
  data() {
    return {
      msg: 'Welcome to Your Vue.js App!!!' + add(12, 14)
    };
  }
};
</script>

It removes correctly the spaces in login or data, but it adds a space before parenthesis in the standard add function.

PS: When vetur.format.js.InsertSpaceBeforeFunctionParenthesis is true everything is consistent

bug formatting

Most helpful comment

@BruceHem

  • set vetur's default formatter to "vscode-typescript"
  • and then set "javascript.format.insertSpaceBeforeFunctionParenthesis" to "true"
"vetur.format.defaultFormatter.js": "vscode-typescript",
"javascript.format.insertSpaceBeforeFunctionParenthesis": true

All 4 comments

Thanks. I can confirm it's working as expected in ts file but not vue file.

That space is controlled by InsertSpaceAfterFunctionKeywordForAnonymousFunctions in TS formatter setting, not InsertSpaceBeforeFunctionParenthesis.

I've made it so that InsertSpaceBeforeFunctionParenthesis would control both, so now Vetur should be consistent for space before function. Will be available in 0.9.5.

Hi i'm on Vetur 0.10.1 and I don't see InsertSpaceBeforeFunctionParenthesis in config options

@BruceHem

  • set vetur's default formatter to "vscode-typescript"
  • and then set "javascript.format.insertSpaceBeforeFunctionParenthesis" to "true"
"vetur.format.defaultFormatter.js": "vscode-typescript",
"javascript.format.insertSpaceBeforeFunctionParenthesis": true
Was this page helpful?
0 / 5 - 0 ratings