Skip to content
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

Fix #7119: Show type hint names unqualified when resolving succeeded #8432

Merged
merged 4 commits into from
Mar 6, 2021

Conversation

tk0miya
Copy link
Member

@tk0miya tk0miya commented Nov 15, 2020

Feature or Bugfix

  • Feature

Purpose

  • Add pending_xref_condition node

    To choose appropriate content for pending_xref node on resolving,
    this introduces a new custom node pending_xref_condition. It only
    has a condition for the filtering and contents of the reference.

  • Add a new config variable: python_smart_reference. If enabled, it goes
    to suppress the module name of the python reference if it can be
    resolved.

@tk0miya tk0miya added type:enhancement enhance or introduce a new feature domains:py domain labels Nov 15, 2020
@tk0miya tk0miya added this to the 3.4.0 milestone Nov 15, 2020
@tk0miya tk0miya force-pushed the 7119_pending_xref_condition branch 2 times, most recently from 0b33db8 to 6e8cf03 Compare November 15, 2020 14:38
@shimizukawa shimizukawa changed the title Fix #7199: Show type hint names unqualified when resolving succeeded Fix #7119: Show type hint names unqualified when resolving succeeded Nov 23, 2020
Copy link
Member

@shimizukawa shimizukawa left a comment

Choose a reason for hiding this comment

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

reviewed.

@tk0miya tk0miya modified the milestones: 3.4.0, 3.5.0 Dec 19, 2020
@tk0miya tk0miya force-pushed the 7119_pending_xref_condition branch from 6e8cf03 to ce59517 Compare December 25, 2020 16:25
@tk0miya tk0miya marked this pull request as ready for review December 25, 2020 16:26
@tk0miya tk0miya force-pushed the 7119_pending_xref_condition branch from ce59517 to e6674ec Compare December 25, 2020 16:29
@@ -91,7 +91,14 @@ def type_to_xref(text: str, env: BuildEnvironment = None) -> addnodes.pending_xr
else:
kwargs = {}

return pending_xref('', nodes.Text(text),
if env.config.python_use_unqualified_type_names:
Copy link
Member Author

Choose a reason for hiding this comment

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

It would be better to use this option on PyField.make_xref(). I'll do it the next PR.

@tk0miya tk0miya modified the milestones: 3.5.0, 4.0.0 Jan 24, 2021
tk0miya added 2 commits March 6, 2021 02:01
To choose appropriate content for pending_xref node on resolving,
this introduces a new custom node `pending_xref_condition`.  It only
has a condition for the filtering and contents of the reference.
@tk0miya tk0miya force-pushed the 7119_pending_xref_condition branch from e6674ec to 24b6814 Compare March 5, 2021 17:03
@tk0miya tk0miya changed the base branch from 3.x to master March 5, 2021 17:04
@tk0miya tk0miya force-pushed the 7119_pending_xref_condition branch from 24b6814 to 6b5448f Compare March 5, 2021 17:20
…fied_type_names

Add a new config variable: python_use_unqualified_type_names.  If enabled,
it goes to suppress the module name of the python reference if it can be
resolved.
@tk0miya tk0miya removed the request for review from jakobandersen March 6, 2021 05:07
@tk0miya tk0miya force-pushed the 7119_pending_xref_condition branch 2 times, most recently from bf5c7df to 02cbf43 Compare March 6, 2021 05:54
@tk0miya tk0miya force-pushed the 7119_pending_xref_condition branch from 02cbf43 to 7f0b13a Compare March 6, 2021 05:58
@tk0miya
Copy link
Member Author

tk0miya commented Mar 6, 2021

It's time to merge!

@tk0miya tk0miya merged commit 0a3f897 into sphinx-doc:master Mar 6, 2021
@tk0miya tk0miya deleted the 7119_pending_xref_condition branch March 6, 2021 08:32
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 14, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
domain domains:py type:enhancement enhance or introduce a new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants