List of all errors in project in CLion - ide

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.

Related

CLion code navigation with C++ doesn't work

I've used AppCode (Intellij C++/ObjC IDE that replaces Xcode) for a while and really gotten used to being able to Ctrl+Click on any identifier to get to its definition/decleration.
Now on a new work place, I'm using CLion for a somewhat larger code base and Ctrl+Click hardly ever works. It only seem to work when the identifier is in the same file.
Is there anything I need to setup for this to work correctly? CLion seem to index the code successfully and doing text searches works fine.
You need to use import project functionality of CLion from File -> Import Project and give ok for CMakeLists.txt file automatic creation. Never mind the file is for CMake, you can build your project with other tools too, but CLion uses it for the dependencies.
Then append in the beginning of that file a line stating:
include_directories(.)
After that go to File -> Settings and there search for Keymap from the left and after that on right, right below the word "keymap" there is a selection element for taking for example Eclipse default keymapping in use and there you have at least (I tested only it) the ctrl + click functionality working like charm!!
kudos about the include_directories(.) goes to this question: CLion indexer does not resolve some includes in the project directory
You need to press ctrl + alt + shift + n.
And after pressing it a dialog box will appear to enter your variable/function name and click enter.
Tip: Filter the result for a better experience. Filter option is present on right side of the dialog box.
To get a quick peek of function/variable definition press ctrl + q while focusing on the variable or function.
To get the detailed or full definition of function press ctrl + shift + i while focusing on the variable or function.
I just looked at one of my more complicated teaching examples with multiple header/source files where this would come up.
What I see is that ctl-click (and the red/green arrows in the gutter) does work only in the same file. But I can right-click on a method from another file and choose to go to either the declaration (in header) or definition (in cpp).
The hotkeys to do this are not ctl-click. But you can remap hotkeys in IntelliJ ides, so you may be able to come up with hotkey combinations that don't seem too awkward to you.
What helped me was to run File > New CMake Project from Sources
Until that point, Ctrl+click in CLion would go to the definitions, but wouldn't find any usages.

Intellij exclude file from being compiled

I am trying to exclude a particular file in my project from being compiled.
According to the Intellij IDEA documentation you do this by "marking the file as plain text".
However, the context menu in the project view where this functionality is supposedly located has no such action. I am using version 13.02 of Intellij. Here is what my context menu looks like:
Under File > Settings > Build, Execution, Deployment > Compiler > Excludes, add an entry.
Any attempts to run a path specified here will result in a ClassNotFoundException, and a very important class indicator as well.
Just to compound on Makoto's answer (would comment but don't have reputation), it looks like this feature does not apply to classes (.java) or assets (images)...for these types of files, it looks like you will need to actually go to the compiler and explicitly state that the file(s) should be excluded.
However, for .htm, .xml, or really anything that isn't a class or asset you will find and can use the 'Mark as plain text' option.
Edit: It looks like you can also go to the 'Messages Make' error / warnings view and Exclude from there, a little less work IMHO.
The answer that #Makoto has given is pretty much the way to go, but in case that you are like me and you get easily both distracted and frustrated looking for that menu, you could use this shortcut:
press ctrl + shift + a , and in the input box that appears type excludes, and select the first item that appears.

How to see live list of syntax errors in WebStorm 7 (or IntelliJ)?

While editing a JavaScript file, the IDE shows highlights on the lines that have problems and displays the lightbulb when you're on one of those lines.
How can I see a live list of all problems found in the current file (e.g. syntax errors)?
The only way I found so far was to manually run inspection and check the inspection window. That's quite cumbersome. Even the "Problems" section of the Project window updates itself automatically as soon as I change the code (even without saving) - but it doesn't display the actual errors (only which files have errors).
Apparently the IDE knows what errors exist in the file - I just can't find a way to see all of them in a list.
In every other IDE I know, it is a built-in, enabled-by-default, feature: eclipse, visual studio, brackets, etc.
Apparently this is an open issue on the IntelliJ family of products. Please upvote that issue if you feel it is missing as well!

IntelliJ - show where errors are

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

Rename using suggested var name with resharper

I'm Using resharper 6 nighty builds and VB.net. I've a big medium project with multiple files that don't follow the code style conventions of my company.
I've configured resharper with my own convenctions and It suggest to me the right name for each variable (perfect!).
But I can't find any automagic way to make the current name to be replaced with the suggested name.
Are there any way to do it? If not ... did you know ane fearure of coderush Xpress to achieve it?
Thanks.
If you've configured ReSharper with your naming conventions, then it should show a warning (blue squiggly underline) under any identifiers that don't comply. If you put the text cursor on one of those misnamed identifiers, you should see a pyramid icon appear near the left margin. Then you can press Alt+Enter (or click the pyramid icon) to drop down a quick-fix menu. There should be an option in the menu to "Rename to '_myField'". Usually it's the first item in the list, so you can just press Enter again to do the rename.
If you want to do this on everything in a source file, you can use the ReSharper > Inspect > Next Issue in File command (or its keyboard shortcut -- F12 in the IDEA keymap) to move the cursor to the next warning in the file. Then, if it's another name warning, you can use Alt+Enter, Enter again to fix it.
Unfortunately, there isn't a way to automatically fix every instance of a warning at once (though it's been requested; please feel free to vote for RSRP-126551 in their issue tracker).