jacobras / Human-Readable

A small set of data formatting utilities for Kotlin Multiplatform (KMP).
MIT License
161 stars 11 forks source link

Generated `Res` class in root package makes IDE autocomplete/import difficult #92

Open TheKeeperOfPie opened 2 months ago

TheKeeperOfPie commented 2 months ago

There's a Res.class in the root level of the jar that means the IDE prefers importing it over the module's own generated Res for Compose multiplatform resources.

I'm not sure where this is configured or if it's necessary, but it probably just needs to be scoped to nl.jacobras.humanreadable.

jacobras commented 2 months ago

Hi @TheKeeperOfPie , how exactly do you run into issues with this? Usually in IntelliJ, when selecting a lower suggested option, it remembers it for the next time. A screenshot would be helpful :)

I guess this comes from https://github.com/Skeptick/libres. I'm considering switching to the Compose compiler for resources, which might fix this as a side effect. But I first need to measure the impact, see https://github.com/jacobras/Human-Readable/issues/60#issuecomment-2298542273

TheKeeperOfPie commented 2 months ago

I'm in the middle of migrating modules to KMP, and it doesn't prompt me at all. Because Res is already accessible in root, it automatically references it without asking to disambiguate.

This is a problem when converting R.string -> Res.string, as I don't specifically choose a Res class from the autocomplete. I just do a broad replace all and let the IDE auto-import fix things up, which prefers to auto-import the already accessible Res.

Although I think I could avoid this using the IDE auto-import excludes.