Added formatted tables
This commit is contained in:
@@ -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) => {
|
||||
|
Reference in New Issue
Block a user