Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jsdoc and IntelliSense does not work with imported modules with mjs extension #47037

Closed
henrik-jensen opened this issue Dec 6, 2021 · 5 comments

Comments

@henrik-jensen
Copy link

Does this issue occur when all extensions are disabled?: Yes

  • VS Code Version: 1.62.3
  • OS Version: Microsoft Windows [Version 10.0.19043.1348]

Steps to Reproduce:

  1. Create folder minimal with package.json, index.js and foo_module.mjs and paste the code given later in this post to the respective files, or download zipped examples at end of post.
  2. Hover the mouse over the add2 function in index.js for jsdoc popups and IntelliSense.

Result: Jsdoc and IntelliSense works with foo_module.js extension but not with foo_module.mjs extension.

Minimal working example (also attached at end of post)

package.json:

{ "type": "module" }

index.js:

import { add2 } from "./foo_module.mjs";
console.log(add2(5));

foo_module.mjs:

/**
 * Add 2 to input.
 * @param {number} input
 * @returns {number} - `input + 2`
 */
function add2(input) { return input+2; }
export {add2};

Results of hovering the mouse over add2:

  • using import { add2 } from "./foo_module.mjs"; - No Jsdoc or IntelliSense:
    • with_mjs
  • renaming to jsand using import { add2 } from "./foo_module.js"; - Jsdoc or IntelliSense works fine:
    • with_js

Note: both do output 7 as expected running the command $ node index.js.

Attached Minimal Working Examples:
minimal_mjs.zip using mjsextension
minimal_js.zip using jsextension

PS! Erroneously requested a reopen of typescript issue 27957 Support ".mjs" input files, thinking I was at the vscode repo, but maybe that issue is related?

@mjbvz mjbvz changed the title Jsdoc and IntelliSense does not work with imported modules with msj extension Jsdoc and IntelliSense does not work with imported modules with mjs extension Dec 6, 2021
@mjbvz mjbvz transferred this issue from microsoft/vscode Dec 6, 2021
@mjbvz mjbvz removed their assignment Dec 6, 2021
@mjbvz
Copy link
Contributor

mjbvz commented Dec 6, 2021

Does this reproduce in the latest VS Code insiders build too?

Not sure if #27957 is a duplicate or not but any fix would be in the insiders build

@henrik-jensen
Copy link
Author

henrik-jensen commented Dec 6, 2021

Does this reproduce in the latest VS Code insiders build too?

Not sure if #27957 is a duplicate or not but any fix would be in the insiders build

Whatta you know? - seems fixed in insider 1.63.0.
Just installed a portable version of insider and it worked for .mjs extension.
Did the #27957 typescript inclusion of .mjs fix this issue?!!! (for the beta/insider!)

@frank-dspeed
Copy link

frank-dspeed commented Dec 6, 2021

I do not expect this to be fixed before typescript-4.6 as the whole node12 nodenext support got scheduled to that version

#46452

@henrik-jensen
Copy link
Author

henrik-jensen commented Dec 7, 2021

Wait - is someone messing with my mind? - I'm pretty sure I opened this issue in the vscode repo and now it is back in the typescript repo?!!! What's happening? 🤨 😕🤪

@mjbvz
Copy link
Contributor

mjbvz commented Dec 7, 2021

Ok closing as likely fixed by TS 4.5 (which is included in current VS Code insiders builds)

I transferred the issue since this feature comes from TypeScript

@mjbvz mjbvz closed this as completed Dec 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants