sourcegraph / scip-java

SCIP Code Intelligence Protocol generator for Java
https://sourcegraph.github.io/scip-java/
Apache License 2.0
67 stars 28 forks source link

`scala-cli` support #393

Open ckipp01 opened 2 years ago

ckipp01 commented 2 years ago

👋🏼 hello! I wanted to drop this off here since I got this working and think it's pretty neat. Lately I've been using scala-cli quite a bit and I was curious if I could get precise code navigation working with it. It was actually somewhat simple, but I did hit on a couple small things that maybe having built-in support for index would help with.

Producing semanticdb with scala-cli is as easy as just compiling your project with --semantic-db as a flag like: scala-cli compile --semantic-db ., which makes it easy for lsif index-semanticdb . to pick it up. However there are a few gotchas, or things that aren't working yet that I'll list below for others that maybe stumble on this.

olafurpg commented 2 years ago

Thank you for reporting! This is exciting.

maybe having built-in support for index would help

Is there a way to automatically detect which files are compiled with scala-cli? We currently detect sbt builds with project/build.properties and we would need something similar for scala-cli scripts.

instead passing in deps via scala-cli -d which is also valid.

I think it's OK to not support this use-case to begin with.

ckipp01 commented 2 years ago

Is there a way to automatically detect which files are compiled with scala-cli?

I don't think it super straightforward unless you just assume any *.sc or *.scala file under where you are looking is valid, which maybe isn't a bad thing in this situation since a scala-cli workspaces are sort of just a bag of scala files. The only way to be able to get a better idea would be to check out where the .scala/ dir is placed, but that's not created until ran, and even then it won't tell you really the "source" dirs but give you the package structure and all the class/tasty/etc files.