forOfStatement.spaceAfterForKeyword messes up "for await"
Describe the bug If you have forOfStatement.spaceAfterForKeyword set to true, Dprint will turn "for await" into "forawait."
dprint-plugin-typescript version: 0.16.3
Input Code
for await (const userID of theMsg.recipientIDs)
Expected Output
for await (const userID of theMsg.recipientIDs)
Actual Output
forawait (const userID of theMsg.recipientIDs)
dprint-plugin-typescript version: 0.16.3
is this correct? the current version is 0.94.0 and this is not reproducible
I don't know where that version string came from, but I can reproduce the problem right now.
I have VS Code set to format on save using DPrint, and it reproduces the problem.
Then if I open the file in a text editor and fix it, and then run dprint fmt at the command line, it also reports the problem:
/server % dprint fmt
Error formatting /server/controllers/DB/DBManager.ts. Message: Formatting succeeded initially, but failed when ensuring a stable format. This is most likely a bug in the plugin where the text it produces is not syntatically correct. Please report this as a bug to the plugin that formatted this file.
Expression expected at file:///Users/gavin/data/BopMe/BopMe_server/server/controllers/DB/DBManager.ts:52:15
forawait (const userID of result);
~~~~~
Had 1 error formatting.
dprint -v returns
dprint 0.49.0
I don't know about the version of the plug-in.
I can reproduce this using plugin version 0.95.3 and dprint 0.48.0. Is there anything I can provide that might assist in debugging?
Here's the entirety of my dprint.json, if useful:
{
"lineWidth": 120,
"indentWidth": 2,
"useTabs": false,
"newLineKind": "lf",
"typescript": {
"semiColons": "prefer",
"quoteStyle": "alwaysDouble",
"quoteProps": "preserve",
"useBraces": "whenNotSingleLine",
"bracePosition": "sameLineUnlessHanging",
"singleBodyPosition": "maintain",
"nextControlFlowPosition": "sameLine",
"trailingCommas": "onlyMultiLine",
"operatorPosition": "nextLine",
"preferHanging": false,
"preferSingleLine": false,
"arrowFunction.useParentheses": "maintain",
"binaryExpression.linePerExpression": false,
"jsx.bracketPosition": "nextLine",
"jsx.forceNewLinesSurroundingContent": false,
"jsx.multiLineParens": "prefer",
"memberExpression.linePerExpression": false,
"typeLiteral.separatorKind": "semiColon",
"enumDeclaration.memberSpacing": "maintain",
"spaceAround": false,
"spaceSurroundingProperties": true,
"binaryExpression.spaceSurroundingBitwiseAndArithmeticOperator": true,
"commentLine.forceSpaceAfterSlashes": true,
"constructor.spaceBeforeParentheses": false,
"constructorType.spaceAfterNewKeyword": false,
"constructSignature.spaceAfterNewKeyword": false,
"doWhileStatement.spaceAfterWhileKeyword": false,
"exportDeclaration.spaceSurroundingNamedExports": true,
"forInStatement.spaceAfterForKeyword": false,
"forOfStatement.spaceAfterForKeyword": false,
"forStatement.spaceAfterForKeyword": false,
"forStatement.spaceAfterSemiColons": true,
"functionDeclaration.spaceBeforeParentheses": false,
"functionExpression.spaceBeforeParentheses": false,
"functionExpression.spaceAfterFunctionKeyword": false,
"getAccessor.spaceBeforeParentheses": false,
"ifStatement.spaceAfterIfKeyword": false,
"importDeclaration.spaceSurroundingNamedImports": true,
"jsxSelfClosingElement.spaceBeforeSlash": true,
"jsxExpressionContainer.spaceSurroundingExpression": false,
"method.spaceBeforeParentheses": false,
"setAccessor.spaceBeforeParentheses": false,
"taggedTemplate.spaceBeforeLiteral": false,
"typeAnnotation.spaceBeforeColon": false,
"typeAssertion.spaceBeforeExpression": true,
"whileStatement.spaceAfterWhileKeyword": false,
"module.sortImportDeclarations": "caseInsensitive",
"module.sortExportDeclarations": "caseInsensitive",
"exportDeclaration.sortNamedExports": "caseInsensitive",
"exportDeclaration.sortTypeOnlyExports": "none",
"importDeclaration.sortNamedImports": "caseInsensitive",
"importDeclaration.sortTypeOnlyImports": "none",
"ignoreNodeCommentText": "dprint-ignore",
"ignoreFileCommentText": "dprint-ignore-file",
"exportDeclaration.forceSingleLine": false,
"importDeclaration.forceSingleLine": false,
"exportDeclaration.forceMultiLine": "never",
"importDeclaration.forceMultiLine": "never"
},
"json": {},
"markdown": {},
"malva": {},
"plugins": [
"https://plugins.dprint.dev/typescript-0.95.3.wasm",
"https://plugins.dprint.dev/json-0.20.0.wasm",
"https://plugins.dprint.dev/markdown-0.18.0.wasm",
"https://plugins.dprint.dev/g-plane/malva-v0.12.1.wasm"
],
"excludes": [
"**/*-lock.json",
"**/node_modules/**",
"**/dist/**",
"**/build/**",
"**/storybook-static/**"
]
}