microsoft / TypeScript

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

IntelliSense typing info in 2.9.0-dev.20180407 release doesn't work #23255

Closed RonanQuigley closed 5 years ago

RonanQuigley commented 6 years ago

TypeScript Version: 2.9.0-dev.20180407

Search Terms: intellisense, missing types

Perhaps I'm missing something here, as I don't use typescript and have always just used the version that vscode ships with for intellisense, but after updating to the latest for a fix of a prev issue I posted about (see bottom) I now have the following issue.

See the following gifs for an explanation:

Expected behavior:

This is what happens in version 2.8.1. It also successfully recognises the type definitions file.

typescript-2-8-1

Actual behavior:

This is currently what happens in the 2.9.0-dev version. The type definitions file is not found.

typescript-2-9-0

Furthermore it happens with any module e.g this is the react one. Note that it works initially then just fails afterwards:

starts-and-stops

Workaround:

I can get it to work again by manually installing each of the types i.e @types/chai etc. However that's not ideal so I've reverted back to 2.8.1 for the time being.

Related Issues:

I brought up an issue with intellisense crashing in 2.8.1, but am unsure if this is a side effect from that or just another issue entirely. So whilst the path issues are fixed in 2.9, the outlined issue above now shows up.

https://github.com/Microsoft/TypeScript/issues/23234

I can provide the typescript log in private if need be.

RonanQuigley commented 6 years ago

So I tried going back through previous typescript versions, and have found that the 2.4.2 release does not have either the problem outlined above, or the issue I posted about in #23234 So until this issue is resolved, I'll just stick to that version.

sheetalkamat commented 6 years ago

Can you please provide tsserver and typing installer logs. Also your package.json, Also let us know if you have explicitly installed any modules and typings. Thanks.

mkvlrn commented 6 years ago

I've started having intellisense issues in February's 1.21 update. Ever since it's been failing after a while, but 1.22 completely broke it. It just doesn't work, and reverting back to typescript 2.81 or 2.4.2 doesn't work either.

What worked for me was actually installing January's 1.20.1 vscode. It comes with typescript 2.8.1, and it works fine. I didn't even try any other typescript versions because I was afraid it would break things again.

So maybe it's not only on typescript, since 2.8.1 works fine with vscode 1.20.1: intellisense is smooth as it always been.

I have absolutely no use for typescript, I don't use it at all, so having a version that just makes vscode intellisense work is fine by me, whatever version that is.

RonanQuigley commented 6 years ago

relevant package.json bits:

{
  "dependencies": {
    "chai": "^4.1.2",
    "chokidar": "^2.0.2",
    "clean-webpack-plugin": "^0.1.19",
    "colors": "^1.2.1",
    "express": "^4.16.3",
    "handlebars": "^4.0.11",
    "morgan": "^1.9.0",
    "nock": "^9.2.3",
    "npm-run-all": "^4.1.2",
    "opn": "^5.3.0",
    "query-string": "^6.0.0",
    "react": "^16.2.0",
    "react-dom": "^16.2.0",
    "react-hot-loader": "^4.0.0",
    "request-promise-native": "^1.0.5",
    "sinon": "^4.4.8",
    "sinon-chai": "^3.0.0",
    "source-map-support": "^0.5.4",
    "typescript": "^2.9.0-dev.20180410",
    "webpack": "^4.2.0",
    "webpack-cli": "^2.0.13",
    "webpack-dev-middleware": "^3.0.1",
    "webpack-hot-middleware": "^2.21.2",
    "webpack-merge": "^4.1.2",
    "webpack-node-externals": "^1.6.0"
  },
  "devDependencies": {
    "@babel/cli": "^7.0.0-beta.42",
    "@babel/core": "7.0.0-beta.44",
    "@babel/node": "7.0.0-beta.44",
    "@babel/plugin-proposal-class-properties": "7.0.0-beta.44",
    "@babel/plugin-transform-runtime": "7.0.0-beta.44",
    "@babel/preset-env": "7.0.0-beta.44",
    "@babel/preset-react": "7.0.0-beta.44",
    "@babel/preset-stage-0": "7.0.0-beta.44",
    "@babel/register": "7.0.0-beta.44",
    "@babel/runtime": "7.0.0-beta.44",
    "babel-loader": "^8.0.0-beta.0",
    "cross-env": "^5.1.4",
    "dotenv": "^5.0.1",
    "dotenv-webpack": "^1.5.5",
    "eslint": "^4.19.1",
    "eslint-config-prettier": "^2.9.0",
    "eslint-loader": "^2.0.0",
    "eslint-plugin-mocha": "^5.0.0",
    "eslint-plugin-prettier": "^2.6.0",
    "eslint-plugin-react": "^7.7.0",
    "eslint-watch": "^3.1.4",
    "handlebars-loader": "^1.7.0",
    "mocha": "^5.0.4",
    "mocha-webpack": "^2.0.0-beta.0",
    "node-mocks-http": "^1.5.8",
    "prettier": "^1.11.1",
    "request": "^2.85.0",
    "sinon-test": "^2.1.3",
    "supertest": "^3.0.0",
    "webpack-bundle-analyzer": "^2.11.1",
    "webpack-hot-server-middleware": "^0.5.0"
  },
}

@sheetalkamat I'm not sure what you mean by typing installer logs; can you be more specific? Either way, I've just uploaded both of the files that showed up in the tsserver log folder:

ti-6468.log

tsserver.log

As for explicitly setting typings, if I'm understanding you correctly, no I haven't. I did get it to work though by manually installing them from npm. Curiously a lot of typings are missing from the 2.9 installation:

gif

RonanQuigley commented 6 years ago

Oops, sorry for the accidental close.

Just to add, note I'm using 2.9.0-dev.20180410 now from typescript@next, but the issue is still there. I can put together a repo again if need be, but the repo from the other issue I posted would suffice for testing it.

RonanQuigley commented 6 years ago

Hi @sheetalkamat, is there any update on this issue?

sheetalkamat commented 6 years ago

Seems like typing installer is failing and resulting in no npm packages for the types and hence no intellisense. From the shared ti log it looks like package for @types/chokidar doesnt have 2.9 version which results in failure to install any package. @andy-ms is looking into why there is no 2.9 version on that package.

RonanQuigley commented 6 years ago

Sounds good. Let me know if I can provide a repo if it helps tracking the issue down.

sheetalkamat commented 6 years ago

@RonanQuigley Repro code would be great help to ensure that this is fixed correctly and also investigate if there are any other perf tweaks possible.

RonanQuigley commented 6 years ago

Sorry for the delay in getting back.

So I now can't get the issue to consistently repro. Have been fiddling with it for about 30 mins and has happened three times in that time, but all of the steps that caused it were completely unrelated and random. The only constant is it happens after a period of time about 5 minutes.

I've tried to reduce my repo from the prev issue I posted down to a minimal size, but I've chosen to keep it as is (bar updated to typescript 2.9) as the issue could be tied to project size. I did reduce it to a couple of files but it never happened in that case. I can appreciate this won't be ideal for tracking down the issue, so if you're unable to repro with this I'll understand.

https://github.com/RonanQuigley/vscode-intellisense-bug

As an aside, why is it that the code completion does not work in the following scenario:

intellisense

Here I've declared a variable at the top, set it to a value inside a function, then attempt to use auto completion further down the file but it comes back blank?

ghost commented 6 years ago

@RonanQuigley I believe that situation is basically:

let x;

function f() {
    x = 0;
    x.toExponential(); // Get completions for number
}

function g() {
    x. // Get no completions
}

The things is that immediately after the x = 0; assignment, we know the type of x. But in an unrelated function, it's just considered any.

RonanQuigley commented 6 years ago

@andy-ms Ah yeah that makes sense. Thanks for the clarification.

@mhegazy Was the bug label removed for that aside question or the main issue I posted about, as nobody has said either way whether or not this can be replicated with the repo I posted? If you need something more definitive then I'm out of ideas unfortunately. Until then I'll just stick with an earlier version of typescript.

mhegazy commented 6 years ago

