How to make intellij detect the errors proactively? - intellij-idea

When I develop with intellij (in java fyi), if I update for instance the return type of a method, I'm expecting intellij to mark all the files that are now not compiling without me doing a right-click compile.
I'm looking for such an option but I don't know where this is.
Thanks

There is no such option 'out of the box'. IntelliJ just works different than, for example, Eclipse when it comes to compiling. Eclipse recompiles all files that are affected by a change as soon as you save your changes. In IntelliJ there are two ways of checking the effect of your changes:
Trigger the compilation explicitly with Make Project or the compile action CTRL-SHIFT-F9.
Open one of the affected classes: only then will IDEA's Inspections mechanism start checking it for errors.
The advantage is that you have less file system load while you are coding.
But as described in this answer, there is a plugin to achieve what you want (even though it seems to have some performance pitfalls): https://stackoverflow.com/a/12744431/5788215

Related

Intellij IDEA 2017.1.5 with the Go plugin wrongly Reports Unused Functions and Variables

I'm using Intellij IDEA 2017.1.5 with the Golang Plugin.
When I run Analyze > Inspect Code > Whole Project, the Inspection Results always include "Unused Exported Function" warnings, even though my project codes clearly use those functions. The same goes for some Global Variables and Constants.
When I comment-out those "unused" functions and variables, I encounter "Undefined Function" and "Undefined Variable" errors, and when I put them back, the errors disappear, so I know they are actually being used within my project.
Is there a way to make these wrong warnings go away, or "refresh" the compiler's Code Analysis? And is this a known issue with Intellij IDEA or the Golang Plugin in general, and has anybody else encountered this?
It's really annoying because I'm aiming for 0 Warnings and these ones never go away.
Upgrade to IDEA Ultimate 2017.3+ or use GoLand and see if the error still happens.
The plugin for 2017.1 is really old and a lot of changes have happened since then.
If the issue still happens, then report it to https://youtrack.jetbrains.com/issues/Go and make sure to include a way to reproduce issue.

IntelliJ's IdeaVim plugin disables converting Java to Kotlin

I would like to use IntelliJ's feature, which converts Java code to Kotlin by simply copy-pasting from Java file to Kotlin file. It is working fine, but when I turn on IdeaVim plugin, it refuses to work anymore. I know Vim decently and I that's not the problem with my misunderstanding Vim edit modes. I am aware of How can I convert a part of Java source file to Kotlin? and answer by #yole saying that there is no other tool to do that.
But that answer was made over 3 months ago, and maybe some other tool appeared. So, my question is if someone found workaround to make IdeaVim plugin cooperate with Java to Kotlin conversion. I've already made a ticket on YouTrack: https://youtrack.jetbrains.com/issue/VIM-1103 but frankly, I am not so sure if it will be resolved.
Ok, guy from JetBrains answered my issue. The obvious workaround (which I didn't figure out) is to copy and paste from context menu. Then conversion question shows up. IMO it seems unlikely that IdeaVim plugin will support this feature by yanking and putting (Vim's copying and pasting), as from:
Running IDE actions on copy and paste might be a good idea, but we're not sure it wouldn't disrupt the workflow of the current users.
The vim plugin takes over the clipboard and past functions. When you type :actionlist you get a list of idea actions you can use in your .ideavimrc file to map keymaps to idea actions. Use :action COMMAND to execute the command.
I.e.:
norepmap <C-w>q :action VimWindowClose<cr>
closes the current window.
Furthermore, you can search for a particular action with :actionlist Past.
This lists
EditorPast <C-V> <S-ins>
among other things.
If you want to check if EditorPast ist the right command you can test it using :action EditorPaste.
Another way to make this work is to let idea handle the <C-v> shortcut. This can be archieved with the Settings -> Other Setting -> Vim Emulation settings. The handler (vim or idea) can be defined with that setting.

VS2012 Could not copy the file *****.exe because it does not exist

I have a fairly simple one solution project in VS2012. Standard windows forms, no special DLLs.
I get to a point were if I add more code to any form, or add a new control, the build fails in DEBUG mode. If I remove the line or the control, it works.
If I switch to RELEASE, the build succeeds.
If I create a new configuration and copy RELEASE, then that too fails.
If I revert to VS2008, all is fine. If I then re-convert the solution, it will be fine for a while.
Anybody else see that? I have researched the cases about missing DLLs and locked files, but that doesn't seem to apply. Neither does renaming the assembly work.
After many hours of looking at the options, a workaround is to turn on optimisations in "Advanced Compile Options".
I do not know what optimisations actually optimise, but they are turned off in debug by default because the debugger doesn't like them. Apparently, they will move code around.
This is obviously only a workaround and not the cause, so any other suggestions are welcome!

Where is the error list in Intellij IDEA?

I used to develop a habit in Eclipse to use Error List to check errors and warnings. Is there something like that in IntelliJ IDEA? I don't see it.
Eclipse incrementally builds the whole project all the time and finds all compilation errors even in classes you haven't touched/opened at all.
IntelliJ is not building your whole code base upon every change so there is no such view. The closest you can get is Messages view (available under Alt + 0) but it only shows compilation errors discovered when a file with errors was physically opened (or when the whole project was built).
UPDATE
IntelliJ IDEA 12 will most likely have incremental compilation feature:
Currently supported: incremental compilation of Java, Groovy, resource copying, UI Designer forms, Artifacts, Android, annotation processing, not-null instrumentation
It's also possible to look at tiny red stripes on the scrollbar to find where the errors in a file are located (they couldn't make it less convenient to use :/)

Replicate class with main method as in Java IDE within Objective-C and Xcode 4

I have a simple question. Coming from a java background and having worked extensively with eclipse, netbeans or any other java IDE, is quite nice to have the possibility to add a main method to a class and execute it within the IDE, with just a click, and see the output.
I was looking for the same possibility within xcode4/objective-c but I couldn't find a way. From time to time, I like testing small piece of software, without compiling and running the whole project.
As I am still "thinking" in Java, could you suggest the proper way to achieve this with xcode4 from an "objective-c developer point of view" ?
thanks
There's not really a lightweight way to do this, but you have two options that I can think of depending on whether you want to keep the harness code you've written.
If you do, then you'd need to make a new target in your project for each class you drive with a harness, and have that target build just the class you are driving and a simple file with just the main code to drive that class.
If you don't, then you could make a target with a main, and each time you want to drive a different class, change which files are built, change the code in main, and rebuild.
This is assuming that you want to avoid both running and compiling the rest of your code. If you don't mind compiling everything, you could have one test-harness target that builds all of your classes, and either change main on the fly, or use #ifdefs or a runtime argument to decide which helper code to run.