You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Visual Studio: Hyperlink @see to referenced type #5802
// file A
module foo{exportinterfaceBar{}}// file B
module foofoo{/** Defines options for creating an instance of @see foo.Bar */exportinterfaceBarOptions{}}
it will be useful if the text referenced by @see (i.e. foo.Bar) is hyperlinked to interface Bar in file A.
We've just upgraded to version 4.1 RC and this issue is not fixed for namespaces as outlined above. The issue used the old syntax module for namespace but that shouldn't change anything.
Noel Abrahams (@NoelAbrahams) I'm pretty sure that JSDoc tags are only allowed at the beginning of the line. There are also inline tags like foo {@link Bar bar} baz but they require braces. A regular tag in the middle of sentence should just be interpreted as regular text.
You probably want to write it like
/** Creates an instance of {@link foo.bar} */interfacefoo{}
Niki (@phaux) thanks for looking that up. I looked up what appears to be the official documentation and there is no clear definition of whether @see should appear on a newline or not — although in the examples they've provided the tag does always appear on a newline.
The fault is in the specification, for lack of clarity, and implementers appear to have decided on not supporting inline @see.
Noel Abrahams (@NoelAbrahams) As you noted, jsdoc.app really only gives examples of one nested tag -- @link. The rest of them are always the first thing on a line.
TS mostly supports inline tags, but the implementation is quirky since it's best-effort, not really a committed feature. Specifically, an inline tag works if the line starts with a non-inline tag, or is a line following such a line:
/** @param foo @see foo.bar */
or
/** @param foo - a long description
* also @see foo.bar */
This is all down to the state machine we use for parsing, so it could be improved to also support
Nathan Shively-Sanders (@sandersn) Thanks for your PR, but it seems that currently the ts-sever in VS Code doesn't support references unless a comment is at the begin of a block / declaration sentence.
I tried such usages:
// this worksif(foo){/** satisfy {@link ConditionsIfFoo} */str=getBar()}// this doesn't workif(foo){/** satisfy {@link ConditionsIfFoo} */str=getBar()}// this doesn't workif(foo){}/** all the below won't satisfy {@link ConditionsIfFoo} */elseif(1){}elseif(2){}else{}
While highlighting works well for all the 3 cases.
Dahan Gong (@gdh1995) can you open a new issue? That's a missing feature that needs a detailed proposal. Currently jsdoc only works when attached to a declaration of some kind. The exceptions are @typedef and @callback, so @link could work like those. However, all 3 tags have complex scope rules, and we'd have to think about how those rules would need to change for @link.
Sorry I didn't know a hint would require so many details. I'm unable to give such a proposal, so let me forget it. I'll update my code to try to make tsserver happy.
Activity
holdfenytolvaj commentedon Feb 18, 2020
+1
NoelAbrahams commentedon Nov 5, 2020
Nathan Shively-Sanders (@sandersn) Wenlu Wang (@Kingwl)
We've just upgraded to version 4.1 RC and this issue is not fixed for namespaces as outlined above. The issue used the old syntax
modulefornamespacebut that shouldn't change anything.Please can you reopen? Thanks
Kingwl commentedon Nov 6, 2020
Doube check and It seems work.
NoelAbrahams commentedon Nov 6, 2020
Wenlu Wang (@Kingwl)
The
@seeonly works when it is on a separate line. For example,this does not work
But this works
I'm not sure whether you see this as a bug, but it's certainly surprising behaviour.
I'm using
Visual Studio Community 2019 Version 16.7.7
Typescript 4.1
Also # 2 you seem to have something that looks like Code Lens (the
0 references | 0 implementations. How do you enable that?Also # 3 I need to hold down the control key for the hyperlink to appear.
Thanks
phaux commentedon Nov 8, 2020
Noel Abrahams (@NoelAbrahams) I'm pretty sure that JSDoc tags are only allowed at the beginning of the line. There are also inline tags like
foo {@link Bar bar} bazbut they require braces. A regular tag in the middle of sentence should just be interpreted as regular text.You probably want to write it like
Typedoc already supports this syntax.
Edit: Even the Github code highlighting recognizes tags only at the beginning of the line or in braces.
NoelAbrahams commentedon Nov 9, 2020
Niki (@phaux) thanks for looking that up. I looked up what appears to be the official documentation and there is no clear definition of whether
@seeshould appear on a newline or not — although in the examples they've provided the tag does always appear on a newline.The fault is in the specification, for lack of clarity, and implementers appear to have decided on not supporting inline
@see.sandersn commentedon Nov 9, 2020
Noel Abrahams (@NoelAbrahams) As you noted, jsdoc.app really only gives examples of one nested tag --
@link. The rest of them are always the first thing on a line.TS mostly supports inline tags, but the implementation is quirky since it's best-effort, not really a committed feature. Specifically, an inline tag works if the line starts with a non-inline tag, or is a line following such a line:
or
This is all down to the state machine we use for parsing, so it could be improved to also support
gdh1995 commentedon Jul 13, 2022
Nathan Shively-Sanders (@sandersn) Thanks for your PR, but it seems that currently the ts-sever in VS Code doesn't support references unless a comment is at the begin of a block / declaration sentence.
I tried such usages:
While highlighting works well for all the 3 cases.
sandersn commentedon Jul 14, 2022
Dahan Gong (@gdh1995) can you open a new issue? That's a missing feature that needs a detailed proposal. Currently jsdoc only works when attached to a declaration of some kind. The exceptions are
@typedefand@callback, so@linkcould work like those. However, all 3 tags have complex scope rules, and we'd have to think about how those rules would need to change for@link.gdh1995 commentedon Jul 15, 2022
Sorry I didn't know a hint would require so many details. I'm unable to give such a proposal, so let me forget it. I'll update my code to try to make tsserver happy.