Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
swayongshen opened this issue Oct 4, 2023 · 3 comments
Open

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

swayongshen opened this issue Oct 4, 2023 · 3 comments
Labels
enhancement New feature or request

Comments

@swayongshen
Copy link

swayongshen commented Oct 4, 2023

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'
			}
		}"
    >
...
@MN-public
Copy link
Contributor

@swayongshen
Thanks for your feedback.
Currently UI5 language assistant does not format objects which are represented as strings in xml attribute so they are taken over without formatting.
We can think of an enhancement to support objects in xml strings in future

BTW: are you aware of any formatter in xml which also formats strings representing objects in xml attribute?

@MN-public MN-public added the enhancement New feature or request label Oct 4, 2023
@swayongshen
Copy link
Author

@MN-public

Thank you for your response, I am not aware of any such formatters.

@BenReim
Copy link

BenReim commented Oct 11, 2023

BTW: are you aware of any formatter in xml which also formats strings representing objects in xml attribute?

Not sure about the name, but the now deprecated SAP Web IDE used a formatter that would also format object string within XML

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants