Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Javascript formatter: space-before-function-paren #15386

Closed
aochsner opened this issue Nov 11, 2016 · 10 comments
Closed

Javascript formatter: space-before-function-paren #15386

aochsner opened this issue Nov 11, 2016 · 10 comments
Labels
feature-request Request for new features or functionality formatting Source formatter issues javascript JavaScript support issues

Comments

@aochsner
Copy link

We use space-before-function-paren in our eslint rules for readability. I'd like an option to format to this behavior

  • VSCode Version: 1.7.1
  • OS Version: macOS Sierra 10.12.1

Steps to Reproduce:

  1. Type function foo () { }
  2. Format the code (if it doesn't auto-format)
  3. Code is formatted to function foo() { } with no mechanism to override
@waderyan waderyan added feature-request Request for new features or functionality formatting Source formatter issues javascript JavaScript support issues labels Nov 14, 2016
@waderyan
Copy link

@aochsner thank you for opening this issue. The functionality for formatting is provided by TS Server. I will migrate this feature request to their repo.

@waderyan
Copy link

This issue was moved to microsoft/TypeScript#12234

@ChiriVulpes
Copy link

Does this have a new issue for the vscode side now, @waderyan? Can't seem to find it

@krokofant
Copy link

This doesn't seem fixed at all yet the referenced issue(microsoft/TypeScript#12234) and this one is closed. Format still removes space between function name and (. I found no settings option for this either.

Using the latest 1.9.0 on macOS.

@deltacat
Copy link

same as krokofant, MacOS, 1.9.1

@mubaidr
Copy link

mubaidr commented Apr 11, 2017

Using Vs code 1.12 insider build. Following settings are ignored on format:

// Defines space handling before function argument parentheses. Requires TypeScript >= 2.1.5.
"typescript.format.insertSpaceBeforeFunctionParenthesis": true,
// Defines space handling before function argument parentheses. Requires TypeScript >= 2.1.5.
"javascript.format.insertSpaceBeforeFunctionParenthesis": true

@shijunti19
Copy link

same as krokofant, MacOS, 1.12.2

@mubaidr
Copy link

mubaidr commented Apr 24, 2017

I am able to fix this by making es-lint auto correct the fixable code:

"files.associations": {
		"*.vue": "html"
	},
"editor.formatOnSave": true,
	// Defines space handling before function argument parentheses. Requires TypeScript >= 2.1.5.
	"typescript.format.insertSpaceBeforeFunctionParenthesis": true,
	// Defines space handling before function argument parentheses. Requires TypeScript >= 2.1.5.
	"javascript.format.insertSpaceBeforeFunctionParenthesis": true,
	// Eslint options
	"eslint.enable": true,
	"eslint.options": {
		"extensions": [
			".html",
			".js",
			".vue",
			".jsx"
		]
	},
	// An array of language ids which should be validated by ESLint
	"eslint.validate": [
		"javascript",
		"javascriptreact",
		{
			"language": "html",
			"autoFix": true
		}
	],
	// Run the linter on save (onSave) or on type (onType)
	"eslint.run": "onSave",
	// Turns auto fix on save on or off.
	"eslint.autoFixOnSave": true

Eslint is now fully integrated in vscode and everything works great! 👍

@ChiriVulpes
Copy link

You guys should open a new issue, it works for me on Win10 and I don't think they watch comments on closed issues (that's why I opened the pull in the first place)

@dtsao
Copy link

dtsao commented Oct 1, 2017

Thanks @mubaidr. Your settings fixed the problem for me. Version 1.16.1 (windows).

@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 17, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature-request Request for new features or functionality formatting Source formatter issues javascript JavaScript support issues
Projects
None yet
Development

No branches or pull requests

8 participants