Skip to content
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

Keep backticks in identifiers #2034

Closed
1 of 3 tasks
kaeedo opened this issue Jan 20, 2022 · 2 comments · Fixed by #2240
Closed
1 of 3 tasks

Keep backticks in identifiers #2034

kaeedo opened this issue Jan 20, 2022 · 2 comments · Fixed by #2240

Comments

@kaeedo
Copy link

kaeedo commented Jan 20, 2022

Issue created from fantomas-online

Code

let ``process`` = 1

Result

let process = 1

Problem description

process is a reserved keyword for future F# useage, so I would like fantomas to keep the backticks to avoid the warning. This could be the same for all reserved keywords

Extra information

  • The formatted result breaks by code.
  • The formatted result gives compiler warnings.
  • I or my company would be willing to help fix this.

Options

Fantomas master branch at 1/1/1990

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?

@nojaf
Copy link
Contributor

nojaf commented Jan 20, 2022

Hello, thank you for reporting this issue.
This is actually an upstream problem in the F# compiler, dotnet/fsharp#12303.

We worked around the problem for a couple of keywords in

match ident with
| "`global`" -> "global"
| "not" -> "not"
| "params" -> "``params``"
| "parallel" -> "``parallel``"
| "mod" -> "``mod``"
| _ ->
if IsActivePatternName ident then
sprintf "(%s)" (DecompileOpName ident)
else
AddBackticksToIdentifierIfNeeded ident

Would you be interested in fixing this issue upstream?

@kaeedo
Copy link
Author

kaeedo commented Jan 21, 2022

Thanks for the reply.
Sorry, but I don't even know where to begin with fixing this upstream

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants