D
D
Dmi3ii2018-01-29 11:34:03
Vue.js
Dmi3ii, 2018-01-29 11:34:03

How to set up auto-formatting in VS Code/beautify?

Good afternoon.
VS Code has the beatify plugin installed. ctrl+alt+f formats my *.vue files. The project contains the .jsbeautifyrc setting. Not always satisfied with the result of autoformat:

example
// такое
        var map = {
          q: "й", w: "ц", e: "у", r: "к", t: "е", y: "н", u: "г", i: "ш", o: "щ", p: "з", a: "ф", s: "ы", d: "в", f: "а", g: "п", h: "р", j: "о", k: "л", l: "д", z: "я", x: "ч", c: "с", v: "м", b: "и", n: "т", m: "ь", Q: "Й", W: "Ц", E: "У", R: "К", T: "Е", Y: "Н", U: "Г", I: "Ш", O: "Щ", P: "З", A: "Ф", S: "Ы", D: "В", F: "А", G: "П", H: "Р", J: "О", K: "Л", L: "Д", Z: "?", X: "ч", C: "С", V: "М", B: "И", N: "Т", M: "Ь", ";": "ж", "'": "э", "[": "х", "]": "ъ", ",": "б", ".": "ю", "<": "Б", ">": "Ю", ":": "Ж", '"': "Э", "{": "Х", "}": "Ъ"
        };

// превратит в 66 строк
        var map = {
          q: "й",
          w: "ц",
          e: "у",
          r: "к",
          t: "е",
          y: "н",
          u: "г",
          i: "ш",
          o: "щ",
          p: "з",
          a: "ф",
          s: "ы",
          d: "в",
          f: "а",
          g: "п",
          h: "р",
          j: "о",
          k: "л",
          l: "д",
          z: "я",
          x: "ч",
          c: "с",
          v: "м",
          b: "и",
          n: "т",
          m: "ь",
          Q: "Й",
          W: "Ц",
          E: "У",
          R: "К",
          T: "Е",
          Y: "Н",
          U: "Г",
          I: "Ш",
          O: "Щ",
          P: "З",
          A: "Ф",
          S: "Ы",
          D: "В",
          F: "А",
          G: "П",
          H: "Р",
          J: "О",
          K: "Л",
          L: "Д",
          Z: "?",
          X: "ч",
          C: "С",
          V: "М",
          B: "И",
          N: "Т",
          M: "Ь",
          ";": "ж",
          "'": "э",
          "[": "х",
          "]": "ъ",
          ",": "б",
          ".": "ю",
          "<": "Б",
          ">": "Ю",
          ":": "Ж",
          '"': "Э",
          "{": "Х",
          "}": "Ъ"
        };


Can somehow it is possible to create rules?
And, tell me, is it possible to enable alignment by assignment? NetBeans did this very nicely by aligning a group of variables with the "=" sign.
Thank you.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Moe Green, 2018-02-08
@mQm

"... enable alignment by assignment" - I saw such a plugin in Sublime. Perhaps there is a similar one for VSC?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question