Vetur: need configure indent size

Created on 10 Nov 2017  ·  6Comments  ·  Source: vuejs/vetur

Info

  • Platform: Windows 10
  • Vetur version: 0.11.0
  • VS Code version: 1.18.0

Problem

I hope indenting 4 spaces.
I have configured .editorconfig to set indent_size = 4
I haven't found any settings of vetur for indent setting.

Thus, is there a way to configure? Or would vetur support that in the near future?

question

Most helpful comment

You can 1) add prettier.tabWidth in your VS Code workspace setting. 2) Create a .prettierrc with tabWidth set to 4.

All 6 comments

We do not support .editorconfig.
Use editor.tabSize in VS Code.

@octref editor.tabSize also be configured to 4. but something always indent 2 spaces when I use Format Document command.

Format command cannot format HTMLs in <template></template>. And, styles and scripts are idented by 2 spaces. such as:

<template>
    <div class="comsumables-list">
        <mt-header fixed title="出入库配置">
            <router-link to="/" slot="left">
                <mt-button icon="back">返回</mt-button>
            </router-link>
        </mt-header>
        <mt-search v-model="search" placeholder="搜索" />
    </div>
</template>

<style lang="less" scoped>
.comsumables-list {
  margin-top: -20px;
}
</style>

<script>
export default {
  name: "comsumables-list",
  data() {
    return {
      search: ""
    };
  }
};
</script>

I found the reson is about Prettier. How can I configure to use VSCode build-in formatter for HTML/TS/JS?

You can 1) add prettier.tabWidth in your VS Code workspace setting. 2) Create a .prettierrc with tabWidth set to 4.

@octref Thank you. I have done with prettier.tabWidth.

However, I hope vetur can be configured to use build-in formatter for HTML, JavaScript and TypeScript.

Having multiple places for formatting options can be confusing. I'd much rather let prettier only read settings from .prettierrc or VS Code's prettier.* settings. With that being said I do need to update docs for formatting.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

pdanpdan picture pdanpdan  ·  3Comments

yoyoys picture yoyoys  ·  3Comments

thibautguedou3 picture thibautguedou3  ·  3Comments

muhajirdev picture muhajirdev  ·  3Comments

octref picture octref  ·  3Comments