Added formatted tables

This commit is contained in:
Thorsten Muerell
2017-10-30 15:27:42 +01:00
parent 3a9674e80b
commit b8e46a6270
5 changed files with 15 additions and 71 deletions

View File

@@ -5,6 +5,7 @@ import * as vscode from 'vscode';
import { ConnectionProvider, ConnectionNode } from './connections'
const { spawn } = require('child_process');
const table = require('text-table');
const extensionName = "frog";
var dbSession = null;
@@ -78,17 +79,21 @@ export function activate(context: vscode.ExtensionContext) {
diagnosticCollection.set(document.uri, diagnostics);
}
} else {
const data = []
data.push(json['columnDefinitions'].map((x) => x['name']));
for (let row of json["rows"]) {
myOutputChannel.append("--- ROW ---\n");
for (let [index, value] of row["columns"].entries()) {
myOutputChannel.append(cd[index]['name'] + " " + value['value'] + "\n");
}
data.push(row['columns'].map((x) => x['value']));
}
var t = table(data, { hsep: ' | '});
myOutputChannel.append(t);
myOutputChannel.append("\n");
}
myOutputChannel.append("-- " + new Date() + " -------------------------------\n");
outputBuffer = "";
} catch (e) {}
} catch (e) {
console.log(e);
}
});
dbSession.stderr.on('data', (data) => {