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.

Add JSDOC @module support for intellisense.

See original GitHub issue

Search Terms

Intellisense jsdoc support for modules

Suggestion

When adding /** @module moduleName Module Description. */ to a module, then doing this:

import * as myName from "./moduleName";

I think it makes sense, when importing the whole namespace, to include the jsdoc @module comment.

I also think that when pressing Ctrl+Space for code completion on "./" (to get a list of modules) should also show the module documentation.

Use Cases

Better support for module documentation. I’m developing some module libraries and it would be great to give end users a good experience with better intellisense documentation.

Examples

aModule.ts

`/** @module aModule Does something awesome. */`

app.ts

import * as aModule from "./aModule";
// (moduleName should both have the doc details)
// ("./{*.*}" - all files in code completion should show the documentation as well)

Checklist

My suggestion meets these guidelines:

  • This wouldn’t be a breaking change in existing TypeScript/JavaScript code
  • This wouldn’t change the runtime behavior of existing JavaScript code
  • This could be implemented without emitting different JS based on the types of the expressions
  • This isn’t a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, etc.)
  • This feature would agree with the rest of TypeScript’s Design Goals.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:3
  • Comments:6

github_iconTop GitHub Comments

4reactions
borekbcommented, Jul 28, 2019

Also, quite annoyingly, the module doc comment is shown for the first member:

Screenshot 2019-07-28 at 15 19 33

Playground link

0reactions
tysonrmcommented, May 8, 2022

connect-stream.js

    /**
     * @param {import('stream').Readable} in 
     * @param {import('stream').Writable} out
     */
    export async function connectStream(in, out) {
      in.pipe(out)
    }

detect-fighting.js

    /**
     * @param {import('stream').Readable} lidar 
     * @param {import('stream').Writable}  infer
     * @param {import('./connect-stream').connectStream} cb
     */
    async function detectFighting(lidar, infer, cb) {
      cb ( 
          lidar.getReadableStream('camera10'), 
          infer.getWritableStream('fighting')
       )
    }

The jsdoc of the 3rd param in detect-fighting.js is not supported. You can write @callback but, again, the point is to avoid having to do that and having to keep it in sync with the actual function.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Utilise JSDoc comment tags so that VSCode intellisense ...
How to utilise JSDoc comment tags so that Visual Studio Code intellisense works great. JSDoc is the standard for commenting in JavaScript code....
Read more >
JSDoc: How do I let IntelliSense/TypeScript know about ...
I'm working on a relatively large project, and I want to add JSDoc to my classes and files to ...
Read more >
Working with JavaScript in Visual Studio Code
Our JavaScript IntelliSense is powered by the JavaScript language service developed ... This document describes the JSDoc annotations currently supported.
Read more >
How to use JsDoc annotations with VsCode for intellisense
VSCode has excellent support for many programming languages and if you do not like using products that are managed by Microsoft then you ......
Read more >
JavaScript IntelliSense - Visual Studio (Windows)
IntelliSense based on JSDoc ... As mentioned, function parameters are never inferred. However, using the JSDoc @param tag you can add types to ......
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