Line comment highlights the rest of the code as a string when `'` is used
You can reproduce the issue here: https://opensource.respawn.pro/FlowMVI/sample/ (Decompose integration item)
What's interesting, it seems that if the comment is not indented, then the bug does not occur. This started happening after the update from 0.8 to 0.9
Okay this looks serious, I think we will have this fixed in next versions
@Nek-12 I checked the fragment of yours code inn the sample of 1.0.0 version.
Input
class PagesComponent(
context: ComponentContext,
container: () -> PagesContainer, // inject using DI or create
) : ComponentContext by context,
PagesStore by context.retainedStore(factory = container) {
private val navigator = PagesNavigation<PageConfig>()
val pages = childPages(
source = navigator,
serializer = PageConfig.serializer,
initialPages = { Pages(items = List(5) { PageConfig(it) }) },
childFactory = ::PageComponent,
)
init {
// subscribe to the store following the component's lifecycle
subscribe {
actions.collect { action ->
when (action) {
is SelectPage -> navigator.select(action.index)
}
}
}
Output
After analysis there has been found:
marks = ( ( ( ( ( ( ( ( ( ( ) ) ) ) ) ) ) ) ) ) - - - > > > > = = = = = = = = { { { { { { { < } } } } }
punctuations = : : : : : , , , , , , , . . . . .
keywords = class by by private val val when is
strings =
literals = 5
comments = // inject using DI or create // subscribe to the store following the component's lifecycle
multilineComments =
annotations =
kotlin.Unit
Probably the problem belongs to KodeView so please recheck that
Interesting. We are using a fork of code view that processes the annotations async on a different thread, so I will try to fork it again from a more fresh commit to see if anything changes
This is what I see on the latest version. I tried updating the KodeView but that didn't help, however you can see the behavior is different now. I am pretty sure the problem is in the ' symbol which tells the library that a string has started.
Everything until the end of line should be considered a comment when // is used
@Nek-12 Thanks for precise reproduction. Indeed that was a small gap in logic. This should be fixed in published 0.9.3