Making "Go to definition" go to the source in VS Code
I was really frustrated when using <cmd>+<click>
in Visual Studio Code was
jumping to the TypeScript definition instead of the source definition since the
TypeScript definition isn't very useful to me and I don't even use TypeScript. I
found this and many related issues:
But unfortunately I couldn't find a solution in any of the issues and the
moderator bot had closed and locked all of them. Luckily one of the issues sent
me down a rabbit hole where I eventually found the setting
typescript.disableAutomaticTypeAcquisition
. Setting that to false
(or
checking it in the UI) and running rm node_modules && yarn
fixed the issue. I
presume this means that VS Code is no longer automatically downloading
TypeScript definitions to my node_modules
and so when you "Go to definition"
it goes to the source file instead of the TypeScript definition. It's both
frustrating and understandable that this was the default behavior to begin with,
but I'm just happy that it now works as I expect it to.