Intellij Idea highlight src with errors - scala

I'm investigating switching from Eclipse Scala IDE to Intellij 15 + Scala plugin.
I can see that compile errors are reported in the Messages tool, but I can't see any highlighting of source files containing errors in the project tree.
Is this feature not available? If not, how do you cope? Have I been just spoiled by Eclipse and should learn to 'rough it'?
Update
This question is different to IntelliJ - show where errors are because:
This question is concerned with visual indicators against files in the folder/file tree view.
That question is concerned with indicators within the files being edited. This can be seen in the accepted answer, where the screenshot concerns editor settings for code highlighting.

I opened an issue with the exact same request when I switched from Eclipse to IntelliJ: https://youtrack.jetbrains.com/issue/IDEA-110767 !
After a while you become accustomed to look at the messages window where you get active links which when clicked, directly take you to the error.
Having syntax highlighting in the tree is nice when you refactor and hence tend to break a lot of existing code. At the same time automatic refactoring was (still is?) much better in IntelliJ than it was in Eclipse.

Related

Is there a way to stop eclipse search from duplicating results

This is a really minor issue but I thought I'd stop ignoring it and see if there is an easy resolution. In Eclipse Oxygen.2 I have a Java app with a number of sub projects which I tend to look at in JavaEE view (presumably irrelevant to the search results). When I do a file search (*.java) I get each file twice. One under parent_project\project and once under project. This is a little irritating and made more so because the intellisense and code 'go to' facilities don't work in the files displayed under parent_project\project.
I just wondered if I was missing a really obvious way to stop this happening ?
I don't know since when this feature is implemented in Eclipse, but on 2020-09 version you can use "Filter duplicated resources" on the Ctrl+R search options :

Scala IDE supporting autocompletion and syntax highlighting

