Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions resources/evaluatePy.q
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,12 @@
result[`error]:string result`error;
if [`backtrace in key result;
result[`backtrace]:string result`backtrace];
if[result `errored; :result];
if[type[result[`result]] = 99h;
if[`output in key result[`result];
if[type[result[`result][`output]] = 99h;
if[`bytes in key result[`result][`output];
result[`base64]:1b; result[`result]: .Q.btoa result[`result][`output][`bytes]; :result]]]];
result[`result]:
$[result`errored;
::;
Expand Down
2 changes: 1 addition & 1 deletion src/classes/localConnection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ export class LocalConnection {
return { base64, result };
}

if (!stringify) {
if (!stringify && !isPython) {
return JSON.parse(result);
}

Expand Down
1 change: 1 addition & 0 deletions src/commands/serverCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1224,6 +1224,7 @@ export async function writeQueryResultsToView(
result,
isInsights,
connVersion,
isPython,
);
if (!checkIfIsDatasource(type)) {
addQueryHistory(
Expand Down
14 changes: 12 additions & 2 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,18 @@ export async function activate(context: ExtensionContext) {
),
commands.registerCommand(
"kdb.resultsPanel.update",
(results: any, isInsights: boolean, connVersion?: number) => {
ext.resultsViewProvider.updateResults(results, isInsights, connVersion);
(
results: any,
isInsights: boolean,
connVersion?: number,
isPython?: boolean,
) => {
ext.resultsViewProvider.updateResults(
results,
isInsights,
connVersion,
isPython,
);
},
),
commands.registerCommand("kdb.resultsPanel.clear", () => {
Expand Down
10 changes: 9 additions & 1 deletion src/services/resultsPanelProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import { decodeQUTF } from "../utils/decode";
export class KdbResultsViewProvider implements WebviewViewProvider {
public static readonly viewType = "kdb-results";
public isInsights = false;
public isPython = false;
public _colorTheme: any;
private _view?: WebviewView;
private _results: string | string[] = "";
Expand Down Expand Up @@ -97,10 +98,12 @@ export class KdbResultsViewProvider implements WebviewViewProvider {
queryResults: any,
isInsights?: boolean,
connVersion?: number,
isPython?: boolean,
) {
if (this._view) {
this._view.show?.(true);
this.isInsights = !!isInsights;
this.isPython = !!isPython;
this.updateWebView(queryResults, connVersion);
}
}
Expand Down Expand Up @@ -231,11 +234,15 @@ export class KdbResultsViewProvider implements WebviewViewProvider {
results: any,
isInsights: boolean,
connVersion?: number,
isPython?: boolean,
): GridOptions {
let rowData = [];
let columnDefs = [];

if (!isInsights || (connVersion && compareVersions(connVersion, 1.12))) {
if (
(!isInsights && !isPython) ||
(isInsights && connVersion && compareVersions(connVersion, 1.12))
) {
rowData = this.updatedExtractRowData(results);
columnDefs = this.updatedExtractColumnDefs(results);
} else {
Expand Down Expand Up @@ -370,6 +377,7 @@ export class KdbResultsViewProvider implements WebviewViewProvider {
queryResult,
this.isInsights,
connVersion,
this.isPython,
);
}
if (gridOptions) {
Expand Down
Loading