How to Load a Typescript Error Log File in Visual Studio Code
Is It Possible to Load a Error Log File in Vscode? After Piping Errors to a File Tsc > Tsc. Log I Would Like to Load the Log File and Work Through the Errors...
Is it possible to load a error log file in VSCode?
After piping errors to a file tsc > tsc.log I would like to load the log file and work through the errors in all project files.
2 Answers
I would be surprised if there's anything built-in for this. However, you can easily trick VSCode into "loading the file into the problems panel" by running a task that outputs the file contents and applies the TypeScript problem matcher to that output.
{
"version": "2.0.0",
"tasks": [
{
"label": "Load tsc.log",
"type": "shell",
"command": "type",
"args": ["tsc.log"],
"problemMatcher": ["$tsc"]
}
]
}
(replace the type command with cat if you're not using Windows)
Note that the $tsc problem matcher is only applied to closed files. You could work around this by defining a custom problem matcher that reuses the problem pattern from the TS extension:
"problemMatcher": [
{
"pattern": "$tsc",
"applyTo": "allDocuments"
}
]
You should be able to just go to File->Open File and choose your log file. Visual Studio Code can open any text encoded file although highlighting and other support/convenience features will depend on your downloaded extensions.
If you go to the extension tab (the square on the left-hand side of the editor) and look up "log" you should find a few log related extensions. Log File Highlighter might be of use for your debugging.