microsoft / TypeScript

TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
https://www.typescriptlang.org
Apache License 2.0
100.77k stars 12.46k forks source link

Intellisense stops working after a @type/* gets imported #10669

Closed kataik closed 7 years ago

kataik commented 8 years ago

TypeScript Version: nightly (2.0.0-dev.201xxxxx)

Code

"use strict";

import * as del from "del";

console.log("hello world");

Expected behavior: Intellisense works

Actual behavior: Intellisense does not work

Configuration: Win10, Visual Studio 2015 update 3, Web Core RC2 over .NET Framework 4.6.1, gulp tasks (don't know if related)

I suspect this is related somehow to the process of parsing through type definitions and gets broken as soon as a type definition gets parsed. I've just created a plain Web Core RC2 and did the followings:

  1. created a typescript file at the root of the project called gulpfile.ts
  2. typed in console.log("hello world");, Intellisense worked
  3. downloaded type definition for gulp using npm i -D @types/gulp
  4. deleted the statement and retyped it again in the source file, Intellisense worked
  5. imported gulp into the source file using import * as gulp from "gulp";
  6. deleted the statement and retyped it again in the source file, Intellisense did not work
  7. removed the import, Intellisense still did not work
  8. removed the typing from package.json, Intellisense still did not work
  9. removed the typing from _nodemodules, Intellisense works again

I did the same with various other packages, like del.js, node.js, the behavior was the same.

This issue is probably related.

mhegazy commented 8 years ago

What version of TS are you using? I can not get this to reproduce using your steps on VS 2015 Update 3 + TypeScript 2.0 RC

kataik commented 8 years ago

@mhegazy Hi, more detailed configuration: typescript: 2.0.2 ts-node: 1.3.0 node: 4.5.0 npm: 2.15.9 .net fw: 4.6.01055 visual studio: Enterprise 2015 v14.0.25425.01 Update 3

If you'd like me to share the sandbox solution, just let me know!

kataik commented 8 years ago

@mhegazy Additional information (don't really get why I didn't check this before): the output window for IntelliSense shows a bunch of failure messages, one line for each of the type definition files, for example:

[Failure] Could not find a part of the path 'C:\Work\Dev\T_CoreWebRc2\src\T_CoreWebRc2\node_modules\@types\gulp-concat\index.d.ts'.

All the paths displayed here are valid, like:

file.png

mhegazy commented 8 years ago

If you'd like me to share the sandbox solution, just let me know!

yes please.

HJoost commented 8 years ago

Hi, I also had the problem that intellisense for TS in VS2015U3 did stop working. Now I deinstalled it completely (also all programms related to it) and reinstalled it (I did not install Typescript Tools for Visual Studio!!!, it's automatically installed in V 1.7.4. and did not update it!!!). I also tried only running the uninstaller from VS and Typescript Tools, reinstalled VS and TT for 2.0.2., this did not work. I hope I could help a bit. Typescript got installed over NPM in V2.0.2.

mhegazy commented 8 years ago

@HJoost a repro project would be appreciated.

mhegazy commented 8 years ago

any news?

ZenSoftware commented 7 years ago

Edit 2: Typescript VS Extension: 2.0.6 broke VS Intellisense for me when upgrading from Typescript VS Extension: 2.0.3. I have discovered that clearing and rebuilding the MEF Component Cache fixes Intellisense for my Visual Studio Enterprise 2015. I simply used the VS extension: Clear MEF Component Cache

For more information, refer to issue: #11873 - TypeScript 2.0.6 VS Extension Breaks Intellisense

Old post - Not relevant - Please ignore @mhegazy My VS Intellisense for typescript has broken after moving from Typescript 1.8 to the @types method introduced in Typescript 2.0. For example, using the Angular 2 - Quickstart project that has recently updated their project to utilize the npm @types/ method of including typings. This project breaks my VS Intellisense. I suppose it is related to @kataik problem above.

My setup: Visual Studio Enterprise 2015: 14.0.25431.01 Update 3 Typescript VS Extension: 2.0.6 (edit: Intellisense works fine with 2.0.3 .NET FM: 4.6.0.1586 Node: v6.7.0 (VS configured to use node from 'External Tools' options from C:\Program Files\nodejs)

mhegazy commented 7 years ago

@ZenSoftware is this related to https://github.com/Microsoft/TypeScript/issues/11873, or is this a different issue?

ZenSoftware commented 7 years ago

@mhegazy I'm not sure. I put in a second edit on my original post here to clarify if anyone comes across it. My issue was resolved in #11873. But if I may speculate, maybe their issues were resolved after their MEF Component Cache cleared and rebuilt itself at some point in time? It would be nice to hear from them if they got Intellisense working again. It may help explain what is going on.

@kataik @HJoost