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

Add support of String Interpolation #998

Closed
2 of 3 tasks
nojaf opened this issue Aug 13, 2020 · 0 comments · Fixed by #1000
Closed
2 of 3 tasks

Add support of String Interpolation #998

nojaf opened this issue Aug 13, 2020 · 0 comments · Fixed by #1000

Comments

@nojaf
Copy link
Contributor

nojaf commented Aug 13, 2020

Issue created from fantomas-online

Code

let x = 1
let pi = 3.1414
let text = "cats"

let s = $"I say {x} is one and %0.2f{pi} is pi and %10s{text} are dogs"

Error

Fantomas.FormatConfig+FormatException: Parsing failed with errors: [|tmp.fsx (5,9)-(5,11) parse error This token is reserved for future use;
  tmp.fsx (5,9)-(5,11) parse error Unexpected whitespace in binding;
  tmp.fsx (5,71)-(5,72) parse error End of file in string begun at or before here|]
And options: { SourceFiles = [|"tmp.fsx"|]
  ConditionalCompilationDefines = []
  ErrorSeverityOptions = { WarnLevel = 3
                           GlobalWarnAsError = false
                           WarnOff = []
                           WarnOn = []
                           WarnAsError = []
                           WarnAsWarn = [] }
  IsInteractive = false
  LightSyntax = None
  CompilingFsLib = false
  IsExe = false }
   at Fantomas.CodeFormatterImpl.parse@61-2.Invoke(FSharpParseFileResults _arg2) in /home/runner/work/fantomas-tools/fantomas-tools/.deps/fantomas/src/Fantomas/CodeFormatterImpl.fs:line 66
   at Microsoft.FSharp.Control.AsyncPrimitives.CallThenInvokeNoHijackCheck[a,b](AsyncActivation`1 ctxt, FSharpFunc`2 userCode, b result1) in F:\workspace\_work\1\s\src\fsharp\FSharp.Core\async.fs:line 416
   at <StartupCode$FSharp-Compiler-Service>.$Service.ParseFile@436-3.Invoke(AsyncActivation`1 ctxt) in /Users/chethusk/oss/FCS/src/fsharp/service/service.fs:line 436
   at Microsoft.FSharp.Control.Trampoline.Execute(FSharpFunc`2 firstAction) in F:\workspace\_work\1\s\src\fsharp\FSharp.Core\async.fs:line 109

Problem description

See https://github.com/fsharp/fslang-design/blob/master/RFCs/FS-1001-StringInterpolation.md.
I may have been a bit too eager when merging in FCS37.

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 at 08/13/2020 09:57:58 - ee6dd12

Name Value
IndentSize 4
MaxLineLength 120
SemicolonAtEndOfLine false
SpaceBeforeParameter true
SpaceBeforeLowercaseInvocation true
SpaceBeforeUppercaseInvocation false
SpaceBeforeClassConstructor false
SpaceBeforeMember false
SpaceBeforeColon false
SpaceAfterComma true
SpaceBeforeSemicolon false
SpaceAfterSemicolon true
IndentOnTryWith false
SpaceAroundDelimiter true
MaxIfThenElseShortWidth 40
MaxInfixOperatorExpression 50
MaxRecordWidth 40
MaxArrayOrListWidth 40
MaxValueBindingWidth 40
MaxFunctionBindingWidth 40
MultilineBlockBracketsOnSameColumn false
NewlineBetweenTypeDefinitionAndMembers false
KeepIfThenInSameLine false
MaxElmishWidth 40
SingleArgumentWebMode false
AlignFunctionSignatureToIndentation false
AlternativeLongMemberDefinitions false
StrictMode false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant