IntelliJ - show where errors are - intellij-idea

Is there a way to make IntelliJ mark error locations continuously for the files you are working on in the similar manner as Eclipse does? At the moment I need to make the project which lists all the errors in the message panel, but even then I cannot navigate to them using the editor panel. I would like to have simple dots/markers which would point to error/warning locations.

IntelliJ IDEA detects errors and warnings in the current file on the fly (unless Power Save Mode is activated in the File menu).
Errors in other files and in the project view will be shown after Build | Make and listed in the Messages tool window.
For Bazel users: Project errors will show on Bazel Problems tool window after running Compile Project (Ctrl/Cmd+F9)
To navigate between errors use Navigate | Next Highlighted Error (F2) / Previous Highlighted Error (Shift+F2).
Error Stripe Mark color can be changed here:

For those who even yet have the problem, try enabling "Build project automatically" in the Java compiler settings and see if that makes a difference as it worked for me.

I ran into the problem of not having set my sources root folder (project window--right click folder, mark directory as > sources root). If you don't set this IDEA doesn't parse the file.

For IntelliJ 2017:
Use "Problem" tool window to see all errors.
This window appears in bottom/side tabs when you enable "automatic" build/make as mentioned by #pavan above (https://stackoverflow.com/a/45556424/828062).
To access this Problems panel, you must set your project to build automatically. Check the box for Preferences/Settings > Build, Execution, Deployment > Compiler > Build project automatically.

Frankly the errors are really hard to see, especially if only one character is "underwaved" in a sea of Java code. I used the instructions above to make the background an orangey-red color and things are much more obvious.

In IntelliJ Idea 2019 you can find scope "Problems" under the "Project" view. Default scope is "Project".

Besides, you can choose going to next error only (ignore warning) by:
Right click the Validation Side Bar.
On the context menu, choose the Go to high priority problems only
it works for Intellij Idea 12

