Skip to content

Go to definition fails when maxNodeModuleJsDepth = 0 #15717

Closed

Description

@mjbvz

From Sami Turcotte (@Wenzil) on May 9, 2017 17:14

  • VSCode Version: 1.12.1
  • OS Version: OS X

Steps to Reproduce:

  1. Open VS Code in a new workspace
  2. npm init -y
  3. npm install --save express
  4. In tsconfig.json:
{
    "compilerOptions": {
        "target": "es6",
        "module": "commonjs",
        "allowJs": true,
        "checkJs": true,
        "noEmit": true,
        "maxNodeModuleJsDepth": 0
    },
    "exclude": [
        "node_modules"
    ]
}
  1. In index.js:
const express = require('express')
  1. Right click on 'express', and choose Go to definition

Expected behaviour:

The editor navigates to the .js file containing the module implementation (under node_modules/express)

Actual behaviour:

The editor says

No definition found for 'express'

Copied from original issue: microsoft/vscode#26329

Activity

  1. removed their assignment
    on May 10, 2017
  2. mjbvz commented on May 10, 2017

    @mjbvz
    ContributorAuthor

    Since maxNodeModuleJsDepth is zero, I believe the failure to find express is expected. Can someone on the TS team please verify this

  3. mhegazy commented on May 10, 2017

    @mhegazy
    Contributor

    This is correct. the issue here is that ATA should kick in and download the .d.ts for you. with that goto def will go to the .d.ts.

    The issue here is you are using a tsconfig.json and not a jsconfig.json, and that changes the defaults for ATA.

    So to enable ATA, in the tsconfig.json add:

        "typeAcquisition": {
            "enable": true
        }

    Alternatively, npm install -D @types/express

  4. added
    Working as Intended
    on May 10, 2017
  5. mhegazy commented on May 24, 2017

    @mhegazy
    Contributor

    Automatically closing this issue for housekeeping purposes. The issue labels indicate that it is unactionable at the moment or has already been addressed.

  6. locked and limited conversation to collaborators on Jun 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Working as Intended

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions