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
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ All notable changes to the **kdb VS Code extension** are documented in this file
- SQL Workbook
- Connect and auto execute query functionality
- Use own grid instead of ag-grid-community for kdb Results View
- Nested objects are better supported in kdb Results View
- Add support for KDB-X modules in language server
- Moved documentation to its own site

Expand All @@ -26,7 +27,8 @@ All notable changes to the **kdb VS Code extension** are documented in this file
- Updated telemetry data sent
- Use structured text for datasources
- Integrate KDB-X KX_TTY feature in REPL
- Update query wrappers and added q CI testing
- Added q CI testing
- Updated query wrappers

# v1.16.1

Expand Down
231 changes: 115 additions & 116 deletions ref_card.md

Large diffs are not rendered by default.

5 changes: 0 additions & 5 deletions server/src/qLangServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -451,11 +451,6 @@ export default class QLangServer {
public async onFoldingRanges({
textDocument: { uri },
}: FoldingRangeParams): Promise<FoldingRange[]> {
this.notify("onFoldingRanges", MessageKind.DEBUG, {
logger,
telemetry: "Language.FoldingRanges",
});

const source = await this.getSource(uri);
const ranges: FoldingRange[] = [];

Expand Down
2 changes: 1 addition & 1 deletion src/commands/serverCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -966,7 +966,7 @@ export async function executeQuery(
notify("GG Plot displayed", MessageKind.DEBUG, {
logger,
telemetry:
"Graphics.Displayed" +
"Results.Graphics.Displayed" +
(isInsights ? ".ie" : ".kdb") +
(isPython ? ".py" : ".q"),
});
Expand Down
24 changes: 12 additions & 12 deletions src/commands/workspaceCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ import {
Runner,
} from "../utils/notifications";
import {
ExecFlags,
RunFlag,
getPythonWrapper,
getSQLWrapper,
notifyExecution,
Expand Down Expand Up @@ -543,11 +543,11 @@ export async function runActiveEditor(type?: ExecutionTypes) {
if (server === undefined) {
await runOnRepl(ext.activeTextEditor, type);
notifyExecution(
ExecFlags.Run |
ExecFlags.Repl |
(isWorkbook(uri) ? ExecFlags.Workbook : 0) |
(isPython(uri) ? ExecFlags.Python : 0) |
(isSql(uri) ? ExecFlags.Sql : 0),
RunFlag.Run |
RunFlag.Repl |
(isWorkbook(uri) ? RunFlag.Workbook : 0) |
(isPython(uri) ? RunFlag.Python : 0) |
(isSql(uri) ? RunFlag.Sql : 0),
);
return;
}
Expand Down Expand Up @@ -585,12 +585,12 @@ export async function runActiveEditor(type?: ExecutionTypes) {
isInsights,
);
notifyExecution(
(type === ExecutionTypes.PopulateScratchpad ? 0 : ExecFlags.Run) |
(isInsights ? ExecFlags.Insights : 0) |
(target ? ExecFlags.Dap : 0) |
(isWorkbook(uri) ? ExecFlags.Workbook : 0) |
(isPython(uri) ? ExecFlags.Python : 0) |
(isSql(uri) ? ExecFlags.Sql : 0),
(type === ExecutionTypes.PopulateScratchpad ? 0 : RunFlag.Run) |
(isInsights ? RunFlag.Insights : 0) |
(target ? RunFlag.Dap : 0) |
(isWorkbook(uri) ? RunFlag.Workbook : 0) |
(isPython(uri) ? RunFlag.Python : 0) |
(isSql(uri) ? RunFlag.Sql : 0),
);
} catch (error) {
notify(
Expand Down
9 changes: 3 additions & 6 deletions src/services/dataSourceEditorProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ import { UDA } from "../models/uda";
import { getBasename, offerConnectAction } from "../utils/core";
import { getNonce } from "../utils/getNonce";
import { MessageKind, Runner, notify } from "../utils/notifications";
import { ExecFlags, notifyExecution } from "../utils/queryUtils";
import { RunFlag, notifyExecution } from "../utils/queryUtils";
import { parseUDAList } from "../utils/uda";
import { getUri } from "../utils/uriUtils";

Expand Down Expand Up @@ -223,7 +223,7 @@ export class DataSourceEditorProvider implements CustomTextEditorProvider {
else if (await offerConnectAction(selectedServer))
await runner.execute();
notifyExecution(
ExecFlags.Run | ExecFlags.Insights,
RunFlag.Run,
msg.dataSourceFile.dataSource.selectedType,
);
break;
Expand All @@ -236,10 +236,7 @@ export class DataSourceEditorProvider implements CustomTextEditorProvider {
if (connected) await runner.execute();
else if (await offerConnectAction(selectedServer))
await runner.execute();
notifyExecution(
ExecFlags.Insights,
msg.dataSourceFile.dataSource.selectedType,
);
notifyExecution(0, msg.dataSourceFile.dataSource.selectedType);
break;
}
}
Expand Down
14 changes: 7 additions & 7 deletions src/services/notebookController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import {
getPythonWrapper,
getSQLWrapper,
notifyExecution,
ExecFlags,
RunFlag,
} from "../utils/queryUtils";
import { convertToGrid, formatResult } from "../utils/resultsRenderer";

Expand Down Expand Up @@ -173,12 +173,12 @@ export class KxNotebookController {
]);

notifyExecution(
ExecFlags.Notebook |
(variable ? 0 : ExecFlags.Run) |
(isInsights ? ExecFlags.Insights : 0) |
(target ? ExecFlags.Dap : 0) |
(kind === CellKind.PYTHON ? ExecFlags.Python : 0) |
(kind === CellKind.SQL ? ExecFlags.Sql : 0),
RunFlag.Notebook |
(variable ? 0 : RunFlag.Run) |
(isInsights ? RunFlag.Insights : 0) |
(target ? RunFlag.Dap : 0) |
(kind === CellKind.PYTHON ? RunFlag.Python : 0) |
(kind === CellKind.SQL ? RunFlag.Sql : 0),
);

if (variable) {
Expand Down
8 changes: 8 additions & 0 deletions src/services/resultsPanelProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,10 @@ export class KdbResultsViewProvider implements WebviewViewProvider {
}
const workspaceUri = workspaceFolders[0].uri;
utils.exportToCsv(workspaceUri);
notify("CSV exported.", MessageKind.DEBUG, {
logger,
telemetry: "Results.Export.csv",
});
}

isVisible(): boolean {
Expand Down Expand Up @@ -176,6 +180,10 @@ export class KdbResultsViewProvider implements WebviewViewProvider {
theme: "legacy",
themeColor: this.defineAgGridTheme(),
});
notify("Table displayed.", MessageKind.DEBUG, {
logger,
telemetry: "Results.Table.Displayed",
});
} else {
this._view.webview.postMessage({
command: "setResultsContent",
Expand Down
11 changes: 0 additions & 11 deletions src/utils/connLabel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,6 @@ export function addConnToLabel(labelName: string, connName: string) {
connections: [connName],
});
}
notify("Connection assigned to label.", MessageKind.DEBUG, {
logger,
telemetry: "Connection.Label.Assign",
measurements: getConnectionLabelStatistics(connName),
});
}
}

Expand All @@ -165,12 +160,6 @@ export function removeConnFromLabels(connName: string) {
workspace
.getConfiguration()
.update("kdb.labelsConnectionMap", ext.labelConnMapList, true);

notify("Connection removed from label.", MessageKind.DEBUG, {
logger,
telemetry: "Connection.Label.Unassign",
measurements: getConnectionLabelStatistics(connName),
});
}

export async function handleLabelsConnMap(labels: string[], connName: string) {
Expand Down
30 changes: 15 additions & 15 deletions src/utils/queryUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,7 @@ export function resetScratchpadStarted(connLabel: string) {
ext.scratchpadStarted.delete(connLabel);
}

export const enum ExecFlags {
export const enum RunFlag {
Run = 0b000000001,
Workbook = 0b000000010,
Notebook = 0b000000100,
Expand All @@ -560,22 +560,22 @@ export const enum ExecFlags {

export function notifyExecution(flags: number, dsType?: string) {
const telemetry =
(flags & ExecFlags.Run ? "Run" : "Populate") +
(flags & RunFlag.Run ? "Run" : "Populate") +
(dsType
? ".Datasource." + dsType.toLowerCase()
: flags & ExecFlags.Workbook
? ".Workbook"
: flags & ExecFlags.Notebook
? ".Cell"
: ".File") +
(flags & ExecFlags.Repl
? ".repl"
: flags & ExecFlags.Insights
? ".ie"
: ".kdb") +
(flags & ExecFlags.Quick ? ".quick" : "") +
(flags & ExecFlags.Dap ? ".dap" : "") +
(flags & ExecFlags.Python ? ".py" : flags & ExecFlags.Sql ? ".sql" : ".q");
: (flags & RunFlag.Workbook
? ".Workbook"
: flags & RunFlag.Notebook
? ".Cell"
: ".File") +
(flags & RunFlag.Repl
? ".repl"
: flags & RunFlag.Insights
? ".ie"
: ".kdb") +
(flags & RunFlag.Quick ? ".quick" : "") +
(flags & RunFlag.Dap ? ".dap" : "") +
(flags & RunFlag.Python ? ".py" : flags & RunFlag.Sql ? ".sql" : ".q"));

notify(`Query ${telemetry} executed.`, MessageKind.DEBUG, {
logger,
Expand Down
72 changes: 36 additions & 36 deletions test/suite/utils/queryUtils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -649,51 +649,51 @@ describe("queryUtils", () => {
describe("File", () => {
it("should return telemetry for q", () => {
const res = queryUtils.notifyExecution(
queryUtils.ExecFlags.Run | queryUtils.ExecFlags.Repl,
queryUtils.RunFlag.Run | queryUtils.RunFlag.Repl,
);
assert.strictEqual(res, "Run.File.repl.q");
});
it("should return telemetry for Python", () => {
const res = queryUtils.notifyExecution(
queryUtils.ExecFlags.Run |
queryUtils.ExecFlags.Repl |
queryUtils.ExecFlags.Python,
queryUtils.RunFlag.Run |
queryUtils.RunFlag.Repl |
queryUtils.RunFlag.Python,
);
assert.strictEqual(res, "Run.File.repl.py");
});
it("should return telemetry for SQL", () => {
const res = queryUtils.notifyExecution(
queryUtils.ExecFlags.Run |
queryUtils.ExecFlags.Repl |
queryUtils.ExecFlags.Sql,
queryUtils.RunFlag.Run |
queryUtils.RunFlag.Repl |
queryUtils.RunFlag.Sql,
);
assert.strictEqual(res, "Run.File.repl.sql");
});
});
describe("Workbook", () => {
it("should return telemetry for q", () => {
const res = queryUtils.notifyExecution(
queryUtils.ExecFlags.Run |
queryUtils.ExecFlags.Workbook |
queryUtils.ExecFlags.Repl,
queryUtils.RunFlag.Run |
queryUtils.RunFlag.Workbook |
queryUtils.RunFlag.Repl,
);
assert.strictEqual(res, "Run.Workbook.repl.q");
});
it("should return telemetry for Python", () => {
const res = queryUtils.notifyExecution(
queryUtils.ExecFlags.Run |
queryUtils.ExecFlags.Workbook |
queryUtils.ExecFlags.Repl |
queryUtils.ExecFlags.Python,
queryUtils.RunFlag.Run |
queryUtils.RunFlag.Workbook |
queryUtils.RunFlag.Repl |
queryUtils.RunFlag.Python,
);
assert.strictEqual(res, "Run.Workbook.repl.py");
});
it("should return telemetry for SQL", () => {
const res = queryUtils.notifyExecution(
queryUtils.ExecFlags.Run |
queryUtils.ExecFlags.Workbook |
queryUtils.ExecFlags.Repl |
queryUtils.ExecFlags.Sql,
queryUtils.RunFlag.Run |
queryUtils.RunFlag.Workbook |
queryUtils.RunFlag.Repl |
queryUtils.RunFlag.Sql,
);
assert.strictEqual(res, "Run.Workbook.repl.sql");
});
Expand All @@ -703,23 +703,23 @@ describe("queryUtils", () => {
describe("Workbook", () => {
it("should return telemetry for q", () => {
const res = queryUtils.notifyExecution(
queryUtils.ExecFlags.Run | queryUtils.ExecFlags.Workbook,
queryUtils.RunFlag.Run | queryUtils.RunFlag.Workbook,
);
assert.strictEqual(res, "Run.Workbook.kdb.q");
});
it("should return telemetry for Python", () => {
const res = queryUtils.notifyExecution(
queryUtils.ExecFlags.Run |
queryUtils.ExecFlags.Workbook |
queryUtils.ExecFlags.Python,
queryUtils.RunFlag.Run |
queryUtils.RunFlag.Workbook |
queryUtils.RunFlag.Python,
);
assert.strictEqual(res, "Run.Workbook.kdb.py");
});
it("should return telemetry for SQL", () => {
const res = queryUtils.notifyExecution(
queryUtils.ExecFlags.Run |
queryUtils.ExecFlags.Workbook |
queryUtils.ExecFlags.Sql,
queryUtils.RunFlag.Run |
queryUtils.RunFlag.Workbook |
queryUtils.RunFlag.Sql,
);
assert.strictEqual(res, "Run.Workbook.kdb.sql");
});
Expand All @@ -729,27 +729,27 @@ describe("queryUtils", () => {
describe("Workbook", () => {
it("should return telemetry for q", () => {
const res = queryUtils.notifyExecution(
queryUtils.ExecFlags.Run |
queryUtils.ExecFlags.Workbook |
queryUtils.ExecFlags.Insights,
queryUtils.RunFlag.Run |
queryUtils.RunFlag.Workbook |
queryUtils.RunFlag.Insights,
);
assert.strictEqual(res, "Run.Workbook.ie.q");
});
it("should return telemetry for Python", () => {
const res = queryUtils.notifyExecution(
queryUtils.ExecFlags.Run |
queryUtils.ExecFlags.Workbook |
queryUtils.ExecFlags.Insights |
queryUtils.ExecFlags.Python,
queryUtils.RunFlag.Run |
queryUtils.RunFlag.Workbook |
queryUtils.RunFlag.Insights |
queryUtils.RunFlag.Python,
);
assert.strictEqual(res, "Run.Workbook.ie.py");
});
it("should return telemetry for SQL", () => {
const res = queryUtils.notifyExecution(
queryUtils.ExecFlags.Run |
queryUtils.ExecFlags.Workbook |
queryUtils.ExecFlags.Insights |
queryUtils.ExecFlags.Sql,
queryUtils.RunFlag.Run |
queryUtils.RunFlag.Workbook |
queryUtils.RunFlag.Insights |
queryUtils.RunFlag.Sql,
);
assert.strictEqual(res, "Run.Workbook.ie.sql");
});
Expand Down