Comments (14)
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.
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.
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.
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.
hmmm seems like SwiftPoet also does this...
from swiftpoet.
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.
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.
It looks like there's been quite a few updates to these classes since the departure.
from swiftpoet.
yeah...I am trying to test a quick case if this is the issue
from swiftpoet.
@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.
Can you provide a PR?
from swiftpoet.
Thanks for the investigation!
from swiftpoet.
I will give it a shot! :D
from swiftpoet.
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)
- Operator overloading isn't supported. HOT 1
- Extensions don't handle imports HOT 10
- PropertySpec DOES NOT add Modifiers to global properties
- PropertySpec builder DOES NOT add Modifiers to global properties HOT 1
- Is there a way to add 'weak' modifier to a property? HOT 2
- Missing support for generate implicitly unwrapped optionals HOT 1
- Invalid rules for nested types and protocols HOT 3
- 1.4.0 Release HOT 1
- 1.4.1 crash HOT 2
- Support Subscript builders HOT 4
- Why ComposedTypeName.composed is internal? HOT 1
- Support for optional closure/lambda parameters
- Inferred type names are not finding "Swift." (amongst other things). HOT 8
- Support `convenience init`
- SwiftPoet Status HOT 14
- Including sub types within external extensions do not emit imports HOT 6
- Better release procedure HOT 1
- SwiftPoet 1.6.1 Update: Scope Issue in Nested Struct Generation HOT 3
- How to indicate that a function returns "some TypeName"? HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from swiftpoet.