Skip to content

JS error highlighting stops working in some cases #8212

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

Closed
dbaeumer opened this issue Apr 20, 2016 · 8 comments · Fixed by #7486
Closed

JS error highlighting stops working in some cases #8212

dbaeumer opened this issue Apr 20, 2016 · 8 comments · Fixed by #7486
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue

Comments

@dbaeumer
Copy link
Member

From @nrkn on April 20, 2016 4:46

  • VSCode Version: 1.0.0
  • OS Version: Windows 10 Pro

I have no extensions installed. node.js v5.10.1

Error highlighting has stopped working in our node.js app - I was able to reduce it to a very minimal test case:

A single index.js containing an erroneous line so you can see if error highlighting is on
A single subfolder containing a package.json with grunt and grunt-browserify packages and a node_modules folder created by running npm install against the package.json
Standard vscode files - .vscode/launch.json and jsconfig.json

Steps to Reproduce:

  1. Clone this repo or recreate structure above from this gist
  2. Navigate to ./sub and run npm install
  3. Open main folder in VSCode
  4. View ./index.js - there is no error highlighting

I have reproduced this on 3 machines

Almost any change to this minimum case, like removing the node_modules folder, removing use strict from the index.js etc., removing the vscode files etc. prevents the bug from being triggered, and error highlighting starts working again, however our app is not a minimal test case so knowing that isn't much help to us!

Copied from original issue: microsoft/vscode#5530

@dbaeumer
Copy link
Member Author

From @nrkn on April 20, 2016 5:16

BTW, there are a ton of ways to fix the min case so that it works, like adding node_modules to the exclude in jsconfig.json - but none of these fixes helps in our full app. Am at quite the loss as to how to proceed. Please let me know if I can provide any more info.

Intellisense is also down.

@dbaeumer
Copy link
Member Author

@nrkn thanks a lot for this nice test case. I was able to reproduce this immediately. First analysis shows that the tsserver which is powering JavaScript language smartness throws on reading the project info. We need to do two things here:

  • let the user know that reading the project info failed.
  • make a issue for the TS team.

@dbaeumer
Copy link
Member Author

capture

Above the request / response trace I get in VSCode

@billti billti added the Bug A bug in TypeScript label Apr 20, 2016
@billti
Copy link
Member

billti commented Apr 20, 2016

@zhengbli can you take a look and see why tsserver is having issues with this repro?

@billti billti added this to the TypeScript 2.0 milestone Apr 20, 2016
@zhengbli zhengbli added the Salsa label Apr 20, 2016
@zhengbli
Copy link
Contributor

zhengbli commented Apr 20, 2016

This looks like the old issue where when the files in node_modules are included in the project, it takes a very long time to process the project. Because the project is not ready, asking for project info will result in an error. #7486 is likely to fix the issue once it goes in. By default, the node_modules in the project root level will be excluded, however in his case the folder is inside a child folder sub, therefore its content is included. In fact, if waiting long enough, the error marks will show up eventually, it's just really slow right now.

Work around: edit the jsconfig.json so it looks like:

{
  "compilerOptions": {
    "target": "es6",
    "module": "commonjs"
  },
  "exclude": [
    "sub/node_modules"
  ]
}

@nrkn
Copy link

nrkn commented Apr 20, 2016

Brilliant. Though I'd already tried using exclude in our main app (not the minimal test) with no luck, I'd only been excluding a couple of things (including sub-folders' node_modules) and it is quite a large project.

By knowing that this was the cause I was able to get error highlighting and intellisense back by aggressively adding more and more things to the exclude until they started working.

Looking forward to being able to remove some of those things when this fix surfaces!

@zhengbli
Copy link
Contributor

@nrkn out of curiosity, what are the common folders that you need to exclude manually? Are these your source code files or libraries?

@nrkn
Copy link

nrkn commented Apr 20, 2016

@zhengbli our own source - now that I look over it to better answer your question, most of it can actually probably stay in exclude - it's mostly stuff like tests, browserified client js etc.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants