-
Notifications
You must be signed in to change notification settings - Fork 30
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 the information to String literal of how it was created #57
Comments
I feel that option one has the nicest interface. My gut feeling says that in most usages you are interested in the String and pattern matching like I see your point on the lines of a string literal. Let's sleep on it. |
I agree with you. Maybe it is good enough to provide a function (well, I guess users could do it themselves to start with? 🤷♂️ ) to transform the node for that string literal into a list of |
It would be nice to know whether a String literal was created using
"x"
or using"""x"""
.I don't think we have the information at this point, and if we want to pin-point a part of the string based on the range from the expression node, then we need to account for the
"""
.Possible ways:
Then, if we want to select a sub-string, we need to offset the string by one for
SingleQuote
and by 3 forTripleQuote
.I am thinking it could be interesting to have a List of lines, each with their own range. That would make a lot of things quite easier. If you do need the concatenated string, then that is relatively easy to do.
I know I have struggled with finding sub-strings in multiline comments (maybe that could also be split into different types like this?), and I hope that this can make things a bit easier (especially if we have the range for each line).
I think this option is better, but the thing that makes it less nice is that if you are looking at strings, you need to handle both cases.
The text was updated successfully, but these errors were encountered: