import * as vscode from 'vscode'; export class TextDocumentContentProvider implements vscode.TextDocumentContentProvider { private _onDidChange = new vscode.EventEmitter(); private _data = null; public provideTextDocumentContent(uri: vscode.Uri): string { if (!this._data) return this.errorSnippet(); if (this._data['rows'].length == 0) return this.errorSnippet(); const configuration = vscode.workspace.getConfiguration('frog') const additionalStyles = configuration.get("resultSetStyles", "") let styles = `` const choosableLimits = [2,10,50] let limitBox = '

Limit Results: ' + choosableLimits.map((limit) => `${limit}`).join('') + '

' let text = `${styles}${limitBox}` text += this._data['columnDefinitions'].map((x) => ``).join('') text += '' text += this._data['rows'].map((r) => '' + r['columns'].map((c) => '').join('') + '' ).join('') text += '
${x['name']}
' + (c['value'] ? c['value'] : 'NULL') + '
' return text; } get onDidChange(): vscode.Event { return this._onDidChange.event; } public update(uri: vscode.Uri) { this._onDidChange.fire(uri); } public setData(data) { this._data = data; } private errorSnippet(): string { return `
No results found!
`; } }