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

Custom Typescript version for Yarn PNP Support - Visual Studio 2019 #42121

Closed
Hecatron opened this issue Dec 27, 2020 · 3 comments
Closed

Custom Typescript version for Yarn PNP Support - Visual Studio 2019 #42121

Hecatron opened this issue Dec 27, 2020 · 3 comments
Labels
Question An issue which isn't directly actionable in code Visual Studio Integration with Visual Studio

Comments

@Hecatron
Copy link

Suggestion

Hi,
So what I'm currently using at the moment is Visual Studio 2019.
I basically have an old webforms project and inside that a subdirectory of clientjs
this directory contains everything javascript related which inclues webpack, package.json, tsconfig.json
etc which all gets built via webpack (not the VStudio typescript compiler) to a javascript bundle in a subdir of wwwroot in the project.
So the javascript build is independent of MSBuild.

The problem I'm running into is getting the typescript intelisense to work.
This is due to the use of yarn's pnp system.
With yarn's pnp system it generates a .pnp.js file which acts sort of like a virtual node_modules directory
and maps back to zip files that can be located on a different or the same drive (a global cache on C: for example)

Normally the fix for this with "visual studio code" is to override the typescript bin setting "typescript.tsdk"
so that instead of the usual one it uses

  • .yarn\sdks\typescript\lib\
  • for the files tsc.js, tsserver.js, typescript.js

These act like a wrapper around the installed typescript installed via yarn's pnp system / package.json
to handle the virtual node_module directory via .pnp.js

What I've been trying to figure out is if there's an equivilent way of doing this with Visual Studio 2019
The closet I came was this thread

which suggests a global setting via CustomTSServerLocation in the registry

But what I'd like to see is if there's a way to specify this in the csproj file instead (unless there's already a hidden setting for it)
i.e. could this be included into a future version of Studio 2019?
This includes both pre .Net Core (.Net WebForms) and .Net core (.Net 5) project types

🔍 Search Terms

yarn, 2019

✅ Viability Checklist

My suggestion meets these guidelines:

  • [y] This wouldn't be a breaking change in existing TypeScript/JavaScript code
  • [y] This wouldn't change the runtime behavior of existing JavaScript code
  • [y] This could be implemented without emitting different JS based on the types of the expressions
  • [y] This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, new syntax sugar for JS, etc.)
  • [y] This feature would agree with the rest of TypeScript's Design Goals.

⭐ Suggestion

The ability to specify a custom typescript library at the .csproj level within Visual studio 2019

💻 Use Cases

The main motivation for this is that yarn's pnp package management system saves a lot of disk space vs the traditional npm node_modules approach due to it's way it handles the virtual node_modules directory via .pnp.js

@MartinJohns
Copy link
Contributor

Looks like a duplicate of #28289.

@Hecatron
Copy link
Author

In the case of 28289 that's looking into adding yarn2 support into the typescript compiler
For this I'm asking about something different in terms of specifying a wrapper for typescript within the Visual Studio 2019 IDE as a workaround instead. By specifying a different path for tsc.js, tsserver.js other than the normal one used.

@andrewbranch andrewbranch added External Relates to another program, environment, or user action which we cannot control. Question An issue which isn't directly actionable in code Visual Studio Integration with Visual Studio and removed External Relates to another program, environment, or user action which we cannot control. labels Dec 28, 2020
@typescript-bot
Copy link
Collaborator

This issue has been marked as 'Question' and has seen no recent activity. It has been automatically closed for house-keeping purposes. If you're still waiting on a response, questions are usually better suited to stackoverflow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Question An issue which isn't directly actionable in code Visual Studio Integration with Visual Studio
Projects
None yet
Development

No branches or pull requests

4 participants