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

.editorconfig for typescript #143

Open
esanzgar opened this issue Oct 22, 2018 · 7 comments
Open

.editorconfig for typescript #143

esanzgar opened this issue Oct 22, 2018 · 7 comments

Comments

@esanzgar
Copy link

Two questions:

I use jsbeautify from typescript files. In my .vimrc, I have:
autocmd FileType typescript vnoremap <buffer> <c-f> :call RangeJsBeautify()<cr>

How can I setup my .editorconfig for typescript? These rules are ignored for typescript files in my .editorconfig:

[**.ts]
charset = utf-8
indent_style = space
indent_size = 3
insert_final_newline = true
trim_trailing_whitespace = true

Thanks

@maksimr
Copy link
Owner

maksimr commented Oct 22, 2018

@esanzgar now plugin supports only 'js', 'css', 'html', 'jsx', 'json' types.

Does js-beautify support typescript?

Thanks!

@maksimr
Copy link
Owner

maksimr commented Oct 23, 2018

@esanzgar try to rename [**.ts] to [**.js]

[**.js]
charset = utf-8
indent_style = space
indent_size = 3
insert_final_newline = true
trim_trailing_whitespace = true

@maksimr maksimr closed this as completed Oct 23, 2018
@esanzgar
Copy link
Author

In general, js-beautify works pretty well with typescript. I found just a couple of corner cases were js-beautify doesn't format typescript correctly.

Renaming all [**.ts] to [**.js] doesn't work. Changing all the extension .ts to .js is not an option.

Thank you anyway.

@maksimr
Copy link
Owner

maksimr commented Oct 23, 2018

@esanzgar No problem,

I have checked it for typescript and it works for me

P.S. I have used JsBeautify instead RangeJsBeautify

@esanzgar
Copy link
Author

esanzgar commented Oct 23, 2018

I have JsBeautify and v1.7.5 of js-beautify:

autocmd FileType typescript noremap <buffer> <c-f> :call JsBeautify()<cr>

but still it doesn't pick up the .editorconfig rules under [**.js].

@esanzgar
Copy link
Author

esanzgar commented Nov 9, 2018

@maksimr You are right, it works for typescript files when the .editorconfig is explicitly set.

My issue was that the .editorconfig is found and parsed through the editorconfig-vim plugin. That was my particular scenario and it didn't work me.

I have resolved the issue with this simple if statement:
master...esanzgar:master

@maksimr
Copy link
Owner

maksimr commented Nov 9, 2018

@esanzgar Thanks

@maksimr maksimr reopened this Nov 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants