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

"Go to definition" not working with declarationMap and projects references #25662

Closed
OliverJAsh opened this issue Jul 14, 2018 · 11 comments
Closed
Assignees
Labels
Bug A bug in TypeScript

Comments

@OliverJAsh
Copy link
Contributor

OliverJAsh commented Jul 14, 2018

TypeScript Version: 3.0.0-rc

Search Terms:

Code

Full reproduction case

src
├── client
│   ├── main.ts
│   └── tsconfig.json
└── shared
    ├── main.ts
    └── tsconfig.json
// src/client/main.ts
import { foo } from '../shared/main';

console.log({ foo })
// src/client/tsconfig.json
{
    "compilerOptions": {
        // Needed for project references.
        "composite": true,
        "declaration": true,

        // Other options...
        "outDir": "../../lib/client",
        "strict": true, "module": "esnext", "moduleResolution": "node",
    },
    "references": [
        { "path": "../shared" }
    ]
}
// src/shared/main.ts
export const foo = 1;
// src/shared/tsconfig.json
{
    "compilerOptions": {
        // Needed for project references.
        "composite": true,
        "declaration": true,
        "declarationMap": true,

        // Other options...
        "outDir": "../../lib/shared",
        "strict": true, "module": "esnext", "moduleResolution": "node",
    }
}
  • Run tsc --build ./src/client/
  • Configure VSCode TypeScript version to use workspace, and reload VSCode

Expected behavior:
"Go to definition" should work for foo identifier in src/client/main.ts.

Actual behavior:
"Go to definition" does not work for foo identifier in src/client/main.ts.

image

@weswigham
Copy link
Member

Having looked at the other issue, I think this is a dupe of #25792 - or rather, #25792 is a dupe of this, but I looked into #25792 first. 😛 In any case, I should have a fix promptly.

@OliverJAsh
Copy link
Contributor Author

@weswigham I just tested this with 3.0.1 and I can still reproduce. Any ideas? Can we re-open?

@mhegazy
Copy link
Contributor

mhegazy commented Aug 2, 2018

@weswigham can you take a look.

@AnyhowStep
Copy link
Contributor

AnyhowStep commented Aug 8, 2018

On 3.0.1, have this issue, too.

Code checks, compiles, runs, etc. just "Go to definition" not working.

@OliverJAsh
Copy link
Contributor Author

Can we re-open this issue whilst it is investigated again?

@Soul-Master
Copy link

I just tried declarationMap option in TypeScript 3.0.1. But it doesn't work both in VS 2017 15.8.0 Preview 5.0/VS Code 1.26.0

https://github.com/Soul-Master/typescript3-composite-project/tree/declarationMap

In VS Code 1.26.0

image

image

In VS 2017 15.8.0 Preview 5.0

image

image

@OliverJAsh
Copy link
Contributor Author

@weswigham This is not fixed. Just tested with TS 3.0.3.

Full repro: https://github.com/OliverJAsh/typescript-3-client-server-shared

@OliverJAsh
Copy link
Contributor Author

Please can we re-open this issue? /cc @weswigham @mhegazy

(Sorry to pester here but I think this needs attention, as it's a very basic use case.)

@weswigham weswigham removed this from the TypeScript 3.0.1 milestone Oct 11, 2018
@weswigham weswigham added Needs Investigation This issue needs a team member to investigate its status. and removed Fixed A PR has been merged for this issue labels Oct 11, 2018
@weswigham weswigham reopened this Oct 11, 2018
@rbuckton rbuckton added this to the TypeScript 3.3 milestone Dec 14, 2018
@sgronblo
Copy link

Is there any way to help figuring this out. I have declarationMap working in a small toy project that I created to learn about how to setup a monorepo with project references.

However, in our actual project repo when I use "Go To Definition" I get sent to the FILENAME.d.ts file of the referenced project. Even though I have a FILENAME.d.ts.map right next to it.

I tried setting TypeScript > TsServer:Log to verbose. And then tail the log file when I go to the definition. But nothing interesting shows up in the log file. I can't figure out if TS thought it wasn't supposed to look for a map file, if it looked but couldn't find, or if it found something but it wasn't valid.

@RyanCavanaugh RyanCavanaugh removed the Needs Investigation This issue needs a team member to investigate its status. label Mar 7, 2019
@weswigham
Copy link
Member

@OliverJAsh your repro seems to be fixed in the latest versions of TS (I'm pretty sure we've had a continuous stream of improvements to this area since 3.0).

@OliverJAsh
Copy link
Contributor Author

Just tested, it works! Thanks 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript
Projects
None yet
Development

No branches or pull requests

8 participants