I created a project based on a valid sbt scala project. However, a few symbols like dependsOn or mapR are not recognized inside intellij 13.
Could anybody please help?
If your code is valid and compiles, then this simply means either your class path is incorrect, or that IntelliJ's error highlighting is not resolving references as expected. Please raise an issue within the Jetbrain's YouTrack system if this is the case.
As a shortcut, this can be achieved with the shortcut alt+enter, and selecting the option "Report Highlighting Error..."
Related
I'm starting a Scala 3 project in IntelliJ IDEA 2022.1.4 (Community Edition).
My problem is that I am getting spurious "Not found errors" as in the image below. Type Fun is in the same package (model), and Intellij evidently knows the type, as all the information about is correctly displayed right below the error message. The program also compiles without error, even though it is marked as an error and reported in IntelliJ's "Problems" pane.
Further info:
The build tool is sbt (but I've had exactly the same problem with Gradle).
The problem disappears when switching to Scala 2, but I would like to avoid that.
I'm also using antlr and stringtemplates in the same project (but I don't know how this could be relevant).
I would be highly grateful for any help.
In a project that was originally set up for python I do have both python and java SDK's defined:
I am attempting to run a scala program: and the src directory is correctly marked as sources:
The class itself does have a main :
But the Intellij does not provide assist for setting up a Run Configuration - which should have been available by right click/context menu. So I set it up manually:
But when trying to actually run the program it is not successful saying Error: Could not find or load main class com.blazedb.algos.CourseraAlgos:
Update: for reference purposes here is a Run Configuration from a similar project that does work. I do not see any structural differences between the two.
Any ideas why Intellij does not recognize the file as a scala class?
In addition to the steps shown above I had also tried:
adding a new scala-specific module
nuking and recreating the IJ project
These did not resolve the issue. It turns out the problem is that there were no pom.xml in this project. The resulting behavior by Intellij made it difficult to trace down the root cause: there was no message like
You need a pom.xml or a build.sbt to proceed
Apparently stray scala classes (dissociated from a formal build) are only haphazardly supported in Intellij.
So finally the answer is to create a new scala based project. Adding scala back to a project built for python is at the least unreliable and maybe not possible at all.
When I open a maven module with scala code (link) which compiles and runs fine, I get bad error highlights:
Code-complete seems broken as well. How to fix this? (I don't want to switch to SBT since I only want this one module in the project to use scala, and I've tried the "Invalidate Caches / Restart" fix suggested here in vain.)
It is a known problem in IntelliJ with Scala because of the complex type system of scala.
I mostly use sbt. If I encounter such problem, first I compile it with sbt in the command line, most time wrong error highlights disappear.
If this does not help, clear IntelliJ cash and restart it (File -> Invalidated Caches / Restart).
Suspicious that at least a part of this post might be an April Fool's joke, I set about installing Dotty on my Linux laptop and was pleased and surprised to discover that it seems to be completely straight - I was able to get the Fibonacci function as given in German working fine from the REPL.
Now I want to code in Dotty/Scala in German in the IntelliJ IDE, but have not so far managed to achieve this, or for that matter English Language 'Hello World' for which will the Dotty compile fails with an SBT error, see below (there are no errors in the IntelliJ code window for the object).
Opening a new Dotty project via the IntelliJ new project dialogue puts a new instance of Dotty in my .ivy2 directory, distinct from that I use in the REPL. I have found Felix Mulder's Dotty plugin but I'm not sure how to use a plugin from source. After the project has set itself up:
German keywords are not recognised in any new Scala file I create in src > main.
In build.sbt some operators and keywords are not recognised
In build.sbt each entry gives the error Expression Def.Setting[SomeType] must conform to DslEntry in SBT file
I get this error log warning (twice):
Binary version (0.1.1-20170410-0bd7821-NIGHTLY) for dependency
ch.epfl.lamp#scala-library;0.1.1-20170410-0bd7821-NIGHTLY in
default#skala_2.11;0.1-SNAPSHOT differs from Scala binary version in
project (2.11).
which I think might be a consequence of the skala and dotty paths in my PATH environment variable.
Searching on the error message in point 3 led me here: I can switch to an unbundled SBT I know to be good easily enough, but HW will still not compile, instead giving a quite lengthy SBT error.
Unfortunately I don't understand the syntax of the entries in build.sbt well enough to change them according to the advice of murmelssonic. If I just have to learn that then OK, I'm sure I can.
I believe I have read posts which suggest that the build.sbt errors can be ignored as they do not actually lead to compile errors, but I can't confirm this as I can't compile anything yet. Even if this be true, I want to eliminate these, the better not to obscure legitimate warnings and errors.
My question might be better expresses as simply "How do I install the Dotty plugin for IntelliJ?", but I'm not sure that's the complete solution to this collection of symptoms.
System info:
OS Kubuntu 16.10
Java 1.8_121
IntelliJ 2017.1
Dotty v0.1.1-20170410
SBT 0.13.13 and 0.13.15 (each attempted) via IntellliJ dialogue
SBT 0.1-SNAPSHOT (from sbt version on command line in sbt dir, used by changing IntelliJ settings).
While Skala is a natural development for the Scala language, seeing how its creator Martin Odersky is a German and should have implemented German keywords in the first place, JetBrains is a company founded by Russians. As such, we are committed to exporting cyrillic keywords into the world of programming.
In a way, IntelliJ-Scala is already an alternative compiler for the Scala programming language specification. This will be increasingly true with the release of the all-new Скала plugin for IntelliJ!
This is a totally official statement by the IntelliJ-Скала team's only German member.
I am using intellij 11 ultimate, using the scala plugin.
Most of my code has red highlights everywhere, meaning IntelliJ cannot properly resolve the keywords.
For example, I added the amazon aws depenency (using sbt) and 1/2 my code is red, and intellisence doesn't work either.
Note: This is happening for many many libraries I am using, and it is a real pain. I am building using the terminal using the sbt command also.
Is there something I am doing wrong? Or is it just a fact of live using scala with intellij?
Update:
I do see this message sometimes:
File '/path/to/app/web/built.sbt' seems to be SBT build file, but there is no external project related to it. Import the corresponing project?
"File -> Invalidate Caches -> Invalidate and Restart" often helps to prevent IntelliJ from showing non-existing Scala errors.
I have no IntelliJ 11, so I do not know if this exists in your Intellij version.