Skip to content

Auto-indent on Enter does not respect indentation inside <script> / <script setup> tags #97

@nick-dolan

Description

@nick-dolan

Summary

When pressing Enter inside a <script setup> block, Zed always auto-indents to column 0 (no indent) for top-level statements. This conflicts with the ESLint rule vue/script-indent with baseIndent: 1, which expects one level of indentation inside <script>.

Steps to reproduce

  1. Configure ESLint with 'vue/script-indent': ['error', 2, { baseIndent: 1 }]
  2. Open a .vue file where code inside <script setup> is indented with 2 spaces:
<script setup>
  import { ref } from 'vue'

  const count = ref(0)
  // place cursor at the end of this line and press Enter
</script>

Place cursor at the end of any line inside <script setup> and press Enter

Expected behavior

The new line should maintain the base indentation level (2 spaces) consistent with the rest of the <script setup> content.

Actual behavior

The existing line is re-indented to column 0, removing the base indentation. On save, ESLint fix restores the correct indentation, but the editing experience is disrupted.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions