Provide way to link to other files from JSDoc comments
See original GitHub issueSuggestion
š Search Terms
- quickInfo
- markdown
- link
- relative path
- jsdoc
ā Suggestion
On VS Code, we have a long standing feature request to support relative file paths inside JSDoc comments: https://github.com/microsoft/vscode/issues/86564
For example, if if I have a file folder/foo.ts
:
/**
* [link](./other.js)
*/
export declare function foo(x: string, y: {}): void
Then anywhere the documentation for foo
is shown, we should render link
as a clickable link to folder/other.ts
.
On the VS Code side today, we can support rendering link
but do not know what relative paths inside the documentation should be relative to
Proposal
To fix this, I propose that requests that return documentation also include a path that tells us which file the documentation comes from
Hereās an example using quickInfo
:
[Trace - 17:11:37.514] <semantic> Response received: quickinfo (292). Request took 2 ms. Success: true
Result: {
"kind": "function",
"kindModifiers": "export,declare",
"start": { "line": 4, "offset": 25 },
"end": { "line": 4, "offset": 28 },
"displayString": "function foo(x: string, y: {}): void",
"documentation": [
{
"text": "[link](./files.js)",
"kind": "text",
// new field
"file": "/absolute/path/to/folder/foo.ts"
}
],
"tags": []
}
This would likely be a new field on SymbolDisplayPart
Issue Analytics
- State:
- Created 2 years ago
- Reactions:28
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Use JSDoc: {@link}
Link to another item in the documentation. ... The following example shows all of the ways to provide link text for the {@link}...
Read more >VS Code tips ā Linking to a symbol in JSDoc ... - YouTube
link tags in JSDoc comments let you link to other symbols in your JavaScript or TypeScript project.These links show in hovers, suggestions,Ā ...
Read more >javascript - Is it possible to tell jsdoc to look in a file separate ...
The key is to create a type definition with a unique name, and then use @see to link to that definition. @module and...
Read more >JSDoc Reference - TypeScript: Documentation
Documentation tags work in both TypeScript and JavaScript. @deprecated; @see; @link. Other. @enumĀ ...
Read more >JSDoc comments | WebStorm Documentation - JetBrains
WebStorm recognizes JSDoc comments and helps you create them by automatically inserting @param , @returns , @private , and other tags whenĀ ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Not a huge fan of my original proposal actually
Instead of markdown, I think we should investigate adding proper file link support to JSDoc. As far as I can tell this isnāt supported in the jsdoc spec
Hereās what this could look like using our existing
@link
support:Or we could come up with some new way to express file links:
Having proper semantic file link support would be nice as we could include these references when you run
find all reference to file
and update them when you move a fileFrom what I understand, you guys are saying that this is blocking https://github.com/microsoft/vscode/issues/86564.
Are there any updates on this? Would love to be able to link files, be it JS, or any file really.
code
CLI?{@linkfile ../../x/y/z.js:42}
.
, (ii) root or (iii) protocol?{@linkfile my-module/x/y/z.js:42}
instead of{@linkfile ../../../node_modules/my-module/x/y/z.js:42}
?