dcaoyuan / nbscala

NetBeans Plugin for Scala
248 stars 58 forks source link

Packages and classes in libraries are not recognised in the editor #42

Open netmackan opened 12 years ago

netmackan commented 12 years ago

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 commented 12 years ago

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?

og0815 commented 12 years ago

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.

Valery-Sh commented 11 years ago

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

cminter commented 11 years ago

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
Tommalla commented 11 years ago

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