Skip to content

VSCode indents most lines with spaces but some in tabs #660

@swayongshen

Description

@swayongshen

Currently using UI5 language assistant as default formatter for .xml files with these VSCode settings enabled.

{
  "editor.defaultFormatter": "esbenp.prettier-vscode",
  "editor.formatOnPaste": true,
  "editor.formatOnType": false, // required
  "editor.formatOnSave": true, // optional
  "editor.formatOnSaveMode": "file", // required to format on save
  "files.autoSave": "onFocusChange", // optional but recommended
  "editor.insertSpaces": true,
  "editor.tabSize": 2,
  "[xml]": {
    "editor.defaultFormatter": "SAPOSS.vscode-ui5-language-assistant",
    "editor.detectIndentation": false
  },
  "files.associations": {
    "*.xml": "xml"
  }
}

These are the prettier settings

{
  "printWidth": 80,
  "tabWidth": 2,
  "useTabs": false,
  "semi": true,
  "singleQuote": true,
  "trailingComma": "es5",
  "bracketSpacing": true,
  "arrowParens": "always",
  "proseWrap": "never",
  "htmlWhitespaceSensitivity": "strict",
  "endOfLine": "lf"
}

The format result is that for most lines, spaces are used for indentation but it seems for lines of objects in quotes e.g. 'core:require' and 'items', tabs are used.

<mvc:View
    controllerName="sap.vi.results.controller.Main"
    displayBlock="true"
    xmlns="sap.m"
    xmlns:mvc="sap.ui.core.mvc"
    xmlns:core="sap.ui.core"
    xmlns:table="sap.ui.table"
    core:require="{
		formatter: 'sap/vi/results/model/formatter'
	}"
>
    <!-- Temporary table to view mock data -->
    <Table
        id="table"
        inset="false"
        items="{
			path: '/InspectionResults',
			sorter: {
				path: 'id'
			}
		}"
    >
...

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions