[vim/vim] javascript indent support doesn't parse &cinoptions properly (Issue #11941)

8 views
Skip to first unread message

Jesse Pavel

unread,
Feb 3, 2023, 10:46:58 AM2/3/23
to vim/vim, Subscribed

Steps to reproduce

  1. set sw=4 cinoptions=:0.5sw,=0.5s

  2. Indent this code as javascript:

    switch (x) {
      case 1:
        foo();
      case 2:
        bar();
    }
    

Expected behaviour

We expect to see the code indented as shown above (2 spaces used after switch and 2 after case). Instead, what results is

switch (x) {
case 1:
  foo();
case 2:
  bar();
}

this is because the function s:ParseCino(f) in indent/javascript.vim does not properly parse the :0.5s from &cino.

The indent/javascript.vim file that is bundled with Vim is taken from the pangloss/vim-javascript project to begin with, and that project already has an updated indent file that works properly

https://github.com/pangloss/vim-javascript/blob/master/indent/javascript.vim

Version of Vim

9.0.1271

Environment

gvim, Debian 11

Logs and stack traces

No response


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/11941@github.com>

Bram Moolenaar

unread,
Feb 7, 2023, 2:16:21 PM2/7/23
to vim/vim, Subscribed

@bounceme - the version under "pangloss" indeed looks like it has a few improvements, but the header still has the same date. Can you update the header and send me the new version?


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/11941/1421316109@github.com>

Reply all
Reply to author
Forward
0 new messages