1

Given a file structure like this:

├── main.js
└── util
    └── stuff.js

And some contents like this:

// stuff.js
export function add(a, b) {
    return a + b;
}

// main.js
import * as maths from './util/stuff.js'

maths.add(1, 2)

When I attempt to use Go To Definition on the call to .add() in main.js, I am able to see the function signature as well as any types used in JSDoc for code completion and type checking. However, when I attempt to Go To Definition on it, I see the loading animation at the top of the window forever. Default exports seem to not have this problem.

I figured I'd see if this happens in an actual TypeScript project as well, but renaming the files to .ts makes Go To Definition work as expected. Is there something with the language server that prevents it from working when it is a .js file, despite already knowing about the JSDoc? For reference, here is the jsconfig.json I have right now:

{
    "compilerOptions": {
        "target": "es6",
        "module": "commonjs",
        "baseUrl": ".",
        "paths": {
            "@base/*": ["base/*"],
            "@test/*": ["test/*"]
        },
        "checkJs": true,
        "jsx": "preserve"
    },
    "exclude": ["node_modules", "**/node_modules"]
}

I have tried switching the module option to es2015 and esnext just to make sure it isn't that option causing problems.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.