Reputation: 572
I have a VS Code extension which enforces a json schema onto a json file. When there is an error, it posts a message into the Problems window which is great.
How can I write to this window, from my extension, to put my own messages in the Problems window?
I have searched the docs, and could only find showInformationMessage, showErrorMessage and showWarningMessage but none of these put the message anywhere visible that I can see.
Any hints to the correct method or a suitable doc page would be most helpful.
Upvotes: 2
Views: 857
Reputation: 34138
You can use diagnostics for this. The starting point for that API is createDiagnosticCollection()
from the vscode.languages
namespace. vscode-extension-samples has a simple example for this. The basic idea is that DiagnosticCollection
acts as a map with URIs as keys and arrays of diagnostics as values.
Upvotes: 2