-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve error code linkability #15431
Comments
FWIW, if I can get the "Error codes enabled by default" from the mypy CLI, that solves the first point. |
Yes, if our error codes pages had custom anchors instead of the autogenerated one, it'd help. Random thought - perhaps there's a Sphinx extension, or one could be easily built, to redirect anchors (which should be unique within the docs) to the right page / anchor? |
Makes the HTML builder generate a _refs.html file that redirects (global) refs (when provided as a hash i.e. `_refs.html#some-ref`) to the appropriate document. This allows tools (e.g. #15431) to link to well-known refs.
Note btw there is also #7186 I think it is a good idea to add direct short links. I am quite sure we can write a Sphinx extension for this. |
OK, so here is the proposed fix #15435 |
Fixes #15431 After this PR one will be able to easily find documentation for given error code using `https://mypy.readthedocs.io/en/stable/_refs.html#code-{code as reported by mypy}`, for example `https://mypy.readthedocs.io/en/stable/_refs.html#code-attr-defined`.
I missed that. This is basically a duplicate. I'm essentially asking for the same thing. |
OK, I guess I actually broke the readthedocs build. Everything works locally and in CI because |
#15437 should fix the build. |
OK, this is now available in latest: https://mypy.readthedocs.io/en/latest/_refs.html#code-union-attr |
Makes the HTML builder generate a _refs.html file that redirects (global) refs (when provided as a hash i.e. `_refs.html#some-ref`) to the appropriate document. This allows tools (e.g. #15431) to link to well-known refs.
Fixes #15431 After this PR one will be able to easily find documentation for given error code using `https://mypy.readthedocs.io/en/stable/_refs.html#code-{code as reported by mypy}`, for example `https://mypy.readthedocs.io/en/stable/_refs.html#code-attr-defined`.
Documentation
In microsoft/vscode-mypy#58, I'm adding the functionality to link to specific mypy error code documentation. However, there's two issues affecting maintainability:
Which leads to having to keep a map of all code-to-url, like this:
https://github.com/microsoft/vscode-mypy/pull/58/files#diff-3c2e579f59d8e749f5527d64f087396907db30414fe139bc91a1ecce9f9613ddR22
I would prefer if it was possible to programmatically link to mypy error codes documentation with only the information given by the mypy/dmypy CLI. Redirection is an acceptable solution to me.
The text was updated successfully, but these errors were encountered: