othree / yajs.vim

YAJS.vim: Yet Another JavaScript Syntax for Vim
http://www.vim.org/scripts/script.php?script_id=4974
Vim License
688 stars 41 forks source link

Indent support #20

Closed BerkeleyTrue closed 9 years ago

BerkeleyTrue commented 9 years ago

Wondering if indent support might be in the future for this project?

othree commented 9 years ago

I am willing to do it. But I don't use fold function on Vim. So I will need some one help me to see is the logic good for people.

shadowhand commented 9 years ago

I'd love to have fold support on { if nothing else.

HerringtonDarkholme commented 9 years ago

@shadowhand You can have a look at my fork. It supports TypeScript, a superset of JavaScript. So you can fork yats and modify it into a valid js syntax, with fold . https://github.com/HerringtonDarkholme/yats.vim

rschmukler commented 9 years ago

As a temporary solution to anyone who wants it, I broke out the indenting from pangloss/vim-javascript (which I think is one of the better indenting detection libraries for javascript) and it is available here.

rosshadden commented 9 years ago

@rschmukler I like your idea, but cannot get your plugin to work. Is there more setup required than just loading the plugin?

I'm asking you here instead of on your repo because it (probably) has to do with using it in conjunction with yajs.vim. Thanks!

Edit: Nevermind, I was thinking it was for adding folding support for some reason.

othree commented 9 years ago

I am using pangloss's indent file too :)

rosshadden commented 9 years ago

Yeah I was going to say, the indention in yajs.vim actually works perfectly as-is. That's why I thought the OP was talking about supporting code folding.

othree commented 9 years ago

Since I don't use fold. I am not sure which part people want to fold. There is one vote for fold at {, } But no other opinions~

rosshadden commented 9 years ago

I think we can close this, as the title is "Indent support", and as far as I am aware there are not actually any issues or holes with the indent support in this plugin.

I opened #49 with the fold support.

olalonde commented 8 years ago

@rosshadden did you do anything to get indentation support (I really mean indentation, not fold)? I'm seeing this with only the othree/yajs plugin enabled:

sivcersgot

Using pangloss/vim-javascript instead fixes the indentation issue.

olalonde commented 8 years ago

I just tried @rschmukler solution:

Plugin 'othree/yajs.vim'
Plugin 'rschmukler/pangloss-vim-indent'

and indentation seems to work again.

rosshadden commented 8 years ago

I use these relevant plugins:

Plug 'othree/yajs.vim', { 'for': 'javascript' }
Plug 'othree/javascript-libraries-syntax.vim', { 'for': 'javascript' }
Plug 'othree/es.next.syntax.vim', { 'for': 'javascript' }

My behavior is the same as yours in your screenshot, but as far as I am concerned there is no problem. You are missing a semicolon. With the semicolon in place it works as expected, which is why I never noticed any issues.

othree commented 8 years ago

No semicolon is a coding style 😅 ref: http://standardjs.com/

olalonde commented 8 years ago

Yes, I'm in the no semicolons camp :)