I am using emacs/metals for Scala on Ubuntu Linux. It was working, more or less, but now I am getting this compilation error:
[error] – [E008] Not Found Error: /home/rxxxx/trajspec/src/main/.metals/readonly/dependencies/scala-library-3.8.3-sources.jar/scala/Function1.scala:17:22 [error] 17 |import scala.language.2.13 [error] | ^^^^^^ [error] | value 2.13 is not a member of object language
I have no idea. I did not write the code. Someone helped me setup emacs with metals, and it worked for a while, then this started happening. I have no idea what I did to cause it, if anything. Until I figure out how to correct it though, I am stuck.
You should speak to the author of this code and ask them - or it - what the intention was.
Either than, or you will have to engage with the problem and do some investigation yourself if you’re taking over responsibility for it. At the very least you could try deleting the import statement and seeing what, if anything else breaks in the compilation.
(Or maybe the build setting for the Scala version was toggled from 2.13 to 3.8.3? Perhaps that import makes sense for 2.13?)
Thanks for the replies, but let explain the situation further. I don’t even know where to find the offending code, and even if I did, I would not be comfortable diddling with it.
I am a long-time emacs user, but I am not really a professional software developer. I have written Scala code in support of my own R&D ideas in air traffic management, but I have never really worked on a software development team.
I decided that I wanted to add metals to emacs to enhance its functionality with features like “jump to definition”, for example. I had someone set it up for me, but it was far more complicated than I thought it would be.
It never really worked well, apparently due to Scala features that are not supported by metals, but at least it was usable. Now this issue had popped up for no apparent reason, and I am stuck with a non-functional system (no pun intended).
The notion that I should try to correct the code myself misses the point. I did not change the code, nor do I even know where to find it. If my car had a software problem, the last thing I would do is to try to correct it myself.
It seems that there should be some simple procedure to reinstall something, but I have no idea how to do that. I tried a clean recompile, but that didn’t work. Unfortunately, I am having trouble contacting the person who set it up for me. If anyone has any suggestions, please pass them along. Thanks.
The error is coming from readonly dependencies. When go to definition points to outside sources, we unpack them to a separate directory. Those dependencies are standalone and might not always work 100%, they are mostly just to take a look. You can remove that file and the error should disappear. You can also ignore it.
To be more specific, try deleting the entire /home/rxxxx/trajspec/src/main/.metals directory. It’s possible it will come back next time you use Metals? Not sure. But deleting the directory should at least fix your command-line build.
Ah, I see. I saw the path, but assumed it couldn’t be referring to a local file being compiled. My mistake.
So, if I understand correctly, there is a 2.13 package or package object, but it isn’t in the Scaladocs, but it might be referenced from 3.8 build sources, and @Russ’s build is attempting to compile it from source, or at least parse it?
I can imagine there are unpublicised packages in the Scala library source tree, but this all seems quite odd…
EDIT: to be clear, I imagine that Metals might run a tolerant parse of both the user’s sources and downloaded copies of sources associated with JAR dependencies, but I wouldn’t expect that to report errors, on account of having track in-flight edits.
So I assume this is a plain build error - so why is what I presume a downloaded copy of some library source in the local build tree, under src/main?
As I just wrote in my previous quote, I tried renaming the .metals directory, but that didn’t fix the problem. Which file are you saying I can remove? And I don’t see how I can just ignore it without removing metals altogether.
I should have mentioned that this problem started when I tried to upgrade my sbt version by editing my build.properties file to 2.0.1.
Not sure how Scala 3.8.3 came up. I never tried to use that. I am currently on 3.3.8
Well, that’s a new one on me. I had renamed the .metals directory to .metals-save, and it did not solve the problem. But I just noticed that it was still using that renamed directory! Who would have thought? In any case, I just deleted the directory, and the problem is now solved! Thanks, Seth!