Open Bug 1938622 Opened 2 months ago Updated 27 days ago

Port semanticdb-kotlin to support Kotlin 2.x

Categories

(Webtools :: Searchfox, task)

task

Tracking

(Not tracked)

People

(Reporter: nicolas.guichard, Unassigned)

References

(Blocks 1 open bug)

Details

The semanticdb-kotlinc Kotlin compiler plugin that generates SemanticDB data for Kotlin code only supports up to Kotlin 1.9.
The original source lives at https://github.com/sourcegraph/scip-kotlin.
This GitHub fork migrates the plugin to the new Kotlin 2 frontend (FIR instead of PSI), but the symbols in the output SemanticDB don't follow the expected format. (for instance sample/Banana#foo(). became `sample/Banana`#foosample.foo(): kotlin/Unit.)

:titouan has a WIP commit to port the plugin from Kotlin 2.0 to Kotlin 2.1, based on slycodemonkey's fork, which is available at https://github.com/titooan/scip-kotlin/tree/kotlin2.1.
This doesn't fix the symbol format issues yet.

Blocks: 1897958

It seems nowadays the go-to way to implement semanticdb-kotlinc would be the Kotlin Analysis API, but that apparently doesn't support compiler plugins (according to this GitHub comment) and would be more of a rewrite than an update.

I also gave a quick look at Google's Kotlin Symbol Processing API, aka KSP, but it seems to only traverses declarations, not expressions and statements. (From https://kotlinlang.org/docs/ksp-why-ksp.html#comparison-to-kotlinc-compiler-plugins).

Starting from slycodemonkey's and :titouan's forks, I reverted the changes to the tests and started fixing them over at https://github.com/nicolas-guichard/scip-kotlin/tree/kotlin-2. It still needs work.

You need to log in before you can comment on or make changes to this bug.