Skip to content

Autoindent not working #1051

Closed
Closed
@fornaeffe

Description

@fornaeffe

Problem: auto indentation doesn't work.

With a file like this, named "prova.xml":

<?xml version="1.0" encoding="UTF-8" ?>
<root>
    <tag></tag>
</root>

Moving the cursor between <tag> and </tag> and typing return it does not increment indentation nor add a new line for content, it just keeps previous indentation:

<?xml version="1.0" encoding="UTF-8" ?>
<root>
    <tag>
    </tag>
</root>

even if I have "editor.autoIndent": "full" in settings.

Version:

VS Code:

Version: 1.96.4 (user setup)
Commit: cd4ee3b1c348a13bafd8f9ad8060705f6d4b9cba
Date: 2025-01-16T00:16:19.038Z
Electron: 32.2.6
ElectronBuildId: 10629634
Chromium: 128.0.6613.186
Node.js: 20.18.1
V8: 12.8.374.38-electron.0
OS: Windows_NT x64 10.0.22631

XML:

Identifier
redhat.vscode-xml
Version
0.27.2

What I tried:

  • Checked with pre-release version of XML (same behavior)
  • Checked that auto indentation works with html (it works)
  • Checked that "XML" shows on bottom right on the status bar of VSCode (it shows).
  • Cheched that "editor.autoIndent": "full" is not overridden for xml, or by workspace settings
  • Added
"[xml]": {
    "editor.autoIndent": "full",
    "editor.defaultFormatter": "redhat.vscode-xml",
    "editor.formatOnType": true,
    "editor.tabSize": 4,
    "editor.insertSpaces": true
}

to VSCode settings (also tried to add some of these separately)

  • Checked the output for XML Support:
[Info  - 10:44:00 AM] gen 28, 2025 10:44:00 org.eclipse.lemminx.XMLLanguageServer initialize()
Message: Initializing XML Language server
LemMinX Server info:
 - Version : 0.29.0
 - Java : C:\Program Files\Java\jre1.8.0_431
 - VM Version : 1.8.0_431
 - Git acacf75 - [maven-release-plugin] prepare release 0.29.0
  • Disabled other extensions

  • Reinstalled VSCode

  • Toggled developer tools, and the Console displays this error:

console.ts:137 [Extension Host] [relatedFiles] unknown language xml
EYi	@	console.ts:137
  • Forced language association both manually (Change language mode in Command Palette) and with
"files.associations": {
    "*.xml": "xml"
}

even if it always showed "XML" on the status bar, even without manual association.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions