-
-
Notifications
You must be signed in to change notification settings - Fork 193
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Required backslash removed in string interpolation #1344
Comments
Hello @suside, thank you for reporting this issue. fantomas/src/Fantomas/CodePrinter.fs Line 2512 in d5f4d9f
Would you be interested in submitting a PR? |
Hi @nojaf Failing test case: [<Test>]
let ``backslash in interpolation, issue 1344`` () =
formatSourceString
false """
$"\"{bar}\" {1} {2}"
"""
config
|> prepend newline
|> should
equal """
$"\"{bar}\" {1} {2}"
""" |
I believe the active pattern fantomas/src/Fantomas/TokenParser.fs Lines 514 to 518 in d5f4d9f
Needs to be changed to: let private (|InterpStringEndOrPartToken|_|) token =
if token.TokenInfo.TokenName = "INTERP_STRING_END"
|| token.TokenInfo.TokenName = "INTERP_STRING_PART" then
Some token
else
None In order to capture all interpolated strings as trivia. |
Issue created from fantomas-online
Code
$"INSERT INTO \"{tableName}\" {colNames} VALUES {values}"
Result
Problem description
Interestingly, formating this does not remove
\
:$"INSERT INTO \"{tableName}\" {colNames} VALUES"
so it's like the third variable is causing the error?
Extra information
Options
Fantomas Master at 12/26/2020 15:00:23 - 76fa31e
Default Fantomas configuration
Did you know that you can ignore files when formatting from fantomas-tool or the FAKE targets by using a .fantomasignore file?
The text was updated successfully, but these errors were encountered: