maksimr / vim-jsbeautify

vim plugin which formated javascript files by js-beautify
758 stars 68 forks source link

Passing options to JS beautifier #144

Closed esanzgar closed 5 years ago

esanzgar commented 5 years ago

How can I pass this option "brace_style": "collapse-preserve-inline" to js-beautifier?

I have tried the following in my .editorconfig, but didn't have any effect:

[**.js]
;vim:brace_style=collapse-preserve-inline

It should produce:

import { A } from 'a'

from

import {A} from 'a'
maksimr commented 5 years ago

@esanzgar you are doing all right. The plugin should pass this option to js-beautify but maybe the version of js-beautify which shipped with plugin does not support collapse-preserve-inline value for brace_style.

The version of js-beautify is 1.7.5 inside plugin.

You can install a custom version of js-beautify and pass it to the plugin

https://github.com/maksimr/vim-jsbeautify#examples

path=~/.vim/bundle/js-beautify/js/lib/beautify.js
maksimr commented 5 years ago

@esanzgar I have added test for this use case and it passes so you can look at it and check with your settings

Thanks!

esanzgar commented 5 years ago

For some reason with my configuration (js-beautify v1.8.8) only the version without the ;vim: works fro me:

[**.js]
brace_style = collapse-preserve-inline

Thanks!