unable to set breakpoint in intellij

23,385

Solution 1

File -> Invalidate Caches and Restart helped solve the problem. Thanks Tomasz Nurkiewicz for the directions

Solution 2

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! :(

Solution 3

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.

Solution 4

By nothing happens do you mean that breakpoint isn't hit? Take a closer look at breakpoint icon. Especially see the difference between valid and invalid 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.

Solution 5

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

Share:
23,385
user1796650
Author by

user1796650

Updated on July 30, 2022

Comments

  • user1796650
    user1796650 almost 2 years

    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.

  • user1796650
    user1796650 over 11 years
    By nothing happens I mean I am not even able to set the breakpoint, I don't get that red ball at all.
  • Tomasz Nurkiewicz
    Tomasz Nurkiewicz over 11 years
    @user1796650: this is also a sign of stale code which is out of sync with what you run. How do you run your code? Have you tried refreshing (whatever you can) in IntelliJ after building and installing?
  • user1796650
    user1796650 over 11 years
    I am not yet running the code, just setting the breakpoints, which I am unable to do. Couple of points to add, I am able to set breakpoint in the same class(say A.java) in eclipse. In intellij if I add breakpoint in some other class which calls a method of A.java then while debugging it enters the correct method in A.java. I am able to correctly step debug after that. But still not able to set breakpoint in A.java.
  • user1796650
    user1796650 over 11 years
    Another thing is if I right click on any method call in A.java and say Go to declaration, even then nothing happens. It just doesn't go to called method
  • Sachin Verma
    Sachin Verma about 11 years
    Thanks @user1796650 . I was facing the same problem and was unable to resolve until I came across your post. I used the Invalidate caches option and it worked magic.
  • Sachin Verma
    Sachin Verma about 11 years
    Thanks @user1796650 . I was facing the same problem and was unable to resolve until I came across your post. I used the Invalidate caches option and it worked magic.
  • Neerav
    Neerav about 11 years
    I am having a similar problem. while debugging, intellij is still running the old code. I tried making a fresh build, invalidate caches - but the problem continues.
  • Gary
    Gary over 8 years
    Thank you for this comment. I too couldn't get this working with the invalidate caches workaround, but your comment prompted me to try disabling my plug-ins and found that the line breakpoints started working again.
  • Gary
    Gary over 8 years
    FYI, in my case it was the Python Community Edition plug-in that was causing the problem.
  • Faraj Farook
    Faraj Farook over 8 years
    Thank you.. i was almost going to uninstall the IDE to try a rollback to 14.. Thanks alot..
  • iBiryukov
    iBiryukov over 8 years
    You can reinstall Python CE plugin. That fixed the issue for me.
  • Abhishek Tyagi
    Abhishek Tyagi over 8 years
    Yes, That seem to solve the problem. It was weird though. 15.0.1 or 15 didnt have this problem, 15.0.2 has it. Thanks.
  • Bruno Santos
    Bruno Santos over 8 years
    Paranoia, really! I have my little IDEA Plugin and initially thought that it was because of it. After uninstalling it the issue was still there. Then checked in another system that had no plugins and the issue was not present. So I just went down to next most recent plugin that I had installed which happened to be the Python plugin. I was right to suspect that it was a plugin and happy to know that it wasn't mine causing the problem! :)
  • Hubbitus
    Hubbitus over 8 years
    Does anyone report that issue to JetBrains?
  • Jacek L.
    Jacek L. over 8 years
    Thank you so much for this hint
  • stantonk
    stantonk over 8 years
    i also cannot get line numbers to stay turned on...any ideas? :)
  • Kageetai
    Kageetai over 8 years
    Wow, this worked for me too, but how come the PHP plugin affected my Node.js project? Strange...
  • Bruno Santos
    Bruno Santos over 8 years
    @stantonk, I have no idea what's preventing your IDEA from keeping line numbers up. But, if I had to guess, it might just be some other plugin you have installed.
  • stantonk
    stantonk over 8 years
    @BrunoSantos :( yea. never had an intellij upgrade go so poorly :(
  • Bruno
    Bruno over 8 years
    Yep had an issue with this today as well, nuking the python plugin did the trick.
  • habitats
    habitats over 8 years
    This ought to be the weirdest bug I've encountered in a while. Worked for me too.
  • thinice
    thinice over 8 years
    Was the PHP plugin for me too
  • Bob S
    Bob S over 8 years
    just deactivating the php plugin is enough.
  • Dropout
    Dropout over 8 years
    Same for me.. Deactivating the plugin and restarting fixed it.
  • rahulserver
    rahulserver about 8 years
    For me too on intellij idea 15.0