-
Notifications
You must be signed in to change notification settings - Fork 419
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
StringLiteralExprSyntax adds whitespace in front of closingQuote #2906
Comments
Synced to Apple’s issue tracker as rdar://140829044 |
My bet would be that there’s something in swift-syntax/Sources/SwiftSyntaxBuilder/SyntaxParsable+ExpressibleByStringInterpolation.swift Line 68 in b721fa8
|
Firstly: The code I posted above is exactly the code with which I can reproduce the issue. The comment was just merely to tell you that this is not my final macro and there's more work I need to do. So it can't be related to any Secondly: I do not get any log messages when running my tests. I set a breakpoint inside I stripped down my Swift package to a minimal reproducible state and attached it for you. This way you should be able to fully reproduce my reported issue by simply running the tests: Note that I tested the macro also in a real-world project and hit the same issue, so I don't think it's related to how the test is written. |
Ah, sorry. My hunch was wrong then. I just debugged this and the issue is that when you are calling |
@ahoppen Awesome, thank you! That actually fixed the issue I've had. But the whole API is not very intuitive. Is there any good place to learn about all these things, like a book or at least some unit tests which I can read to learn things like this? |
Unfortunately I don’t have any good single resource that I can recommend to learn about these sorts of details. |
@ahoppen Would it be useful to report an issue explicitly complaining about the lack of detailed documentation or a learning path? If that helps prioritizing internally, I'm happy to report it. 😁 Or this issue itself could be turned into that issue since the main problem was the lack of documentation? If not, I think this can be closed. But if it's currently too early for some reason (e.g. because some bigger refactoring are planned in the near future), I can understand that you might need som extra time. |
A general “Need more documentation” issue will not be very helpful or actionable but I think that more concrete questions that are left unanswered by the documentation at https://swiftpackageindex.com/swiftlang/swift-syntax/main/documentation/swiftsyntax can be helpful. Also: If you have found an answer to one of these questions and would like to share it with the community, PRs are always very welcome and I’m happy to help polish it, if necessary. |
@ahoppen I see, that makes sense. I think, what would have helped me most in this specific situation would have been if each So, you would suggest that I just document what I've learned this way inside the respective types right within the project and create a pull request right away without creating a separate issue for each? I may actually create a bigger PR documenting a whole bunch of APIs with some examples I've run into myself. Cause why not if I'm already at it. Is a "big" documentation-adding PR fine with you or rather small ones documenting only few types each time? |
Yes, a PR without an issue is perfectly fine. Thank you in advance for doing it 🙏🏽. As long as the PR doesn’t get massive (I usually fine 1000 LOC a point when things start to get hard to review), one PR is just fine. And I would attach the documentation for all the types to the type nodes, like here: swift-syntax/CodeGeneration/Sources/SyntaxSupport/DeclNodes.swift Lines 251 to 277 in b479382
|
Description
I'm using version
600.0.1
and wrote this code as part of a macro expression:When I return it in my
ExpressionMacro
wrapped into anExprSyntax
, the expanded code looks like this:But I expect it to be:
Am I missing something?
Steps to Reproduce
Here's a more complete code example:
The text was updated successfully, but these errors were encountered: