Eclipse: Using "Open Declaration" ... in a Scala project - scala

I've been trying to convert from Java to Scala for a few months, and found that the greatest roadblock is that Eclipse plugin for Scala is hardly better then using Vim.
I normally have "Build Automatically" on, so apart from Open and Save, the commands I use most of the time are:
Open Declaration (F3)
References > Workspace (Ctrl-Shift-G)
Open Type Hierarchy (F4)
Open Type (Ctrl-Shift-T)
Content Assist (Ctrl-Space)
and looking at the Outline.
None of this works with the Scala IDE for the libraries. Some stuff works for my own code, like outline. But the rest just returns the following error:
The resource is not on the build path of a Java project.
Is there any way to get any of those things to work in Eclipse? Without them, basically the only thing I get is syntax highlight and compile-on-save, and I can get syntax highlight from vim without needing 1.5 GB of ram...
With implicits, and static function import, finding out from where something comes is really difficult without F3. I ended up using Google to find what class/trait defines what.
[EDIT] I just pulled Eclipse Classic 3.6.2, and update-1.0.0-milestones-2.8.1.final, which wasn't available the last time I checked. They have fixed the Outline, and "Open Type", that's it. The rest still doesn't work.

Which version of the Eclipse plugin are you using? If the version is from a while ago, then you're right, it's a bit buggy.
However, there is a new version, currently in beta (as of 23.04.2011) available from Scala IDE Eclipse download site. This is a lot better.
Also, please make sure that the 'Use JDT content assists' checkboxes are checked in Scala->Setup diagnostics window.
Please try the new version, and see if it fixes your problems. If not, raise a bug, and the team will fix it.

Related

Shortcut for reference searching in Scala IDE (cmd+shift+G)

I'd like to find all references to certain methods within my workspace. I used to do this using Eclipse's ⌘+shift+G / ctrl+shift+G hotkeys for all my Java classes, but now nothing shows up when searching in Scala classes using the Eclipse Scala IDE.
I'm currently using Scala IDE for Eclipse v3.0.3.
Is this reference searching functionality already supported in the Scala IDE, and if so, what is the shortcut for it?
Thanks.
I had this problem too and I ended up installing the Eclipse Quick Search plugin from the Spring team that normally ships as part of STS. It has no Spring dependencies and is easy to install separately from the Eclipse Marketplace. Use ⌘+shift+L and start typing and you get incremental search results.
Find references is implemented as feature but it is far away from being as powerful as the Java implementation.
You can find the actual key combination if you do a right click in the editor area and navigate to the "References" entry.
However, if the find references feature doesn't find anything, then it is clearly a bug and it would be nice if you could report your use case in the ticket tracker.
Did you try using Scala-Search? It's available from the same update site as the Scala IDE itself, and it should find Scala references. See Features docs.

Javadoc could not be found in the attached Javadoc - a flaw with Eclipse + Doclava

There are quite a few questions with similar titles, but please read on as this is subtly different and I've not yet been able to find a solution in the many answers given to those other questions.
Scenario:
I have an external JAR file with a separate HTML tree javadoc. I have pointed Eclipse at the javadoc by completing the JAR's "Javadoc Location" in the build path dialogue. The source is not available to Eclipse.
At first it looks like this is working fine. If I hover over a class name (say, Wibble) the corresponding javadoc text pops up.
However, if I hover over a method (say the word create in blah = Wibble.create();), I get the pop-up "...the Javadoc could not be found..." which is confusing as it's just shown me the javadoc for the Wibble class.
Indeed, if I click on the icon within the pop-up to "Open Attached Javadoc in a Browser" it correctly opens the HTML and presents me with the text for the method that it just said it could not find!
Technical notes:
My Eclipse version is Android Developer Tools, Build: v22.2.1, though this was happening on vanilla Eclipse before I updated to the ADT version.
The javadoc is being generated by command line using the Doclava doclet.
Any suggestions about either what might be wrong in the javadoc, or in eclipse settings, or...?
EDIT In the course of subsequent experimentation I've found that this problem only occurs with a combination of Eclipse and javadoc generated by Doclava. My pragmatic solution has been to generate the javadoc twice - once for human readability by using Doclava, and once for Eclipse readability using vanilla Javadoc.
If anyone knows these systems in depth I'd still love to know why.
(In order to not leave this 'unanswered' now that I have a solution)
In the course of subsequent experimentation I've found that this problem only occurs with a combination of Eclipse and javadoc generated by Doclava. My pragmatic solution has been to generate the javadoc twice - once for human readability by using Doclava, and once for Eclipse readability using vanilla Javadoc.
If anyone knows these systems in depth I'd still love to know why.

Scala # IntelliJ 12 - Can't fetch docs / some functions are not shown in dropdown. [BUGS]

I've been searching for a long time now to find a decent IDE for Scala.
Eclipse is not satisfying at all, as auto completion doesn't work, somehow. Also, I can't modify the libraries at all in the build path e.g. set the docs/source.
IntelliJ seems better, however, there are some major bugs:
When the drop down menu appears that lists all the function, some of them are sometimes just not shown! I think it's because of scala-library / scala-compiler, it mixes them up or something...
The docs cannot be fetched, I get this message over and over again (here the functions are listed, strange enough...):
This is the library window:
The dependencies and the compiler are set right, I strongly suppose.
Does anyone know what the problem is? And how to fix it? Or is it a known bug?
Is there an IDE that can handle Scala?
Regards!
Typically, searching for names (values/classes/functions/etc.) for auto-complete can be quite slow compared to Java in IntelliJ simply because the automatically imported namespace can be quite large, and it also searches through all implicit conversions. However, I've never seen it refuse to show functions like your screenshot, what version of IntelliJ and Scala plugin are you using?
I've never gotten the pop-up docs to work via attaching JavaDocs (I haven't tried remote fetching), so I'd recommend just ctrl+click to go through to the source to read the documentation there. (However, the function/type definition does popup correctly when sources are attached). I'd suggest posting an issue at http://youtrack.jetbrains.com/issues/SCL if you have the opportunity.
To your final question, the answer is unfortunately no. The tooling for Scala is nowhere near that of Java, but both Scala IDE for Eclipse and IntelliJ are making great progress in changing that, and both are strong in some areas while weak in others. In the end, you'll get limited support either way, so choose whichever fits you best.
I have found the solution to the problem:
The bug was caused by Java Decompiler Plugin. It tried to decompile the binaries of Scala's class-files, which obviously failed. This led to that error message and further led to the Scala plugin not working as it should, thus not displaying some of the functions.
This took me a long time to figure out, I installed 2 other versions of IntelliJ (which apparently imported the JD plugin), NetBeans and downloaded several builds of the Scala Plugin, only to discover this cause. Deactivating Java Decompiler solved it.
Regards.

Are there any Eclipse language IDEs -plugins- that use JavaCC?

I'm using JavaCC to create a language plugin for Eclipse and I wanted to know if there are any stable language IDEs for Eclipse that use JavaCC to create their AST representations and Lexer/Parser files. Thanks.
I don't know of any stable ones, however, the Eclipse IMP project supports creating IDE using any parser generator. Sadly, the project does not seem especially active (the last release is almost a year old), and documentation is a bit scarce.
However, it features a half-working example (crated with LPG), that I believe it could be adapted for JavaCC as well.
I tried a Google search for
"import org.eclipse" "import org.javacc"
hoping to find a web page with the text of a .java file from some plugin that included both. No results came up. Nonetheless there may well be a plugin that uses JavaCC, but completely segregates the code that depends on JavaCC from code that depends on Eclipse. Hmm.

How do I get support for GPB in Eclipse?

I'm trying to use Google Protocol Buffers in my project and I'd like to have some tooling support from Eclipse. In particular, I want Eclipse to call protoc every time I make changes to the .proto files and then rebuild all code that depends on the generated code.
I tried to set up a Custom Builder but it keeps bugging me with errors I don't understand, most often it complains that the .proto file is not on the path given by --proto-path, which it should be by all I can tell. Also, because I use ${build_files}, Eclipse passes all changed files to the compiler (instead of those that I have configured to trigger the build).
NetBeans seems to have a protobuf-Plugin, but I can't find one for Eclipse. Is there one?
Theres a protoclipse plugin on googlecode, which is in the initial stages:
http://code.google.com/p/protoclipse/
Not sure if there is a builder, but I did find a plugin for syntax highlighting for protocol buffers.
You can define an external builder on the plugin that invokes an ant task. It is an ugly kludge, but until there is a better solution this may serve your purposes.
In practice, syntax highlighting turned out to not be that important, I hardly edit these files, and they tend to be very small. Maven and the m2eclipse plugin handle the building side of things great.
I recommend using Google's "Protocol Buffers Development Tools". It is a plugin for Eclipse that features automagic regeneration and error checking, among other things. It's available here: http://code.google.com/p/protobuf-dt/ .
While this question is close to other Eclipse plugin for working with protobuf, answers here are different.
Well, yes, if you use maven/gradle to invoke protoc (Protobuf compiler), than you may need no Eclipse plugin at all.
Colorizing editor helps for long file or with many comments. Know there are 2 editor plugins for Eclipse.