nbscala icon indicating copy to clipboard operation
nbscala copied to clipboard

Packages and classes in libraries are not recognised in the editor

Open netmackan opened this issue 13 years ago • 5 comments

After adding a JAR file to the Scala project by clicking Libraries -> Add JAR/Folder... I expect classes and packages from it to be available as suggestions/code completion when writing import statements etc.

Whats instead happens is that the classes and packages from the JAR is not available and when manually writing an import statement it is underlined in read and the tooltip says "not found: object x". The program still compiles and is runnable but the editor shows it has having errors and there is no code-completion for classes from the JAR.

// Main.scala
package com.markuspage.labs.scalaapp1
import library1._

object Main {
  def main(args: Array[String]): Unit = println(process("Hello, world!", new MyProcessable))
  def process(data: String, processable: Processable): String = processable.process(data)
}
// Processable.java
package library1;

public interface Processable {
    String process(String data);
}

Scala Core, Editor 0.4.0 Scala Platform 0.12 Scala Project 1.5 NetBeans IDE 7.1.2 (Build 201204101705) OpenJDK 6b24-1.11.3-1ubuntu0.12.04.1

netmackan avatar Jul 21 '12 21:07 netmackan

Maybe only classes from within the same project is scanned by the plugin? Could it be that importing libraries or JAR files are is not yet supported or maybe I have some problem with my installation?

netmackan avatar Jul 23 '12 18:07 netmackan

I can verify this. In many constellations this is happening. I'll try to write a test the next days. As for a solution, this might take a while, cause I'm not so familiar with the code yet. But it is also bugging me and one of our projects at my company.

og0815 avatar Aug 16 '12 19:08 og0815

The error is still in nbscala-nb7.2-s2.10.0-v0.2.

When reload the IDE the error desappears. I thing it is the same cause as with syntax highlighting.

nbscala-nb7.2-s2.10.0-v0.2 jdk 6,7 wun 7 x64

Valery-Sh avatar Nov 27 '12 09:11 Valery-Sh

This seems to still be a problem with latest configuration. And I can confirm (thanks @Valery-Sh) a workaround is to exit and restart NetBeans. But that is painful when dependencies are changing too often.

nbscala-7.x_2.10.x-1.6.1.1
Scala 2.10.1
Netbeans 7.3
JDK 7
Windows 7 x64

cminter avatar Mar 17 '13 05:03 cminter

I too have to confirm this bug. Has been happening to me a lot during the past couple of hours. Thanks for the Netbeans restart tip though - it does help! As mentioned by the predecessors, the project runs fine. It's just the parser (?) having problems finding the jar contents. nbscala-7.x_2.10.x-1.6.1.1 Scala 2.10.1 Netbeans 7.3 IcedTea JDK 7.2.3.6 Gentoo amd64

Tommalla avatar Jun 08 '13 20:06 Tommalla