question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

RFC: Syntax for "declaration references" (hyperlinks)

See original GitHub issue

Certain tags such as {@inheritdoc} contain references to other API items. AEDoc supports two notations for API item references:

  • For internal references, we use: exportName.memberName

    Example: {@inheritdoc BaseWidget.draw}

    The “.memberName” is optional and included e.g. if the API item is a member of a class or interface.

  • For external references, we use: @scopeName/packageName:exportName.memberName

    Example: {@inheritdoc @microsoft/widget-lib:BaseWidget.draw}

    The “@scopeName/” and “.memberName” are optional. The “@scopeName/” is used for scoped NPM packages.

This might be a reasonable starting point. However, it doesn’t consider nesting members such as namespaces (which has turned out to be surprisingly common for legacy SDKs, despite all the downsides and attempts to deprecate them).

Also, AEDoc today overlooks an interesting edge case:

export class A {
    public b: string = 'hello';
}

export namespace A {
    export let b: number = 123;
}

let a = new A();

// a.b is a string
// A.b is a number

In this example, an expression such as {@link A.b} would be ambiguous. Which declaration is it referring to? How to handle this?

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:9
  • Comments:55 (10 by maintainers)

github_iconTop GitHub Comments

3reactions
DaSchTourcommented, Sep 24, 2018

I like option 2 because it looks like URL hashtag. Like an anchorlink it points to a section of a bigger package/file.

2reactions
RA80533commented, Sep 1, 2020

Will the upcoming private fields readily follow such syntax?

  • Container.#id (private static)
  • Container##id (private instance)

Per sec. 4 of the proposal:

This proposal allows both abbreviated references to private state (#x) which have an implicit this as the receiver, as well as explicit receivers (obj.#x). The implicit receiver form is intended for better ergonomics for the common case, and the explicit receiver form allows the full generality of “class-private” (as opposed to “instance-private”).

Read more comments on GitHub >

github_iconTop Results From Across the Web

RFC 1866 Hypertext Markup Language - IETF
syntax -reference character set A coded character set whose range includes all characters used for markup; e.g. name characters and delimiter characters. tag ......
Read more >
HTML 3.2 Reference Specification - W3C
This specification defines the intended interpretation of HTML 3.2 elements, and places further constraints on the permitted syntax which are ...
Read more >
KML Reference | Keyhole Markup Language
Each reference entry includes a Syntax section that lists the elements ... Declaring new typed fields using the <Schema> element and then instancing...
Read more >
PHP RFC: Lexical Scope Support for Anonymous Classes
Proposal. We allow anonymous classes to import variables into their property table using the familiar syntax. The following syntax is used: new ...
Read more >
IETF RFC Citation List for OASIS Editors Version 1.0
To cite to a specific RFC, simply locate it in this file (Cntr-f in your browser) and copy and paste it into the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found