I'm looking for a good Scala IDE.
I tried the Eclipse (Some time ago) and IntelliJ Idea (In these days) plugins but I am somehow dissatisfied by both of them. The first it was pretty slow and unstable, while I don't like too much IntelliJ Idea's interface.
Is there any alternative available?
I will work with a SBT project and what I am looking for is mainly syntax highlighting, autocompletion. It would be nice to have partial compilation of the source code as I am not used to Scala syntax and it would help me find errors as soon as I write them.
IMHO InteliJ is the best IDE for Scala at the moment. First I had also some problems with the different interface compared with Eclipse. But in the end you profite from the whole package included with IntelliJ. There is also an active scala plugin development.
What I like to do is split my terminal once horizontally, and then split the bottom pane once vertically.
In the top pane I have vim (emacs works too if you're an emacs person) with the NERDTree plugin (acts like the project folder/file browser in text editors). On the bottom left I have SBT continuous compilation (sbt ~compile). I use the bottom right pane to actually run code (tests, etc.).
Regarding auto-completion, you can try something like the Snipmate plugin for vim.
Also, as stated by Ivan, if you end up using emacs ENSIME seems to be widely liked - unfortunately there doesn't seem to be an ENSIME port for vim yet, at least to my knowledge.
With this setup, I edit in the top pane, and once I save a file, I get near immediate feedback by just glancing on the bottom left and know when I typo'ed something, or maybe my code is just plain wrong, stuff like that.
On a slightly related note, I used to use IDE's but they got too messy for my taste (back then I was writing C and C++) so I moved to just a text editor (e.g. Chocolat, Sublime Text 2) and used a terminal, and that was fine for me for about a year. Then this summer I really sat down and tried going vim only and I can honestly say I'm much more productive in my all terminal setup than what I was before. Just my 2 cents.
This all also has the added benefit of working on remote servers as well.
Scala IDE for Eclipse is under active development and evolving rapidly. You should give it a try now (I don't know what 'some time ago' means, but if it's more than 6 months you might be pleasantly surprised). Granted, I am biased since I am a committer.
You could try ENSIME for emacs. You can also use it with jEdit, Sublime Text 2, and probably more.
Personally I use Scala IDE 2.1 (for eclipse). It is a lot faster now, and it has gotten to the point where I actually want to use it, after being in a similar situation to you.

eclipse libraries no longer working

i had put two libraries on the build path of my project, and then i closed eclipse for the night. when i re-opened eclipse, and opened the same workspace, the libraries "aren't working" in that eclipse isn't doing any of the helpful things it was previously doing, like underlining bad syntax with red squigglies, reporting things that didn't get imported, etc. anyone have an idea of what happened?
Maybe you have disabled "Project->Build Automatically"?
Try Project->Clean. Perhaps the perspective has changed, e.g. from one language to another so it isn'd doing any syntax highlighting

Eclipse - Save Folding on Quit

Is there any way to save my code folding in eclipse?
It's horrible to scroll trough my entire UI declaration. (And yes, I googled it! :)
The question is very similar to Is there a way to collapse all code blocks in Eclipse? .
I'm re-posting my answer there here.
The question is a bit old, but let me add a different approach. In addition to the above hot-key and utility approaches, there are default preference settings that can be toggled.
As of Eclipse Galileo (and definitely in my Eclipse Version: Indigo Service Release 2 Build id: 20120216-1857) language specific preferences can open up new files to edit which are already collapsed or expanded.
Here is a link to Eclipse Galileo online docs showing the feature for C/C++: http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse.cdt.doc.user/reference/cdt_u_c_editor_folding.htm .
In my Eclipse Indigo I can open the Folding Preferences window via : menu/ Window/ Preferences/ Java/ Editor/ Folding and set all options on so I can open files by default that are completely collapsed.
Amongst other things, Mylyn allows you to fold/hide content and persist the state.
Mylyn monitors your work activity to identify relevant information, and uses this task context to focus the user interface on the task-at-hand. This puts the information you need at your fingertips and improves productivity by reducing searching, scrolling, and navigation. By making task context explicit Mylyn also facilitates multitasking, planning, reusing past efforts, and sharing expertise.
Once Mylyn is enabled it will start folding/hiding the content. If you have an active task (can use a local task repository) the state should be persisted between sessions. Alternatively you can attach the state to the task (sorry don't have Eclipse to hand to check the exact method to do this) then retrieve it. This is useful if you are sharing tasks with others.
I know this isn't exactly what you were asking, but this was really helpful for me:
Ctrl+Numpad_Multiply can also be used
to expand all
Ctrl+Shift+Numpad_Divide is bound to
collapse all
Ctrl+Numpad_Divide toggles folding on
and off
(Taken from this post: Is there a keyboard shortcut in Eclipse to fold the current method/block? )
This, and plenty other issues of Eclipse made me switch to JetBrains IntelliJ IDEA. It's worth sneaking a peek at it if you find Eclipse's performance annoying, need more control on your code formatting or if you just want to have your code foldings persisted.
I'm not using it for too long now but it seems pretty handy for anyone developing in the Java, Android or Scala corner.

Eclipse: Refreshing known types in Java project

If you press Shift+Ctrl+T or choose "Navigate > Open Type..." you get the "Open Type" dialog for quickly navigating to a known class. When you start typing a name only the classes for which the name matches stay visible. That way you can find a class of which you know the name very quick without having to browse through the package explorer tree.
This has been working great for me up until this morning. All of a sudden for a couple of my projects I am only seeing some of the types that exist. Of course I tried the obvious steps of refreshing the projects, cleaning the projects, re-building the projects, rebuilding the projects externally, but all to no avail. It is a bit odd since the types are known in other places. If I add an import statement Eclipse does not complain that it doesn't know the type and I can Ctrl-Click through the types to get to their file. However, the type navigation knows nothing about them.
In the past when InteliJ used to do this to me I would go find its cache files and delete them forcing it to rebuild. Does Eclipse have something similar I might do (I'm an Eclipse newbie)? I am using Eclipse 3.4.2 and I have it configured to not delete files on a clean (because our actual build process puts files into the output directories that I don't want Eclipse mucking with).
Have you tried closing and reopening the project? Only types from open projects are held in memory, and the refresh occurs when you Shift+Ctrl+T for the first time on a newly opened project.
Edit to add: Ctrl+Shift+R also displays the types (along with everything else) but it also supports the Camel-case thing to find the Java types quickly.
Close eclipse and delete any .index files and the savedIndexNames.txt file in workspace/.metadata/.plugins/org.eclipse.jdt.core once eclipse is restarted it will rebuildl the entire index for Ctrl+T
try starting eclipse with the -clean flag, you can add this to your eclipse.ini which can be found in the same directory as you eclispe.exe, or if you start eclipse using a bat or shell script, add it as a startup argument, e.g. eclipse -clean.
The clean will tidy your workspace, and should force eclipse JDT to recalulate types. Ive had issue with .snap files (with seem to be created on dirty shutdowns) that seem to corrupt my workspace until I clean them up, not long ago eclipse lost the Object class!! made for some interesting errors!
I get problems like this often. I tried your solution, noticed it seemed to rebuild its search index, but I still couldn't find any of my classes. Then I took a look at the little green arrow on top right corner of that dialog, and noticed I had a working set selected which belonged to another project. I find it a little dumb that Eclipse doesn't warn you about this or anything, since this can be a very annoying little detail that one tends to forget (me at least ;-)).
Anyways, clicked on "Deselect Working Set" and bam I can find my classes again. Thought I'd add this here since others may make the same mistake.
This worked for me -
Select your project in Package Explorer
Press F5 or Right click and select Refresh
I used the "-clean" as first line in the eclipse.ini (version Juno) and worked like a charm.
I'v tried all the answers and I still had the issue. I then tried this:
I deleted the project (it's a maven project) and re-imported it. This time I made sure i check the "Add Project(s) to working set" checkbox. After that Eclipse was able to find the classes in that project.
The problem must have started because I didn't check this checkbox when i first imported this project.
By the way, I'm using Neon
(Warning: Shameless marketing ahead)
If you like this feature, you would love nWire. nWire allows, among other things, to quickly search not only for types, but for any possible Java element like method or field. It also uses a navigator view which is non-modal. After searching you can see the class associations in a very quick and easy way. Check out the video on our site.