in src/models/sqlOutputContentProvider.ts [507:543]
public openLink(content: string, columnName: string, linkType: string): void {
const self = this;
if (linkType === 'xml') {
try {
content = pd.xml(content);
} catch (e) {
// If Xml fails to parse, fall back on original Xml content
}
} else if (linkType === 'json') {
let jsonContent: string = undefined;
try {
jsonContent = JSON.parse(content);
} catch (e) {
// If Json fails to parse, fall back on original Json content
}
if (jsonContent) {
// If Json content was valid and parsed, pretty print content to a string
content = JSON.stringify(jsonContent, undefined, 4);
}
}
vscode.workspace.openTextDocument({ language: linkType }).then((doc: vscode.TextDocument) => {
vscode.window.showTextDocument(doc, 1, false).then(editor => {
editor.edit(edit => {
edit.insert(new vscode.Position(0, 0), content);
}).then(result => {
if (!result) {
self._vscodeWrapper.showErrorMessage(LocalizedConstants.msgCannotOpenContent);
}
});
}, (error: any) => {
self._vscodeWrapper.showErrorMessage(error);
});
}, (error: any) => {
self._vscodeWrapper.showErrorMessage(error);
});
}