Skip to content

More fine-grained highlighting of parameters in function signatures #6417

Closed

Description

@timhoffm

Parameters in function signatures are currently parsed to a single html element such as
<em class="sig-param">myparam=4</em>

It would be nice to split this down further into classed spans, so that we could highlight different parts of the parameters separately. For example:

<em class="sig-param">
<span class="sig-param-name">myparam</span>=<span class="sig-param-value">4</span>
</em>

(line breaks only for better readability. Actual code wound not have linebreaks as they would result in whitespace in the rendered HTML.)

Things to consider:

  • This requires further splitting at the parser level.
  • Maybe even add a class for =?
  • Type annotations could be considered as well, as a separate span.

This is a follow-up on #4390/#6401 and #5868.

Activity

  1. added
    type:enhancement
    on May 31, 2019
  2. added this to the 2.2.0 milestone on May 31, 2019
  3. tk0miya commented on May 31, 2019

    @tk0miya
    Member

    Will do.

  4. Thom1729 commented on Jun 5, 2019

    @Thom1729

    Instead of em, var seems semantically appropriate.

  5. modified the milestones: 2.2.0, 2.3.0 on Aug 18, 2019
  6. modified the milestones: 2.3.0, 2.4.0 on Dec 8, 2019
  7. tk0miya commented on Jan 4, 2020

    @tk0miya
    Member

    I just made a draft PR #6990 to realize this feature. Please check it if you have time :-)

  8. removed this from the 2.4.0 milestone on Jan 4, 2020
  9. 6 remaining items

  10. tk0miya commented on Mar 14, 2020

    @tk0miya
    Member

    Now I merged #6990. It allows you to decorate function signatures via CSS more flexibly. Could you try it please? I don't think it still does not cover the complex case like #5868. So we need to improve the output more.
    Thanks,

  11. timhoffm commented on May 3, 2020

    @timhoffm
    ContributorAuthor

    @tk0miya Thanks! This works for me.

  12. locked as resolved and limited conversation to collaborators on Jul 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    domains:pytype:enhancement

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions