microsoft / microsoft/TypeScript

JSDoc support for @memberof and @namespace

Open
#36,176 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Awaiting More Feedback Domain: JSDoc Suggestion
Dominant language
Go
Stars
111k
Forks
14.3k
Avg merge
2d 4h
Merged PRs (30d)
132

Description

I work on a NodeJS Javascript codebase which uses plain JSDoc (i.e. no Typescript/Closure specific syntax). It uses require() rather than ES6/Typescript-style imports.

Our codebase has JDoc'ed code which lives under arbitrary @namespace declarations, meaning they do not correspond to actual code 'namespaces'. For example our code is JSDoc'ed as @namespace utilities but the module may be imported as utils.

My colleagues using Webstorm get the full JSDoc annotations/code completion/tooling but VSCode Intellisense does not recognised references like models.Account for e.g. parameters as shown below ...

// models.js

/** @namespace models */

/** @memberof models */
class Account {
  // ...
}

module.exports = { Account }
// main.js
const { Account } = require('./models')

/**
 * @return {models.Account}
 */
myMethod (account) => {
  return new Account()
}

Since basically the entire codebase is namespaced, I get reduced Intellisense support for my custom code and no support for writing correct JSDocs.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the models.js and main.js examples, then trace how VSCode IntelliSense resolves JSDoc references such as models.Account for require()-based JavaScript. Done means @namespace and @memberof declarations work with arbitrary namespace names and provide the requested reference and completion support.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.