Skip to content

Conversation

@Avasam
Copy link
Contributor

@Avasam Avasam commented Jun 13, 2023

Closes #57

I wish there was a better way to map code to url for maintainability, I have opened a doc feature request with mypy to have better way to programmatically link to the codes' doc. Both for better anchors and a way that doesn't span 2 pages. python/mypy#15431

Demo:
image
Which links to https://mypy.readthedocs.io/en/latest/_refs.html#code-import

Other potential improvements:

  • We could link to a specific mypy version doc instead of "stable/latest". But I don't it would bring much value anyway.
  • After the next mypy release, "latest" can be changed to "stable".

Copy link
Member

@karthiknadig karthiknadig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR 🥳

I have some minor changes. I think we can directly return a CodeDescription from the helper function. That would also mean that the case where we don't have a link will give the same old result as before.

@Avasam Avasam requested a review from karthiknadig June 14, 2023 02:43
karthiknadig
karthiknadig previously approved these changes Jun 14, 2023
@karthiknadig karthiknadig added the feature-request Request for new features or functionality label Jun 14, 2023
@karthiknadig karthiknadig self-assigned this Jun 14, 2023
@karthiknadig karthiknadig added this to the June 2023 milestone Jun 14, 2023
@karthiknadig
Copy link
Member

@Avasam Looks like there is a formatting issue. Can you run black on lsp_utils.py?

@Avasam
Copy link
Contributor Author

Avasam commented Jun 14, 2023

With python/mypy#15435 and python/mypy#15437, up to you if you wanna update the logic in a separate PR or wait for the next mypy release so we can point to stable in this PR using consistent anchors.

Or an in-between: point to latest for now.

@karthiknadig
Copy link
Member

@Avasam We can point to the latest. With the assumption that the error messages are not going to change significantly.

anthonykim1
anthonykim1 previously approved these changes Jun 15, 2023
@Avasam
Copy link
Contributor Author

Avasam commented Jun 15, 2023

Sorry to do an update after an approval, but this is much more maintainable.

@karthiknadig karthiknadig enabled auto-merge (squash) June 20, 2023 23:55
@karthiknadig karthiknadig merged commit ea18cf0 into microsoft:main Jun 21, 2023
@Avasam Avasam deleted the link-mypy-error-code-doc branch June 21, 2023 13:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature-request Request for new features or functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature request: Link to the error's documentation

3 participants