Before:
```F#
module Input
let modules = [109024;137172;80445;80044]
**After:**
```F#
module Input
let modules = [ 109024; 137172; 80445; 80044 ]
]
Expected behaviour
F#
module Input
let modules = [ 109024; 137172; 80445; 80044 ]
To Reproduce
Steps to reproduce the behaviour:
Environment (please complete the following information):
Additional context
Add any other context about the problem here.
Hey @stilettk :wave:,
Thank you for opening an issue. We will get back to you as
soon as we can. Also, check out our OpenCollective and consider
backing us.
https://opencollective.com/ionide
PS.: We offer
backersupport for all backers. Don't forget to addbackerlabel when you start backing us :smile:
Please open formatting bugs at the fantomas repository, https://github.com/fsprojects/fantomas. We consume them as a library to do all formatting.
This is not reproduced in fantomas: link to online formatter
Maybe ionide doesn't use the latest version?
You're exactly right. FSAC has been updated with the latest version already, so we need to do an update here of FSAC and this will be addressed. Thanks for reporting!
Should be fixed in 4.4.x
@Krzysztof-Cieslak Unfortunately, I can still reproduce it in ionide 4.4.2...
@Krzysztof-Cieslak we should reopen this, the problem seems to be on our side in FSAC.
Given fsx script of:
module Input
let modules = [109024;137172;80445;80044]
the result of the formatting call is
[Trace - 3:22:08 PM] Sending request 'textDocument/formatting - (62)'.
Params: {
"textDocument": {
"uri": "file:///Users/chethusk/oss/CppSharp/build/gmake/lib/Release_x64/gen/scratch.fsx"
},
"options": {
"tabSize": 4,
"insertSpaces": true
}
}
[Trace - 3:22:08 PM] Received response 'textDocument/formatting - (62)' in 7ms.
Result: [
{
"range": {
"start": {
"line": 0,
"character": 0
},
"end": {
"line": 1,
"character": 44
}
},
"newText": "module Input\n\nlet modules = [ 109024; 137172; 80445; 80044 ]\n"
}
]
The key thing is the response has a range of (0,0)-(1,44) (relative to the initial text), and the response text is "module Input\n\nlet modules = [ 109024; 137172; 80445; 80044 ]\n", which is what we expect in this case. I think there's something wrong with the range calculation (because line 2 of the input text (aka line 1 from FSC range perspective) has 45 characters, not 44. I think we're replacing everything from (0,0)-(1,44) with the newText (which ends in newline) and the the last character of ] is being appended.
@baronfel fixed that on FSAC side, fix will be available in next Ionide release
Most helpful comment
You're exactly right. FSAC has been updated with the latest version already, so we need to do an update here of FSAC and this will be addressed. Thanks for reporting!