How to make Visual Studio Code check entire project for errors?

0

Issue

I’m using VS Code for TypeScript/JavaScript development. When I open a file it will check that file for errors. The problem is if I’m refactoring (like I move some shared code to a new location or change a name) it won’t show me the errors this caused until I open the file with the problem. …so if I want to do extensive refactoring I have to open every file just to make it scan the file for errors.

How can I make VS Code scan the whole project for errors without having to open each file one by one manually?

Solution

Figured it out. Note this answer is specific to TypeScript, which is what I am using. Here it is:

Make sure typescript is installed globally (I just had mine installed locally apparently):
npm install -g typescript

Then in VS Code press Shift+Ctrl+B. If you don’t have a task runner set up it will ask what you want. I selected typescript and the tasks.json file will look like this:

{
    "version": "0.1.0",
    "command": "tsc",
    "isShellCommand": true,
    "args": ["-p", "."],
    "showOutput": "silent",
    "problemMatcher": "$tsc"
}

Then pressing Shift+Ctrl+B (or Shift+Command+B in macOS) will check the entire project for problems and they will be reported in your “problems” panel.

Answered By – WillyC

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave A Reply

Your email address will not be published.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More