hops
hops copied to clipboard
Kotlin support [feature request]
Nowadays more and more Android & Java projects use Kotlin. I suppose full Kotlin support is not easy and requires parsing all files, but would be nice if *.kt
navigates to other *.kt
files with same rules as in Java.
@DVDAndroid would you mind creating a PR to get this merged into the official Chrome extension? Or is it still WIP and not yet ready to be merged? Would love to try this out in my own Kotlin projects. :)
@ubuntudroid Yeah, I'll create a PR. Could you test it before my PR? ~download~
I checked and seems doesn't work. It could be easily checked at my repository in this file
That TimerController
in the Main.kt:14 could be linked to TimerController.kt
The path from package could be decoded in the same manner as in java. No difference in this case.
@neworld Something is not working at line 58 of content.js. The CSS selector seems that it doesn't find any td
which contains TimerController
If I understand correctly, github formats kotlin code a bit different. In Java all class names are wrapped in span, but in kotlin isn't
<td id="LC14" class="blob-code blob-code-inner js-file-line" style="...">
primaryStage
<span class="pl-k">.</span>
scene
<span class="pl-k">=</span>
TimerController
<span class="pl-k">.</span>
newScene()
</td>
Hi @neworld @ubuntudroid, I just updated my fork and the extension. Can you try it before the PR? ~hops.zip~
Here's my last commit that workarounds last issue: https://github.com/DVDAndroid/hops/commit/d0a3ab6127d4bd39e8889136619e0e8481824f2f
It works. Nice work!
Looks like a good start!
It fails to link classes correctly in this repo for me https://github.com/TonicArtos/SuperSLiM/blob/master/library/src/main/kotlin/com/tonicartos/superslim/layout.kt
As expected. This plugin works nicely with java, because java has strict rules between packages and file/dir names. In the kotlin is easy to break them
@droidchef Fixed CSS highlighting, but it doesn't find the file. ~hops.zip~
There is another issue. Sometimes detects partial of the class. In this file plugin wraps only Timer
and links to it, instead of TimerController
@neworld Try now please: ~hops.zip~
Nop, still the same.
Fixed some small bugs. Looks good to me. Tested also on some Android files written in Kotlin. hops.zip. Remove old versions of the extension before install
Much better. I can't find any more issues
@DVDAndroid I do see the fixed CSS thingy. Great job with that. Can you send a PR for it? So I can close the issue related to that.
The Kotlin thing doesn't work perfectly still from what I can check.
See this repo https://github.com/TonicArtos/SuperSLiM/blob/master/library/src/main/kotlin/com/tonicartos/superslim/layout.kt
I don't know what is so weird about this :(
I've opened the PR. The problem of Kotlin is that you can create multiple classes in kt
files and you can call the kt
file in different way.
I think you can close issue #9 because the issue doesn't exist with current version of the extension (available from Chrome Web Store) and it is fixed in one of my commits.
For full Kotlin support, the plugin needs to scan all files. However, if there is any chance to scan all files, it would be possible skip these classes.
Or I think it's possible to make a HTTP request to the class, if it returns 404, don't highlight on the file...