codehike icon indicating copy to clipboard operation
codehike copied to clipboard

Link and mark annotations on the same line

Open pomber opened this issue 2 years ago • 2 comments

Here, the link annotation is applied to the wrong part of the line

```python mark=1[7:13]
# link[2:5] #foo
print("This is Code Hike")
```

Playground

pomber avatar Jun 15 '23 16:06 pomber

did some debugging on this. Narrowed the bug down to \packages\mdx\src\smooth-code\splitter.tsx > getTokenGroups function. The groups returned have faulty tokens with them.

knie20 avatar Aug 09 '23 13:08 knie20

update.

I missed the mark the first go. The real culprit is the annotateLineTokenGroups in annotations.tsx It's a huge function that I don't fully understand yet, but it "binds" the CodeLink Component in this example to the third "group" instead of the first.

image in this image, the annotation should be in the first element in annotatedGroups, but is in the last for some reason.

PS I couldn't get the tsx mappings to work properly on the debugger for this one. Not sure if this is a next thing or tsx thing. I debugged with no mappings.

knie20 avatar Aug 16 '23 13:08 knie20