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
JsBeautify() is ignoring .editorconfig #46
Comments
It's very strange. can you put here what print:
and which version vim |
It's empty: {'js': {}, 'html': {}, 'css': {}} I'm using VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Feb 5 2014 18:08:13) |
It seems that not applied any .editorconfig. cd /tmp/
git clone --recursive git@github.com:maksimr/vim-jsbeautify.git
cd vim-jsbeautify
npm install
grunt urchin grunt urchin should run test for vim. |
Do you have |
g:config_Beautifier returns "command not found". Running grunt urchin is taking a long time. I'll let it run and report the output. |
You can setting beautifier through this variable but it but it is not preferable. Maybe you have This command check existing g:config_Beautifier in .vimrc:
|
Thanks! |
Right. When I put it into my .vimrc, it gives this error while trying to launch Vim: Pattern not found: config_Beautifier So basically, it's not reading .editorconfig when I put it in ~/ or ~/vim/ |
Hm ... I can not reproduce bug :( |
It's okay, thank you for the advice. I'll try again sometime. |
Hi, I'm having exactly the same problem :) All I need to do is change the indent to 2. Thank you! |
g:config_Beautifier should looks like: {'js': {'path': '~/.vim/bundle/js-beautify/js/lib/beautify.js', 'indent_style': 'space', 'indent_size': '4', 'bin': 'node'},
'html': {'brace_style': 'expand', 'preserve_newlines': 'true', 'path': '~/.vim/bundle/js-beautify/js/lib/beautify-html.js', 'indent_inner_html': 'true', 'indent_style': 'space', 'indent_size': '4', 'max_char': '78'},
'css': {'path': '~/.vim/bundle/js-beautify/js/lib/beautify-css.js', 'indent_style': 'space', 'indent_size': '4'}} You use MacOS X? |
Thanks for the reply!
Should I set a path to the JSON file you posted above?
I apologize if this is a very basic question! Yes, I'm using MacOS X |
No problems :) Try put it in your .vimrc let g:config_Beautifier = {}
let g:config_Beautifier['js'] = {}
let g:config_Beautifier['js'].indent_size = '4' |
Thank you, that works perfectly :) |
@kittykatattack Awesome! But unfortunately this does not solve the bug... |
I'm having the same issue as @nobleach I'm gonna try to hard code stuff in I've tried on two macs: air and pro, both running mavericks and vi/vim/macvim. I'm not new to vi, but I'm not at the level of writing plugins for it though! lol |
this did work, but its a workaround: let g:config_Beautifier = {}
let g:config_Beautifier['js'] = {}
let g:config_Beautifier['js'].indent_size = '2' |
@wayneseymour Thanks! I will try fix is as soon as possible! |
You also may use |
Thanks @maksimr I'll give that a shot! |
Hey guys can you check last commit. Is it fix problem? |
Nope, it's still being ignored for me. I have it in my $HOME. I can try it in a project path as well and see if it gets parsed. |
No, it doesn't get parsed in the project path either. |
Attempting to manually set the variables from Vim's command mode fails: let s:plugin_Root_directory = fnamemodify(expand(""), ":h") returns: E461 Illegal variable name: s:plugin_Root_directory |
@nobleach thanks! If you want manually set path to editorconfig file you should define |
Unfortunately I don't have MacOS under my hand. If somebody can try fix it, I think problem in this line, which expand not correct on MacOS |
If time permits, I will try to look at it. I think the problem might be before that line as the variable isn't setting correctly, and it's not available in the line you highlighted. |
I wish it was in JavaScript, I could help quicker! -- W.K. Seymour III Software Engineer - JavaScript, Intel's High Performance Data Division console.log((function() {return function(lang) {return lang + ' & AngularJS shameless plug: http://blog.wayneseymour.com/ On Mon, May 12, 2014 at 9:27 AM, nobleach notifications@github.com wrote:
|
I have osx in my work, and can debug this. But I don't think the problem is in that line. let s:plugin_Root_directory = fnamemodify(expand("<sfile>"), ":h")
let s:paths_Editorconfig = map(['$HOME/.editorconfig', '$HOME/.vim/.editorconfig', s:plugin_Root_directory.'/.editorconfig'], 'expand(v:val)') That means you are looks in:
IMO - the default and first place to look in should be the |
I was having this kind of problem too. I put some print statements in the plugin .vim file to figure out what was going on, and I fixed it for myself. For me, the cause was that I had leading spaces in my .editorconfig file. Getting rid of those solved everything. My env: OS X Yosemite, Terminal.app |
I can confirm that after removing leading spaces in the .editorconfig file, JsBeautify is not ignoring .editorconfig file any more Credits to @eds101 OSX 10.10.3 Yosemite with terminal.app |
Hi, I found the same issue in my machine. (OSX Vim 7.4) And after I try to run the unit test with grunt, I got the errors below.
Can somebody give me a hand? Thx. |
After I comment out the v8 mixin in And there is no such command |
thanks @eds101, same issue solved by removing leading white-spaces from |
One year latter, the issue is still exists on OS X at least:
|
@alex-shamshurin could you show the content of your Thanks |
And what to do with incorrect function applied for jsx? Why jsxBeautify and jsBeautify functions yields same result? Here is my vimrc
|
@alex-shamshurin thanks, If we talk about global .editorconfig (not per project) then:
Most important steps in parsing 2.a If we does not found section(js,jsx,html) in config we set it as empty object - https://github.com/maksimr/vim-jsbeautify/blob/master/plugin/beautifier.vim#L109-L113 2.b Section should look like 2.c Special comment should start with 2.d We don't parse [*] So in your editorconfig you have:
As example of global editorconfig you could look at this config and that Thanks |
Of course I need a local congig and it must take a precedence over global one. I found .editorconfig in plugin's folder. I put this config https://github.com/maksimr/dotfiles/blob/master/export/_editorconfig.symlink into project's folder. And the plugin do not see it. |
@alex-shamshurin do you have installed https://github.com/editorconfig/editorconfig-vim? |
No. nobody told me ((( |
I've just insalled it and what see I got - the same 4 spaces http://joxi.ru/p27808YIoZeXjA |
And in given example configconfigs ;path is wrong, |
@alex-shamshurin try use [**.js] in your config, is it fix you problem? Thanks |
|
This is my config
vimrc is above. It does not use proper function for jsx formatting |
@alex-shamshurin I have added test for your use case and it works fine. Thanks |
Thanks, but I think everyone should use Prettier |
I have tried my .editorconfig in both my ~/ dir and ~/.vim/ but it still is ignored. When I invoke :call JsBeautify() it uses 4 spaces instead of 2.
Here is my .editorconfig
root = true
[**.js]
indent_style = space
indent_size = 2
[**.css]
indent_style = space
indent_size = 2
[**.html]
indent_style = space
indent_size = 2
max_char = 78
brace_style = expand
The text was updated successfully, but these errors were encountered: