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
[SR-5745] Refactoring action to convert string concatenation to string interpolation #48315
Comments
Comment by KacperHarasim (JIRA) Hi @akyrtzi, let text = "hello \(name)" + "!" Since "!" was not selected it was not converted. Thanks for the feedback, |
Yes, I think it makes sense as range refactoring. Note that if the range includes other expressions (or statements) unrelated to string concatenation then it should not be available. |
Comment by KacperHarasim (JIRA) That seems reasonable. Thanks! |
Comment by KacperHarasim (JIRA) Hi @akyrtzi |
Hi kacperh (JIRA User), I prefer we use SourceEntityWalker to walk through ContainedNode (in this case, a single expression) to analyze its content instead of scanning tokens. The reason is token contains much less semantic information that AST node does. |
Comment by KacperHarasim (JIRA) Thanks @nkcsgexi! „a” + „b” + „c” Results in going through DotSyntaxExpr. I’m not really sure why is it here, because I don’t see any expression like that in the example. It’s probably result of my limited knowledge about a compiler. Could you please point me to some information on why is it included? Thanks in advance! |
Hi kacperh (JIRA User), great progress! You approach makes sense to me. I think the DotSyntaxExpr you see is implicit node synthesized by compiler to help later code generation; i think you can ignore any `implicit()` expressions. |
Comment by KacperHarasim (JIRA) Opened a PR to implement this: #11944 |
Comment by KacperHarasim (JIRA) Committed in: 80698a0 |
Additional Detail from JIRA
md5: 9bb65dc496b5da36485ed8f9177d1e8a
Issue Description:
Implement action to convert from:
to
The text was updated successfully, but these errors were encountered: