Giter VIP home page Giter VIP logo

Comments (14)

kdubb avatar kdubb commented on August 25, 2024 1

Yes. Much of the CodeWriter was literally yanked from KotlinPoet as I originally sent an offer to Jake to donate this and have it hosted with the other poets and all share a community.

from swiftpoet.

kdubb avatar kdubb commented on August 25, 2024

Obviously somebody should be double escaping this string I'm just now sure who. At first thought just blindly double escaping every "%S" seems wrong? But I could be be wrong.

Do you know how KotlinPoet achieves this?

from swiftpoet.

kdubb avatar kdubb commented on August 25, 2024

One thing to remember as well is that Swift string literals allow for a fairly wide range of input (e.g. multiple code-point emojis).

from swiftpoet.

dnkoutso avatar dnkoutso commented on August 25, 2024

I think KotlinPoet handles it? https://github.com/square/kotlinpoet/blob/main/kotlinpoet/src/main/java/com/squareup/kotlinpoet/Util.kt#L58-L68

from swiftpoet.

dnkoutso avatar dnkoutso commented on August 25, 2024

hmmm seems like SwiftPoet also does this...

from swiftpoet.

dnkoutso avatar dnkoutso commented on August 25, 2024

Hm this is weird not seeing KotlinGenerator in Wire doing anything different than just delegating to KotlinPoet https://github.com/square/wire/blob/master/wire-kotlin-generator/src/main/java/com/squareup/wire/kotlin/KotlinGenerator.kt#L1394

from swiftpoet.

dnkoutso avatar dnkoutso commented on August 25, 2024

I guess the only difference I see is isConstantContext ? I think its defaulting to false in KotlinPoet and prints the string differently rather than a multi-line string.

from swiftpoet.

kdubb avatar kdubb commented on August 25, 2024

It looks like there's been quite a few updates to these classes since the departure.

from swiftpoet.

dnkoutso avatar dnkoutso commented on August 25, 2024

yeah...I am trying to test a quick case if this is the issue

from swiftpoet.

dnkoutso avatar dnkoutso commented on August 25, 2024

@kdubb I managed to just copy paste some parts to test it out quickly and indeed it seems to be the issue. It seems we fall under a different code path as we treat this as a multi-line string.

Looks like updating this logic to catch up to what KotlinPoet does would fix this issue.

from swiftpoet.

kdubb avatar kdubb commented on August 25, 2024

Can you provide a PR?

from swiftpoet.

kdubb avatar kdubb commented on August 25, 2024

Thanks for the investigation!

from swiftpoet.

dnkoutso avatar dnkoutso commented on August 25, 2024

I will give it a shot! :D

from swiftpoet.

kdubb avatar kdubb commented on August 25, 2024

One other thing is I've looked at this code a few times in the past because I don't think it aligns with Swift's string rules. It may be that we end up with a bit different scheme to ensure it handles Swift strings correctly.

from swiftpoet.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.