Skip to content

Use terminal link providers to links in tracebacks #13938

Closed as not planned
Closed as not planned

Description

https://code.visualstudio.com/updates/v1_49#_terminal-link-providers

Not only for jumping to specific positions from a traceback, but potentially to stdlib docs as appropriate (including to the right version based on the selected environment).

E.g.

Traceback (most recent call last):
  File "/home/brettcannon/scratch/Some Python test space/whatever.py", line 4, in <module>
    spam()
  File "/home/brettcannon/scratch/Some Python test space/whatever.py", line 2, in spam
    import blah
ModuleNotFoundError: No module named 'blah'

could link to:

  1. Source lines
  2. spam to the def line
  3. ModuleNotFoundError to the exception's docs
Traceback (most recent call last):
  File "/home/brettcannon/scratch/Some Python test space/whatever.py", line 3, in <module>
    os.path.exists({})
  File "/usr/lib/python3.8/genericpath.py", line 19, in exists
    os.stat(path)
TypeError: stat: path should be string, bytes, os.PathLike or integer, not dict

chould probably link to:

  1. The file lines (only the second one to /usr/lib/python3.8/genericpath.py does)
  2. exists to the docs for os.path.exists() (and this is probably one of the most complicated examples based on how it's exposed via genericpath through os.path)
  3. The docs for os.path.exists()?
  4. The docs for os.stat()?
  5. TypeError could link to the exception's docs

Problems to solve to open up as much linking as possible would include:

  1. Parsing a file to find out where e.g. spam is defined to link to it (but which could be a step towards partial IntelliSense)
  2. Resolving function names back to their docs (only useful when they are extension modules as otherwise the traceback should end up traversing into the source enough to get us what we are after)
  3. Mapping stdlib source back to their documentation (which would probably involve generating a static mapping of file paths and names to their docs; sphinx's index files which are publicly accessible for cross-referencing would help here)
  4. Bonus points for making this all work offline if someone has Python's docs cached locally

Activity

  1. ghost removed
    triage-neededNeeds assignment to the proper sub-team
    on Sep 16, 2020
  2. karrtikr commented on Dec 19, 2022

    @karrtikr

    Closing as dup of #20088.

  3. locked as resolved and limited conversation to collaborators on Jan 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions