swiftlang / sourcekit-lsp

Language Server Protocol implementation for Swift and C-based languages
Apache License 2.0
3.3k stars 273 forks source link

Convert String Concatenation to String Interpolation #1551

Closed AppAppWorks closed 2 months ago

AppAppWorks commented 3 months ago

fixed #1244

It's only a draft as the support for multiline string literals is not yet implemented and more tests have to be written, I also wonder if it's a good idea to also perform the action in FormatRawStringLiteral when performing this conversion.

AppAppWorks commented 3 months ago

@ahoppen please check again :)

AppAppWorks commented 3 months ago

Could a follow-up action be converting concatenation of (some CustomStringConvertible).description into string interpolation?

e.g. 1.description + false.description -> "\(1)\(false)"

ahoppen commented 2 months ago

Could a follow-up action be converting concatenation of (some CustomStringConvertible).description into string interpolation?

e.g. 1.description + false.description -> "\(1)\(false)"

I personally wouldn’t prioritize it because I don’t think it’s a pattern that’s used terribly often but I also wouldn’t object to a PR that implements it.

AppAppWorks commented 2 months ago

All done, please have a look.

AppAppWorks commented 2 months ago

Revised, please check again!

ahoppen commented 2 months ago

@swift-ci Please test

ahoppen commented 2 months ago

@swift-ci Please test Windows

ahoppen commented 2 months ago

@swift-ci Please test

ahoppen commented 2 months ago

@swift-ci Please test Windows