Closed tbrixi closed 2 years ago
@markwpearce you recently did some work on some of this stuff, right? Do you think your other logic would be easily adapted to fix this as well?
It must be some weird interaction with one of those options. I'm not seeing this issue with default options.
@tbrixi What version of the formatter are you using? Negative variables formatting was updated in 1.16.6
Just investingated with latest version and this test passes:
it('correctly formats negated variable (issue #50)', () => {
formatter.formattingOptions = {
indentStyle: 'tabs',
indentSpaceCount: 4,
formatIndent: true,
keywordCase: 'lower',
typeCase: 'lower',
compositeKeywords: 'split',
removeTrailingWhiteSpace: true,
formatInteriorWhitespace: true,
insertSpaceBeforeFunctionParenthesis: false,
insertSpaceBetweenEmptyCurlyBraces: false,
insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces: false,
insertSpaceBetweenAssociativeArrayLiteralKeyAndColon: false,
formatSingleLineCommentType: 'original',
formatMultiLineObjectsAndArrays: true
};
formatEqual(`y = -x`);
});
Hello, can confirm that on new project formatter working fine. Issue was resolved by deleting "node_modules" and new npm install.
negative variable
source code: y = -x
actual formatter result: y = - x
expected result: y = -x
brighterscript-formatter: 1.6.10 bsfmt.json: { "indentStyle": "tabs", "indentSpaceCount": 4, "formatIndent": true, "keywordCase": "lower", "typeCase": "lower", "compositeKeywords": "split", "removeTrailingWhiteSpace": true, "formatInteriorWhitespace": true, "insertSpaceBeforeFunctionParenthesis": false, "insertSpaceBetweenEmptyCurlyBraces": false, "insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces": false, "insertSpaceBetweenAssociativeArrayLiteralKeyAndColon": false, "formatSingleLineCommentType": "original", "formatMultiLineObjectsAndArrays" : true }