Comments (6)
Without looking up the sources and the BSP spec I don't understand the issue you describe and what exactly is missing. Can you elaborate?
from mill.
For a simple project similar to https://github.com/com-lihaoyi/mill-scala-hello.g8, classpath for the build target looks like this
"file://.../scala-hello-world/scalaHelloWorld/compile-resources",
"file://.../Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala3-library_3/3.3.1/scala3-library_3-3.3.1.jar",
"file://.../Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala-library/2.13.10/scala-library-2.13.10.jar"
But classpath in buildTarget/jvmRunEnvironment
for the same build target contains also
"file://.../scala-hello-world/scalaHelloWorld/resources",
"file://.../scala-hello-world/out/scalaHelloWorld/compile.dest/classes"
Without the last line, presentation compiler created in metals doesn't have information from other classes in the same build target. Adding "file://.../scala-hello-world/out/scalaHelloWorld/compile.dest/classes"
also to scalacOptions
response solves the problem.
We could probably work around it in Metals, but maybe it's an easy fix here?
from mill.
For a simple project similar to https://github.com/com-lihaoyi/mill-scala-hello.g8, classpath for the build target looks like this
"file://.../scala-hello-world/scalaHelloWorld/compile-resources", "file://.../Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala3-library_3/3.3.1/scala3-library_3-3.3.1.jar", "file://.../Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala-library/2.13.10/scala-library-2.13.10.jar"
This is the classpath
, which is used for compiling.
But classpath in
buildTarget/jvmRunEnvironment
for the same build target contains also"file://.../scala-hello-world/scalaHelloWorld/resources", "file://.../scala-hello-world/out/scalaHelloWorld/compile.dest/classes"
This is the runClasspath
, which also contains the result of the compilation.
For obvious reasons, we can't add the result of the compilation as an input to the compilation.
scalacOptions
is also an input to the compilation, so it also can't contain the output of the same compilation.
I don't know how the presentation compiler works, but as the compiler typically sees the source files of the current module, this should be enough for it to have the whole picture. Using the readily compiled class files as input in the compiler to make completions and stuff work doesn't make much sense to me. Something is missing here. At least, I don't get it.
from mill.
So it looks like in Bloop and sbt it's put on the classpath when being sent via BSP while not being used for compilation. We can work around it in Metals as you are right in terms of the actual specification.
from mill.
I think we should review the spec and make it clear what's expected to be in the respective requests. I think my interpretation outlined above should be correct, but maybe I'm wrong. returning different values in the same request as you said is done by bloop and sbt is most likely incorrect and should be fixed there and not worked around in Metals (except for compatibility with older versions). Unless I misunderstood. I'm going to close this issue for now, as I have no idea what I can do about it.
from mill.
I think it's fine as is. We can have a workaround, it's not a big deal. You are right that Mill is following the spec here.
from mill.
Related Issues (20)
- Doc generation issue causing missing header HOT 1
- Initial project command causes java.lang.ClassNotFoundException: mill.scalalib.worker.ZincWorkerImpl HOT 2
- GenIdea: Scala 3 module don't work when `scala-library` is before `scala3-library` entry in `iml` config HOT 5
- `-i` and `--no-server` gets ignored with no error when passed as the second option HOT 8
- [Feature Request] Better output for mill show HOT 5
- Stale server environment is propagated when running processes with `run`
- Project structure read incorrectly in `0.11.6` HOT 6
- None.get throw on LineNumberCorrector during migration to a meta-build HOT 4
- False warning in docs HOT 4
- Document project structure HOT 3
- Corrupted classpath for mill 0.11.6 HOT 14
- `buildTarget/cleanCache` throws an error
- Mill cache/metadata path for cross segments need to escape colons (`:`) on Windows
- IDEA seems to leak transitive dependencies via modules into classpath
- BSP: Invalid `textDocument` field in `build/publishDiagnostics` notification HOT 1
- `inspect` should show some useful info about modules
- macro build errors are reported in the generated build.sc file instead of original build.sc
- `T.input`s are evaluated twice HOT 1
- Colors in Scala 2 compile errors are not rendered
- Repro for Duplicated item inserted into OrderedSet HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mill.