In my case, I unknowingly unchecked 'Error Stripe Mark' option (Idea 2018.2: Settings > Editor > Color Scheme > General and expand `Error and Warnings' & click 'Error').
Fix is to check 'Error Stripe Mark' option of 'Error' (as highlighted in the below image). Now you will see the error marks in scrollbar area.

In my case, IntelliJ was simply in power safe mode

Do you have a yellow icon like this [_] at the bottom of the main window?
It is a "type-aware highlighting" switch which could be disabled accidentally.
You should re-enable it by clicking on the icon.

In the intellij hit ctrl+alt+shift+s and go to global libraries and click on plus icon to add the java libraries this will solve your problem. now you will see the errors coming up
enter image description here

This is the solution I found:
Open IntelliJ Setting (Crtl + Shift + A);
Click in "Editor";
Click in "Color Scheme" + the Programming Language (inside "Color Scheme");
Select "Analysis Error";
Select "Error stripe mark" + Add the Color desired

Related

List of all errors in project in CLion

CLion 2016.2 helpfully detects potential errors in the file you're editing, which can be seen in the validation bar to the right of the code.
That's just a single file though, is there a way (like a tool window) to get a list of all such warnings in the whole project, or specific parts of it?
Bonus points if it also lists warnings and errors from the compiler, though that's less important, because the compiler output already includes any it found.
Yes, it is possible. The feature you are looking for is called the Inspector.
Do: Find Action... | Inspect Code. It will show a pop-up that will allow you to select the scope: file, whole project, custom, and the Inspection profile (you can choose the type of errors you want to see):
After clicking OK, this is an example of the output, that you can navigate with the mouse or with keyboard shortcuts:
In version 2017.2, I have it under Code | Inspect Code....
You can also right click a folder in Project view and select Inspect Code... there to be able to check only that folder.

IntelliJ IDEA 13.1.2 javadoc and tabs

I hate to ask such simple questions, but nothing I found so far helped me...
So, I've recently started using IntelliJ instead of Eclipse and there are 2 things that really bothers me...
1.) size of javadoc popup window - ok, so I finally get this little guy to pop-up whenever I need it, but it's so small I have to use scroll every single time... and that's pretty anoying when I'm working with unknown libraries...
2.) tabs == spaces - maybe some of you like this, but I don't... Eclipse was treating tabs as tabs and not spaces... I tried to change settings but with no result... or is that maybe connected with project I'm working on? (meaning, if, at the start of a project, setting were such that tabs == spaces and now changes are not applied to it)
Sorry for stupid question but, as I said, nothing I found so far helped me...
1) Just resize the window with your mouse. It will retain the size the next time it opens. You can also click on the gear icon in the upper right corner and adjust the font size. Again, it will retain the size on subsequent use.
2) I'm assuming you make the change to the "Use Tab Character" option on the "Tabs and Indents" tab for all file types and saved the Code Style. After that, you need to run the Reformat Code action (Ctrl+Alt+L or Code > Reformat Code from the menu or Reformat Code from the context menu (i.e. right-click) in The Project Tool window or Navigation Bar). IDEA retains the previous formatting (so spaces in this case) until you run a reformat on the project (or a part of it).
If you have multiple projects already created, for each one, you will need to go into File > Settings > [Project Settings] > Code Style and set the Scheme (and then do a reformat). While the Scheme definition is saved IDE wide, the scheme to use is set per project (which makes sense since an Apache Open Source project you are working on may have different code style requirements than the projects you do at work vs the ones you do for fun).
Finally, you will also want to go into File > Other Settings > Default Settings > [Template Project Settings] > Code Style and make sure your saved code style scheme (with the use tab option) is set so that new projects use that scheme when they are created.

How do I disable the Search Everywhere shortcut?

IntelliJ IDEA 13 has the new Search Anywhere feature. It sounds like it might be useful, but so far it just gets in the way. It's mapped to some kind of magical shift-based shortcut, and it comes up every time I try to shift-click to select text. When this happens, the pop-up flickers and gets into some stuck state, so the only way to get rid of it is to click in the editor pane, which of course loses the selection.
I call the shortcut "magical" because the Search Everywhere action appears in the Settings → Keymap list with no mapping, so I can't remove this mapping the usual way. Searching the dialog for search gives no relevant results.
How can I disable this buggy feature until it's ready for production use, and get back the ability to select text?
To disable the "Search everywhere" feature, you need to invoke "Go to action" (Ctrl+Shift+A), then type "Registry...".
Scroll down to "ide.suppress.double.click.handler" and check the box.
Source: https://youtrack.jetbrains.com/issue/IDEA-161094
After updating to build 133.331, I tried assigning a normal shortcut to it in Settings → Keymap, and that made it stop appearing on double-shift.
The settings for the new version have changed
Version: IDEA 2021.2.3
Preference > Advanced Settings
Scroll down to "User Interface", find "Disable double modifier key shortcuts" and check the box.
It's called Search Everywhere, and it's present in keymap.
For me it's perfectly disabled.
EDIT As I'v found it is hardcoded now, and will popup at doubleshift source
There is also an issue at jira, about this problem.
I hope it will be fixed soon.
from: https://youtrack.jetbrains.com/issue/IDEA-161094
In IDEA 2021.2:
You could enable the Settings (Preference on macOS) |
Advanced Settings | Disable double modifier key shortcuts option to
disable it.
This problem is still present under linux (ubuntu amd64 16.10 ) on Android Studio using X11Rdp for remote connection, maybe in other situations too - the Search Everywhere dialog appear on single Shift press.
The answer is here
https://youtrack.jetbrains.com/issue/IDEA-114933#comment=27-603899
Basically you need to
Open lib/resources.jar/idea/PlatformActions.xml and remove or comment such line:
<action id="SearchEverywhere" class="com.intellij.ide.actions.SearchEverywhereAction" />
and repack the jar.
Since end of 2017 you can add -Dide.suppress.double.click.handler=true to the custom VM options: cf. the answer from JetBrains.

Missing "messages" window after compilation in IntelliJ

I'm using IntelliJ IDEA 12. When I run "make project", "debug" or "run" task it does some compiling, shows little bubble that there are warnings, shows grayed-out tool window "message" and after few seconds it hides the nameplate of messages window.
Why is compile log missing? What to do to fix this? I'd like to see (in IDE) what causes those warnings...
PS: I'm not sure, but it might started doing this when I started using Scala (it's now a mixed Scala-Java project).
If you've previously selected "Hide Warnings" then the Messages window is unavailable if there are no compilation errors. It is not even possible to show the empty window using View->Tool Windows-> Message or Alt-0.
Solution:
introduce a compilation error
build, the Messages window should reappear to show your error (or at least be accessible via the View menu)
go to the Messages window and deselect Hide Warnings
fix the compilation error
Rebuild Project and all your warnings will be visible
(I had the same symptoms on 13.0.2 and this worked for me)
For me, it pops up on "Rebuild Project". Maybe that helps.
The window should be there any time IDEA compiles the code. (If there is a not a code change, and you rerun something there is no compiling done and the message window will not show). It is accessible (by default) via Alt+0 (Zero, not the letter 'Oh') or via View > Tools Windows > Messages
You may have a combination of some tool window settings causing this.
If all the tool window buttons are hidden, the messages tool window will be as well. You can toggle this setting via View > Tool Button or the icon in the very bottom left corner of the IDE. To temporarily show the buttons when hidden, hit the Alt twice, holding it down on the second hit.
If the messages tool window is not set to "Docked Mode" and "Pinned Mode" it will close after the compile.
If the above is not the issue, make sure you are using the latest version of IntelliJ IDEA, v12.1.6, and the latest version of the scala plug-in, v0.22.302 (Go to Settings > [IDE Settings] > Plugins and look for the scala plug-in). Those versions work as expected for me.
Looks like u do not have any errors and warnings! In this case in Idea "Messages" tool window auto disappears. I hade the same issue and passes half an hour to understand the reason!

unable to set breakpoint in intellij

I am trying to set breakpoints, nothing happens for couple of classes that I compiled recently with "mvn install". I am able to set breakpoints to classes which were already built by someone else.
Please let me know if anyone knows how to solve it.
Had the same issue while using IDEA CE 15:
Removing the Python CE plugin 5.0.143.103 fixed the issue... but no Python parsing! :(
File -> Invalidate Caches and Restart helped solve the problem. Thanks Tomasz Nurkiewicz for the directions
In my case, the issue was caused by PHP Plugin (https://plugins.jetbrains.com/plugin/?id=6610). Even after "Invalidate Caches and Restart", the issue persisted.
Uninstalling that PHP plugin, solved my problem.
By nothing happens do you mean that breakpoint isn't hit? Take a closer look at breakpoint icon. Especially see the difference between
and
icons. The latter indicates the code you run while debugging doesn't have any meaningful instruction on that line.
One of the reasons for such behaviour is when code you run is not the code you see. It can happen when application server can is still running old JAR or something similar. This seems to be the case since you say that breakpoints work in older code.
The solution to fixing breakpoints was adding the wildcard file extension "*.py" to the Python File Types in Python (it must have the wildcard symbol prefix, not just ".py") through taking these steps:
Go to:
IntelliJ IDE > Preferences (CMD+,) > Editor > File Types > Recognized
File Types
Under "Recognized File Types" heading:
Scroll down; Select "Python"
(associated Registered Patterns will be shown below)
Under "Registered Patterns" heading:
Click "+" icon; Enter "*.py", Click OK
(do whatever is necessary to achieve this, including removing/renaming others without the wildcard if necessary)
Add breakpoints by:
Select line(s) of code (not an empty line or comment); Going to: Run >
Toggle Line Breakpoint (CMD+F8)
Configure debugging with breakpoints by going to:
Run > Edit Configurations...; Click "+"; Select "Python"; Add a value
for the "Name" property; Select location of the ".py" file to debug
(in the "Script" property); Click OK
Debug using the breakpoints by going to:
Run > Debug... (Fn+CMD+F9); Wait until it stops at a breakpoint;
Inspect variable values shown in the file itself by hovering over
variable; Click variables and view the Frame and Variable details in
the Debug window by going to: View > Tool Windows > Debug (CMD+5)
Important Note: Initially I tried doing the following but after each one I was still unable to use breakpoints afterward:
Removing and reinstalling the Python plugin:
Entering CMD+,; In the dialog window going to Plugins > Install
Jetbrains Plugin.. > "Python" > Install
Updating IntelliJ Ultimate edition to the latest version v2016.3.4
Going to:
File > Invalidate Caches and Restart
Right click on the gutter (where you normally click to set breakpoint)
select "Configure Gutter Icons..." then enable the checkbox at the top that says
"Show gutter icons"
That fixed it for me
Simply closing and reopening file worked in setting gutter breakpoints
This is embarrassing but posting here in case this solution will help somebody else: A breakpoint will not show up if you attempt to place it between executable lines of code. The breakpoint must be located on an executable line of code to work. Make sure you click on the gutter next to an executable line or place your cursor on an executable line when you use the shortcut. Once I did this, the breakpoints worked.
"Click the gutter at the executable line of code where you want to set the breakpoint." https://www.jetbrains.com/help/idea/using-breakpoints.html#set-breakpoints