Search code examples
pythonvisual-studio-codesyntax-error

VSCode "Open file in editor" hover not working in Python


When I get a syntax error in Python I think VSCode is supposed to offer a mouse hover over the error message, which lets you Ctrl-click to go to the errored line in the editor.

I'm not getting the hover on the final line in the traceback (but it works OK on earlier lines).

I think it's some kind of configuration problem - but what?

This does work - I get "Open file in editor" (mouse at red arrow):

enter image description here

But this doesn't work (no hover message; mouse at red arrow):

enter image description here

(naturally, per Murphy's Law, the latter is the one I want to work, as the error is in fact on line 2171.)


Solution

  • UPDATE:

    The problem is that there are spaces in your file path.

    enter image description here

    To fix it, change your folder name to make the file path recognizable. Generally, the file path should be in full English, with no spaces and no special symbols.


    Hover over the file path to see the underscore including the line number. At this point Ctrl + click will navigate to the corresponding line number of the corresponding file.

    enter image description here

    enter image description here