Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

scala-cli support #393

Open
ckipp01 opened this issue Jan 17, 2022 · 2 comments
Open

scala-cli support #393

ckipp01 opened this issue Jan 17, 2022 · 2 comments

Comments

@ckipp01
Copy link
Contributor

ckipp01 commented Jan 17, 2022

👋🏼 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.

  • Wherever you point scala-cli to ends up being your sourceroot, which can lead to the wrong path in your dump.lsif. For example in my project if I do scala-cli --semantic-db compile src/ the semanticdb will be created and found, but it will think that src/ is the sourceroot and then if you are running lsif-java from . you can run into issues. So just being careful and making sure where I point scala-cli to is also where I run lsif-java from fixed this. This might be trickier than it other build tools since there is no "build file".
  • There really isn't a way to export the javacopts.txt information afaik. I asked about this here in hopes of figuring out a non-hacky way of getting this info to enable cross-repository navigation
  • Lastly I used directives right in my file, so for these use cases it's super easy to get this all to work and I can imagine adding a ScalaCliBuildTool.scala here would be quite simple, but you'd run into issue pretty quickly if users are not using directives and instead passing in deps via scala-cli -d <dependency> which is also valid. It wouldn't work in those cases. Either way, this might be a great feature
@olafurpg
Copy link
Member

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
Copy link
Contributor Author

ckipp01 commented Jan 17, 2022

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.

@linear linear bot closed this as not planned Won't fix, can't repro, duplicate, stale Nov 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants