Open so1ve opened 1 year ago
I'm not 100% sure what you mean, but vscode has API which allows extensions to define the tabSize and insertSpaces options that drive how indentation is inserted.
@alexdima Hi, thanks for your reply.
Vue SFC is a html-like DSL, which includes three built-in block types: script
, template
and style
. That is said, you can write three languages in a single file.
Vue also provides a way to register custom block: https://vue-loader.vuejs.org/guide/custom-blocks.html#example and we can use YAML as the block language. However, if vscode is configured to use tabs for indent, it will insert tabs in the whole SFC - no matter you are editing the script
block, template
block, or YAML
block. And this will cause a syntax error: YAML disallows using tabs for indent, but vscode tries to use tabs to indent such custom YAML blocks.
vscode has API which allows extensions to define the tabSize and insertSpaces options
These APIs can control the indentation of a whole file, not that of a part of the file.
This feature request is now a candidate for our backlog. The community has 60 days to upvote the issue. If it receives 20 upvotes we will move it to our backlog. If not, we will close it. To learn more about how we handle feature requests, please see our documentation.
Happy Coding!
:slightly_smiling_face: This feature request received a sufficient number of community upvotes and we moved it to our backlog. To learn more about how we handle feature requests, please see our documentation.
Happy Coding!
Currently, vscode fully controls whether the file uses tab or space to indent. However, as we know, using tabs in yaml files is a syntax error. When using Vue SFC, we expect using spaces to indent in yaml codeblocks, like this:
But we cannot control what should be used for indentation, which results in an embarrassing situation: we have to use spaces in yaml codeblocks, but when we press
tab
, it still prints a tab, not spaces.