So even if I set "html.format.wrapAttributes": "preserve", which should "preserve wrapping of attributes", certain tags like "id" are moved to a new line and this causes an error when reformatting. To rule out problems with other plugins, I have deactivated all others, but still no difference.
Therefore, I am posting my config in case this helps to identify the problem:
{
"workbench.colorTheme": "Default Dark+",
"emmet.excludeLanguages": [
"markdown",
"php"
],
"php.suggest.basic": true,
"php.validate.enable": true,
"workbench.list.openMode": "doubleClick",
"editor.mouseWheelZoom": true,
"php.validate.executablePath": "C:/PHP/php.exe",
"php.executablePath": "C:/PHP/php.exe",
"code-runner.clearPreviousOutput": true,
"code-runner.executorMap": {
"javascript": "node",
"java": "cd $dir && javac $fileName && java $fileNameWithoutExt",
"c": "cd $dir && gcc $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt",
"zig": "zig run",
"cpp": "cd $dir && g++ $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt",
"objective-c": "cd $dir && gcc -framework Cocoa $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt",
"php": "C:/PHP/php.exe",
"html": "C:/PHP/php.exe",
"python": "python -u",
"perl": "perl",
"perl6": "perl6",
"ruby": "ruby",
"go": "go run",
"lua": "lua",
"groovy": "groovy",
"powershell": "powershell -ExecutionPolicy ByPass -File",
"bat": "cmd /c",
"shellscript": "bash",
"fsharp": "fsi",
"csharp": "scriptcs",
"vbscript": "cscript //Nologo",
"typescript": "ts-node",
"coffeescript": "coffee",
"scala": "scala",
"swift": "swift",
"julia": "julia",
"crystal": "crystal",
"ocaml": "ocaml",
"r": "Rscript",
"applescript": "osascript",
"clojure": "lein exec",
"haxe": "haxe --cwd $dirWithoutTrailingSlash --run $fileNameWithoutExt",
"rust": "cd $dir && rustc $fileName && $dir$fileNameWithoutExt",
"racket": "racket",
"scheme": "csi -script",
"ahk": "autohotkey",
"autoit": "autoit3",
"dart": "dart",
"pascal": "cd $dir && fpc $fileName && $dir$fileNameWithoutExt",
"d": "cd $dir && dmd $fileName && $dir$fileNameWithoutExt",
"haskell": "runghc",
"nim": "nim compile --verbosity:0 --hints:off --run",
"lisp": "sbcl --script",
"kit": "kitc --run",
"v": "v run",
"sass": "sass --style expanded",
"scss": "scss --style expanded",
"less": "cd $dir && lessc $fileName $fileNameWithoutExt.css",
"FortranFreeForm": "cd $dir && gfortran $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt",
"fortran-modern": "cd $dir && gfortran $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt",
"fortran_fixed-form": "cd $dir && gfortran $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt",
"fortran": "cd $dir && gfortran $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt",
"sml": "cd $dir && sml $fileName"
},
"php.linkedEditing.variables": true,
"git.autofetch": true,
"php.docblock.classSnippet": {
"@author": "XYZ",
"@copyright": "(c) 2021-$CURRENT_YEAR DP24"
},
"php.format.rules.spaceWithinWhileParens": false,
"php.format.rules.spaceWithinIfParens": false,
"php.format.rules.spaceWithinForParens": false,
"php.format.rules.spaceWithinForeachParens": false,
"php.format.rules.spaceWithinExpressionParens": false,
"php.format.rules.spaceWithinDeclParens": false,
"php.format.rules.spaceWithinCatchParens": false,
"php.format.rules.spaceWithinCallParens": false,
"php.format.rules.spaceWithinBracketsAroundExpression": false,
"php.format.rules.spaceWithinBrackets": false,
"php.format.rules.spaceWithinArrayInitilizersParens": false,
"php.format.rules.spaceBeforeParenthesesInArrowFunctions": false,
"php.format.rules.whileStatementNewLineBeforeRightParen": true,
"php.format.rules.whileStatementNewLineAfterLeftParen": true,
"php.format.rules.switchStatementNewLineBeforeRightParen": true,
"php.format.rules.switchStatementNewLineAfterLeftParen": true,
"php.format.rules.spaceBeforeColonInReturnType": false,
"php.format.rules.spaceBeforeColonInControlStatements": false,
"php.format.rules.spaceAroundConcatenation": false,
"php.format.rules.openBraceOnNewLineForTypes": false,
"php.format.rules.openBraceOnNewLineForLambdas": true,
"php.format.rules.openBraceOnNewLineForFunctions": true,
"php.format.rules.openBraceOnNewLineForAnonymousClasses": true,
"php.format.rules.newLineAfterImplements": true,
"php.format.rules.indentBraces": false,
"php.format.rules.groupUseNewLineBeforeFirstDeclaration": true,
"php.format.rules.forStatementNewLineBeforeRightParen": true,
"php.format.rules.forStatementNewLineAfterLeftParen": true,
"php.format.rules.finallyOnNewLine": true,
"php.format.rules.elseOnNewLine": false,
"php.format.rules.declParametersNewLineBeforeRightParen": true,
"php.format.rules.declParametersNewLineAfterLeftParen": true,
"php.format.rules.catchOnNewLine": false,
"php.format.rules.callParametersNewLineBeforeRightParen": true,
"php.format.rules.callParametersNewLineAfterLeftParen": true,
"php.format.rules.arrayInitializersNewLineBeforeFirstElement": true,
"php.format.rules.arrayInitializersNewLineAfterLastElement": true,
"php.format.rules.arrayInitializersAlignKeyValuePairs": true,
"php.format.rules.alignConsecutiveAssignments": false,
"phpTools.language": "de",
"php.inlayHints.types.return": true,
"php.inlayHints.parameters.enabled": true,
"php.inlayHints.parameters.suppressNameMatchingValue": true,
"php.inlayHints.parameters.byReference": true,
"editor.inlayHints.enabled": "on",
"php.codeLens.enabled": true,
"php.docblock.functionSnippet": {
"@author": "XYZ",
"@throws": false
},
"php.docblock.packageSnippet": {
"@author": "XYZ",
"@copyright": "(c) 2021-$CURRENT_YEAR DP24"
},
"php.docblock.propertySnippet": {
"@author": "XYZ",
},
"html.format.templating": true,
"css.enabledLanguages": [
"html"
],
"editor.formatOnSave": false,
"editor.formatOnType": true,
"editor.formatOnPaste": true,
"code-runner.saveFileBeforeRun": true,
"php.completion.parameters": "parameters",
"php.format.rules.spaceAfterCast": true,
"[php]": {
"editor.defaultFormatter": "DEVSENSE.phptools-vscode"
},
"editor.tabCompletion": "on",
"php.validate.run": "onType",
"php.format.rules.ifStatementNewLineAfterLeftParen": true,
"php.format.rules.ifStatementNewLineBeforeRightParen": true,
"php.format.rules.arrayInitializersWrap": "on_every_item",
"php.inlayHints.types.variable": true,
"php.hover.fullname": true,
"explorer.confirmDelete": false,
"[scss]": {
"editor.defaultFormatter": "sibiraj-s.vscode-scss-formatter"
},
}