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

Visual Studio, use latest tsc release #1110

Closed
jbondc opened this issue Nov 10, 2014 · 12 comments

Comments

@jbondc
Copy link
Contributor

commented Nov 10, 2014

How would I go about using the latest TypeScript with Visual Studio?

C:\Program Files\Microsoft SDKs\TypeScript\1.0\tsc.js

Or making a patch and testing the Visual Studio integration with a locally built TypeScript?

@mhegazy

This comment has been minimized.

Copy link

commented Nov 10, 2014

@jbondc do you want to use the latest tsc.js form master or latest public release (1.1)? and do you want to just build or you mean for the VS language service (like completion and quick info)?

@mhegazy mhegazy added the Question label Nov 10, 2014

@jedmao

This comment has been minimized.

Copy link
Contributor

commented Nov 10, 2014

Myself – I would love to use the latest tsc.js from master so I can report any issues as they come up.

@DanielRosenwasser

This comment has been minimized.

Copy link
Member

commented Nov 10, 2014

You can do it, but this is really at your own risk - we provide no guarantees if you do decide to try it out, but generally you should be fine. 😄

Using the Latest TypeScript Build in
Visual Studio

Replacing the Compiler

If you have the latest TypeScript bits for VS, you should have a directory like

C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.1
  1. Copy the file tsc.js in this directory to somewhere memorable as a backup (you can even keep it in this directory as tsc.bak.js).
  2. Clone our repo, check out the desired branch (you probably just want master). The directory you cloned to will from here on be called [TypeScript Repo].
  3. Run jake from [TypeScript Repo] in your shell.
  4. Copy [TypeScript Repo]\built\local\tsc.js to C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.1

Keep in mind that if you use localized messages, the compiler may fall back to using English for newer errors.

Replacing the Language Service

If you'd like to swap out the language service, the procedure is similar. You should have a directory like

C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\CommonExtensions\Microsoft\TypeScript
  1. Copy the file typescriptServices.js in this directory to somewhere memorable as a backup (you can even keep it in this directory as typescriptServices.bak.js).
  2. Clone our repo, check out the desired branch (you probably just want master). The directory you cloned to will from here on be called [TypeScript Repo].
  3. Run jake from [TypeScript Repo] in your shell.
  4. Copy [TypeScript Repo]\built\local\typescriptServices.js to C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\CommonExtensions\Microsoft\TypeScript.

Keep in mind this is less stable; if our services interface changes, the VS-specific bits might not be in sync and can fail hard. Still, it's usually reliable enough that I have a script called updateLS.ps1 to hot-swap the language service.

@jbondc

This comment has been minimized.

Copy link
Contributor Author

commented Nov 10, 2014

Ahh thanks @DanielRosenwasser.

@mhegazy I'm interested in both (compiling with latest tsc & using language services).

jake build
jake updateVisualStudio :)

Or the other way around, if I could configure the paths that Visual Studio points to
[TypeScript Repo]\built\local\tsc.js
[TypeScript Repo]\built\local\typescriptServices.js

I'm ok with things breaking, would make it easier to experiment with the language & test new features (union)

@DanielRosenwasser

This comment has been minimized.

Copy link
Member

commented Nov 11, 2014

Yes, @mhegazy did suggest this as an alternate option, and he would be more knowledgeable in doing something like this.

I'm not 100% certain, but I think that would only be possible for using the latest compiler in Visual Studio, not for the latest language service. Using the latest language service might require the same steps that I mentioned above.

@mhegazy

This comment has been minimized.

Copy link

commented Nov 12, 2014

i like the idea of making VS pick the latest form your local enlistments. it is not clear to me what is the best way to define these values.

@DickvdBrink

This comment has been minimized.

Copy link
Contributor

commented Nov 12, 2014

Maybe something like nightlies would also work for the language service (so a nightly for the VS plugin)?

@jbondc

This comment has been minimized.

Copy link
Contributor Author

commented Dec 2, 2014

I went with 'jake link-vs' and 'jake unlink-vs', seems to work with 1.4 and latest power build:
https://visualstudiogallery.msdn.microsoft.com/955e0262-0858-40c9-ab5a-1acc680e9bfd

@Arnavion

This comment has been minimized.

Copy link
Contributor

commented Dec 5, 2014

Hi @DanielRosenwasser , in the "Replacing the Language Service" part of your post, I think you meant to replace typescriptServices.js in step 4, not tsc.js. Could you fix that?

Also, can you add a step of copying over lib.d.ts to both parts as well?

@DanielRosenwasser

This comment has been minimized.

Copy link
Member

commented Dec 5, 2014

@Arnavion, sorry about that, but thanks for the tip! I've corrected it.

I'll document replacing your lib.d.ts so that you can get more up-to-date and/or accurate typings in the Visual Studio language service and compiler.

Using an alternative lib.d.ts in
Visual Studio

Like in the above post, there are two places you must update your lib.d.ts so that it will be consistent across both compilations and within the language services.

  • C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.1
  • C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\CommonExtensions\Microsoft\TypeScript
  1. In each of the above directories, there should be a lib.d.ts file. Within each directory, make a copy of that lib.d.ts called lib.bak.d.ts.
  2. Identify the alternative lib.d.ts you want to use in Visual Studio. Typically, you may want to grab the latest version from our repository. If this is the case, follow the following steps:
    • In the repository, there are two directories to choose from: bin/ and /src/lib. bin/ is usually stable, src/lib/ is typically newer. Pick one as your lib.d.ts.
  3. Copy your chosen lib.d.ts into both of the specified directories.

Note that you won't immediately see changes; you should probably just restart Visual Studio.

@DickvdBrink

This comment has been minimized.

Copy link
Contributor

commented Mar 12, 2015

@mhegazy

This comment has been minimized.

Copy link

commented Mar 12, 2015

yup your are right.. as always thanks @DickvdBrink :)

For future searches, here is the wiki for enabling the dev mode: https://github.com/Microsoft/TypeScript/wiki/Dev-Mode-in-Visual-Studio

@mhegazy mhegazy closed this Mar 12, 2015

@mhegazy mhegazy added the Fixed label Mar 12, 2015

@microsoft microsoft locked and limited conversation to collaborators Jun 18, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
6 participants
You can’t perform that action at this time.