Sorry i got sidetracked by the last comment. @sheetalkamat have you had time to look at the repro?

sheetalkamat commented 6 years ago

I had cloned this yesterday and then it slipped from my todo list. I tried this today with drop from latest master build and havent been able to repro this at all.. I did wait for 5-10 min and kept on playing around with the code and still no luck.

@RonanQuigley can you try out typescript@2.9.0-dev.20180419 (build that would be released tonight) with verbose log. Share the ti and tsserver log from the sessions when you are able to repro the issue. From the log and the repro code, i should be able to diagnose if the issue persists.

RonanQuigley commented 6 years ago

Okay so initially I thought I was being an idiot, as I realised I didn't actually have react or react-dom in the dependencies, which is what I was trying to repro this issue with. :laughing: Weirdly there was code completion showing up without either being installed; I guess it was looking inside another typescript version folder? I did also have another vscode project open in the background..

Either way, even after installing any missing modules it still happens. And with other already installed modules. This time I did get it to happen twice:

logs.zip logs - 2nd crash.zip

gif

Hope this helps.

sheetalkamat commented 6 years ago

@RonanQuigley Thank you for the logs. I was able to use the logs to investigate this. Will keep you posted when i have fix available.

sheetalkamat commented 6 years ago

@RonanQuigley can you please try out typescript@2.9.0-dev.20180425 once its published. We have fixed the exceptions that you were running into. Thanks.

RonanQuigley commented 6 years ago

Tried it, still the same problem:

logs.zip

And this was the result after a while of fiddling

gif

sheetalkamat commented 6 years ago

@RonanQuigley Looking at the log there wasnt a single completion that took more than 350 ms. Can you please check if the logs are of session in which the issue reproed.

sheetalkamat commented 6 years ago

I took a second look at the logs and i think the issue you are seeing now is duplicate of #19458 where i think it might be same reason as geterr triggered before completion resulting in the wait you see in editor but not in the log. This is because tsserver is working on getErr request and since its not cancelled it cannot get to completions before that work is complete. Snippet from the log which makes me guess that #19458 is same issue.

Info 979  [8:12:0.677] request:
    {"seq":18,"type":"request","command":"change","arguments":{"file":"c:/Users/Ronan/Desktop/Spotify/test/back-end/api.test.js","line":11,"offset":1,"endLine":11,"endOffset":2,"insertString":""}}
Perf 980  [8:12:0.677] 18::change: async elapsed time (in milliseconds) 0.2072
Info 981  [8:12:0.977] request:
    {"seq":19,"type":"request","command":"geterr","arguments":{"delay":0,"files":["c:/Users/Ronan/Desktop/Spotify/test/back-end/api.test.js","c:/Users/Ronan/Desktop/Spotify/src/server/api/index.js","c:/Users/Ronan/Desktop/Spotify/test/front-end/utilities/fetch.test.js","c:/Users/Ronan/Desktop/Spotify/test/back-end/env.test.js"]}}
Perf 982  [8:12:0.978] 19::geterr: async elapsed time (in milliseconds) 0.2958
Info 983  [8:12:0.979] Starting updateGraphWorker: Project: /dev/null/inferredProject1*
Info 984  [8:12:1.22] Finishing updateGraphWorker: Project: /dev/null/inferredProject1* Version: 8 structureChanged: false Elapsed: 43ms
Info 985  [8:12:1.23] event:
    {"seq":0,"type":"event","event":"syntaxDiag","body":{"file":"c:/Users/Ronan/Desktop/Spotify/test/back-end/api.test.js","diagnostics":[]}}
Info 986  [8:12:1.23] Starting updateGraphWorker: Project: /dev/null/inferredProject1*
Info 987  [8:12:1.23] Finishing updateGraphWorker: Project: /dev/null/inferredProject1* Version: 8 structureChanged: false Elapsed: 0ms
Info 988  [8:12:1.23] Starting updateGraphWorker: Project: /dev/null/inferredProject1*
Info 989  [8:12:1.24] Finishing updateGraphWorker: Project: /dev/null/inferredProject1* Version: 8 structureChanged: false Elapsed: 0ms
Info 990  [8:12:1.30] event:
    {"seq":0,"type":"event","event":"semanticDiag","body":{"file":"c:/Users/Ronan/Desktop/Spotify/test/back-end/api.test.js","diagnostics":[]}}
Info 991  [8:12:1.31] Starting updateGraphWorker: Project: /dev/null/inferredProject1*
Info 992  [8:12:1.31] Finishing updateGraphWorker: Project: /dev/null/inferredProject1* Version: 8 structureChanged: false Elapsed: 0ms
Info 993  [8:12:1.47] event:
    {"seq":0,"type":"event","event":"suggestionDiag","body":{"file":"c:/Users/Ronan/Desktop/Spotify/test/back-end/api.test.js","diagnostics":[]}}
Info 994  [8:12:1.50] Starting updateGraphWorker: Project: /dev/null/inferredProject1*
Info 995  [8:12:1.50] Finishing updateGraphWorker: Project: /dev/null/inferredProject1* Version: 8 structureChanged: false Elapsed: 0ms
Info 996  [8:12:1.51] event:
    {"seq":0,"type":"event","event":"syntaxDiag","body":{"file":"c:/Users/Ronan/Desktop/Spotify/src/server/api/index.js","diagnostics":[]}}
Info 997  [8:12:1.51] Starting updateGraphWorker: Project: /dev/null/inferredProject1*
Info 998  [8:12:1.51] Finishing updateGraphWorker: Project: /dev/null/inferredProject1* Version: 8 structureChanged: false Elapsed: 0ms
Info 999  [8:12:1.51] Starting updateGraphWorker: Project: /dev/null/inferredProject1*
Info 1000 [8:12:1.51] Finishing updateGraphWorker: Project: /dev/null/inferredProject1* Version: 8 structureChanged: false Elapsed: 0ms
Info 1001 [8:12:1.51] event:
    {"seq":0,"type":"event","event":"semanticDiag","body":{"file":"c:/Users/Ronan/Desktop/Spotify/src/server/api/index.js","diagnostics":[]}}
Info 1002 [8:12:1.52] Starting updateGraphWorker: Project: /dev/null/inferredProject1*
Info 1003 [8:12:1.52] Finishing updateGraphWorker: Project: /dev/null/inferredProject1* Version: 8 structureChanged: false Elapsed: 0ms
Info 1004 [8:12:1.52] event:
    {"seq":0,"type":"event","event":"suggestionDiag","body":{"file":"c:/Users/Ronan/Desktop/Spotify/src/server/api/index.js","diagnostics":[]}}
Info 1005 [8:12:1.54] Starting updateGraphWorker: Project: /dev/null/inferredProject1*
Info 1006 [8:12:1.54] Finishing updateGraphWorker: Project: /dev/null/inferredProject1* Version: 8 structureChanged: false Elapsed: 0ms
Info 1007 [8:12:1.54] event:
    {"seq":0,"type":"event","event":"syntaxDiag","body":{"file":"c:/Users/Ronan/Desktop/Spotify/test/front-end/utilities/fetch.test.js","diagnostics":[]}}
Info 1008 [8:12:1.54] Starting updateGraphWorker: Project: /dev/null/inferredProject1*
Info 1009 [8:12:1.54] Finishing updateGraphWorker: Project: /dev/null/inferredProject1* Version: 8 structureChanged: false Elapsed: 0ms
Info 1010 [8:12:1.54] Starting updateGraphWorker: Project: /dev/null/inferredProject1*
Info 1011 [8:12:1.54] Finishing updateGraphWorker: Project: /dev/null/inferredProject1* Version: 8 structureChanged: false Elapsed: 0ms
Info 1012 [8:12:1.54] event:
    {"seq":0,"type":"event","event":"semanticDiag","body":{"file":"c:/Users/Ronan/Desktop/Spotify/test/front-end/utilities/fetch.test.js","diagnostics":[]}}
