Improve role slices in names

masklinn avatarmasklinn created an issue

In languages such as Javascript or C++, namespaces can get fairly deeply nested.

In this case, the ~ slice becomes nice (e.g. :ref:`` only displays quux() in the document), but this incurs a loss in readability if it slices into a separate class: the document author probably does not want the fully qualified namespace (for verbosity reasons), but having more than just the method name would be nice, for instance to have the class name as well.

I propose that the ~ syntax be extended with an index, which would give the (maximum) number of items displayed from the end: ~2 would display the last two items of the chain instead of only the last one.

With the dotted path above, you would get:
        outputs quux()
        outputs quux()
        outputs Qux.quux()
        outputs baz.Qux.quux()
        outputs bar.baz.Qux.quux()

Comments (1)

  1. Log in to comment
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.