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

Typings automatically installed in javascript project #800

Closed
bampakoa opened this issue Mar 31, 2016 · 10 comments
Closed

Typings automatically installed in javascript project #800

bampakoa opened this issue Mar 31, 2016 · 10 comments

Comments

@bampakoa
Copy link

I have recently upgraded to NTVS 1.2 Alpha in Visual Studio 2015 Enterprise (with Update 1) and when I re-opened my javascript project, typings were installed automatically. It actually created the typings.json file and the typings directory. Is this the expected behavior for javascript project?

@kant2002
Copy link
Contributor

Typings project not yet supported, see #768, only TSD.

@bampakoa
Copy link
Author

Since it is not supported, why are the json file and the directory created automatically?

@NoelAbrahams
Copy link

There is a bug here. When a project contains a folder called typings, every time the project is rebuilt, the .d.ts files in that folder are automatically included in the project file.

To reproduce

  • Open up the project in the attached zip file.
  • Right-click on the project and _rebuild_.
  • Unload and edit the project and observer the multiple copies of myTypes.d.ts.

Some observations

  • This only affects .d.ts files. The file bar.ts is not duplicated.
  • Only files in the typings folder are affected. The file foo.d.ts in folder typings2 is not duplicated.
  • A new copy is added after every rebuild.

Unfortunately, this means we cannot test out this release as source control is going to get mucked up.

NodejsConsoleApp1.zip

Incidentally, I do not really wish to have anything added automatically to my Visual Studio project. So if such a feature is planned it should be off by default and enabled via settings.

@mjbvz
Copy link
Contributor

mjbvz commented Mar 31, 2016

Thanks for the report.

The creation of the typings directory is the expected behavior in the most recent NTVS 1.2 Alpha on VS 2015. These files are created by TSD and are used to improve the Intellisense experience for JavaScript.

Why Are the Typings Downloaded?
In the most recent alpha, “ES6 Preview Intellisense” now uses the Salsa language service instead of our homegrown JavaScript analyzer. This change was made in order to address a number of performance issues and get us on a more well supported tooling that will continue to improve going forward.

Salsa uses typings definitions (*.d.ts files) to improve its Javascript Intellisense, so the NTVS alpha attempts to automatically download *.d.ts files for all Node packages in the current project using TSD. That is why the typings and tsd.json files are created. Having these typings files allows us to offer better Intellisense for many popular Node packages, such as Express.

Why Are they Included in Projects?
VS 2015, the *.d.ts files have to be included the Visual Studio project in order for them to actually be picked up by Salsa. We know that automatically adding files to your project is not a good experience, but the alternative is a significantly worse Intellisense.

You can add both the typings directory and tsd.json to your .gitignore to exclude them from source control, but they have to stay in the Visual Studio solution. They are only required by the tooling and will be recreated by NTVS if they are missing.

Visual Studio Code has a similar experience currently.

What Are We Doing to Make This Better?
Unfortunately, there’s not much we can do to improve this in Visual Studio 2015. The typings files have to be included in the solution for Intellisense to function properly.

In VS “15”, this hack is not required.

Expected Behavior
I hope this clarifies why the typings files are created.

Just to be clear, the typings should only be downloaded if all of the following are true:

  • You are using the NTVS 1.2 Alpha.
  • You are on VS 2015 (not VS “15”)
  • You have a Javascript project (not Typescript)
  • Intellisense level is set to “ES6 Preview”.

You can also disable automatic type acquisition in the alpha by using one of the other Intellisense levels.

Please open issues to track behavior that seems to differ from the expected experience. Also, this feature is experimental, so we're always looking for ways to improve things and greatly appreciate feedback like this.

@mjbvz mjbvz closed this as completed Mar 31, 2016
@mjbvz
Copy link
Contributor

mjbvz commented Mar 31, 2016

@NoelAbrahams This looks like it may be a separate bug. Can you please open another issue to track this so that this thread does not get too cluttered up? Thanks.

@bampakoa
Copy link
Author

bampakoa commented Apr 1, 2016

@mjbvz I have changed the Intellisense level to Full IntelliSense and deleted both typing dir and tsd.json but when I open the project, they are created again.Please note that I have updated VS2015 to Update 2.

@mjbvz
Copy link
Contributor

mjbvz commented Apr 1, 2016

Thanks. Yes, it looks like there is a bug here with the gating. I've opened #813 to track that and should have the PR out shortly.

@nonoroazoro
Copy link

nonoroazoro commented May 3, 2016

I'd rather shut down the"ES6 IntelliSense" right now than adding lots of rubbish to my project.

Oops, failed...they are faster than rabbit.

@richarddowner
Copy link

typings folders still created automatically on project load... how to turn it off?

@mjbvz
Copy link
Contributor

mjbvz commented Aug 10, 2016

@richarddowner On NTVS 1.2 Tools -> Options then Text Editor -> Node.js -> IntelliSense. Disable the checkbox for automatically downloading typings.

Note that disabling automatic typings acquisition will result in a degraded intellisense experience.

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

No branches or pull requests

6 participants