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

"""\nabc\n""" and """abc""" are not distinguishable from the ast #1188

Closed
vjeux opened this issue Dec 31, 2017 · 5 comments
Closed

"""\nabc\n""" and """abc""" are not distinguishable from the ast #1188

vjeux opened this issue Dec 31, 2017 · 5 comments

Comments

@vjeux
Copy link

vjeux commented Dec 31, 2017

Both of then look exactly the same. I would expect \n to be part of the value.

"""abc"""
type T {
  a: Int
}

"""
abc
"""
type T {
  a: Int
}
{ kind: 'StringValue',
  value: 'abc',
  block: true,
  loc: { start: 0, end: 9 } }
{ kind: 'StringValue',
  value: 'abc',
  block: true,
  loc: { start: 31, end: 42 } }
@IvanGoncharov
Copy link
Member

@vjeux It's intentional:

Note: Block string values are interpreted to exclude blank initial and trailing lines and uniform indentation with {BlockStringValue()}.

https://github.com/facebook/graphql/blob/master/spec/Appendix%20B%20--%20Grammar%20Summary.md#lexical-tokens

@vjeux
Copy link
Author

vjeux commented Dec 31, 2017

Thanks for the quick reply. This is unfortunate as it means I have to read from the raw input to print it as it was entered... I can live with it though!

@lydell
Copy link

lydell commented Jan 2, 2018

I’m not 100% sure this is an issue: prettier/prettier#3605 (comment)

@IvanGoncharov
Copy link
Member

@vjeux I saw you removed workaround from prettier.
Does it mean that your problem is solved and this issue could be closed?

@vjeux
Copy link
Author

vjeux commented Jan 2, 2018

Yes, sorry!

@vjeux vjeux closed this as completed Jan 2, 2018
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

No branches or pull requests

3 participants