Info 1013 [8:12:1.55] Starting updateGraphWorker: Project: /dev/null/inferredProject1*
Info 1014 [8:12:1.55] Finishing updateGraphWorker: Project: /dev/null/inferredProject1* Version: 8 structureChanged: false Elapsed: 0ms
Info 1015 [8:12:1.66] event:
    {"seq":0,"type":"event","event":"suggestionDiag","body":{"file":"c:/Users/Ronan/Desktop/Spotify/test/front-end/utilities/fetch.test.js","diagnostics":[]}}
Info 1016 [8:12:1.67] Starting updateGraphWorker: Project: /dev/null/inferredProject1*
Info 1017 [8:12:1.67] Finishing updateGraphWorker: Project: /dev/null/inferredProject1* Version: 8 structureChanged: false Elapsed: 0ms
Info 1018 [8:12:1.67] event:
    {"seq":0,"type":"event","event":"syntaxDiag","body":{"file":"c:/Users/Ronan/Desktop/Spotify/test/back-end/env.test.js","diagnostics":[]}}
Info 1019 [8:12:1.67] Starting updateGraphWorker: Project: /dev/null/inferredProject1*
Info 1020 [8:12:1.67] Finishing updateGraphWorker: Project: /dev/null/inferredProject1* Version: 8 structureChanged: false Elapsed: 0ms
Info 1021 [8:12:1.68] Starting updateGraphWorker: Project: /dev/null/inferredProject1*
Info 1022 [8:12:1.68] Finishing updateGraphWorker: Project: /dev/null/inferredProject1* Version: 8 structureChanged: false Elapsed: 0ms
Info 1023 [8:12:1.68] event:
    {"seq":0,"type":"event","event":"semanticDiag","body":{"file":"c:/Users/Ronan/Desktop/Spotify/test/back-end/env.test.js","diagnostics":[]}}
Info 1024 [8:12:1.68] Starting updateGraphWorker: Project: /dev/null/inferredProject1*
Info 1025 [8:12:1.68] Finishing updateGraphWorker: Project: /dev/null/inferredProject1* Version: 8 structureChanged: false Elapsed: 0ms
Info 1026 [8:12:1.70] event:
    {"seq":0,"type":"event","event":"suggestionDiag","body":{"file":"c:/Users/Ronan/Desktop/Spotify/test/back-end/env.test.js","diagnostics":[]}}
Info 1027 [8:12:1.70] event:
    {"seq":0,"type":"event","event":"requestCompleted","body":{"request_seq":19}}
Info 1028 [8:12:1.85] request:
    {"seq":20,"type":"request","command":"change","arguments":{"file":"c:/Users/Ronan/Desktop/Spotify/test/back-end/api.test.js","line":11,"offset":1,"endLine":11,"endOffset":1,"insertString":"i"}}
Perf 1029 [8:12:1.85] 20::change: async elapsed time (in milliseconds) 0.1613
Info 1030 [8:12:1.116] request:
    {"seq":21,"type":"request","command":"completions","arguments":{"file":"c:/Users/Ronan/Desktop/Spotify/test/back-end/api.test.js","line":11,"offset":2,"includeExternalModuleExports":true,"includeInsertTextCompletions":true}}
RonanQuigley commented 6 years ago

Hey, sorry for the delay in responding. I had to put this down due to other work.

I looked through the other issue and it says it is to do with the sass.js module? I'm not using that module in the project. Do you want me to reproduce the logs again?

sheetalkamat commented 6 years ago

@RonanQuigley Fix for #19458 is not yet working from vscode side. I will let you know once its available. Even though issue #19458 talks about sass.js it has nothing to do with the module dependency itself but about how errors and completions request interact with each other.

RonanQuigley commented 6 years ago

Not sure if it's related to this issue, but thought it might be worth mentioning that the latest releases of typescript (currently I've tried 2.9.0-dev.20180519) seems to have helped quite a bit. I still get an occasional crash during the day, but it's not as frequent.

sheetalkamat commented 6 years ago

@RonanQuigley Can you please share the server and ti log when you see crash. The previously encountered crash was fixed in #23636

sheetalkamat commented 5 years ago

Closing this since there is no more info since May. If you have more info and able to repro this with latest typescript and vscode drop please provide that.