Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KXI-36321, KXI-36352, KXI-36554 bug fixes #247

Merged
merged 12 commits into from
Feb 8, 2024
29 changes: 21 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -396,11 +396,24 @@ To update kdb VS Code settings, search for `kdb` from _Preferences_ > _Settings_

## Shortcuts

| Key | Action |
| ---------------------- | ---------------------------- |
| F12 | Go to definition |
| Shift + F12 | Go to references |
| Cmd/Ctrl + Shift + F12 | Find all references |
| Ctrl + Q | Execute current selection |
| Ctrl + Shift + Q | Execute entire file |
| Ctrl + Shift + R | Run q file in new q instance |
### For Windows

| Key | Action |
| ------------------ | ---------------------------- |
| F12 | Go to definition |
| Shift + F12 | Go to references |
| Ctrl + Shift + F12 | Find all references |
| Ctrl + Q | Execute current selection |
| Ctrl + Shift + Q | Execute entire file |
| Ctrl + Shift + R | Run q file in new q instance |

### For MacOS

| Key | Action |
| --------------- | ---------------------------- |
| F12 | Go to definition |
| Shift + F12 | Go to references |
| ⌘ + Shift + F12 | Find all references |
| ⌘ + Q | Execute current selection |
| ⌘ + Shift + Q | Execute entire file |
| ⌘ + Shift + R | Run q file in new q instance |
22 changes: 21 additions & 1 deletion src/commands/dataSourceCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

import * as fs from "fs";
import path from "path";
import { InputBoxOptions, Uri, window, commands } from "vscode";
import { InputBoxOptions, Uri, window } from "vscode";
import { ext } from "../extensionVariables";
import { GetDataError, getDataBodyPayload } from "../models/data";
import {
Expand All @@ -31,6 +31,7 @@ import {
getConnectedInsightsNode,
} from "../utils/dataSource";
import {
addQueryHistory,
handleScratchpadTableRes,
handleWSError,
handleWSResults,
Expand All @@ -43,6 +44,7 @@ import {
writeQueryResultsToConsole,
writeQueryResultsToView,
} from "./serverCommand";
import { ServerType } from "../models/server";

export async function addDataSource(): Promise<void> {
const kdbDataSourcesFolderPath = createKdbDataSourcesFolder();
Expand Down Expand Up @@ -252,13 +254,16 @@ export async function runDataSource(
ext.isDatasourceExecution = false;
if (res.error) {
window.showErrorMessage(res.error);
addDStoQueryHistory(dataSourceForm, false);
} else if (ext.resultsViewProvider.isVisible()) {
addDStoQueryHistory(dataSourceForm, true);
writeQueryResultsToView(
res,
getQuery(fileContent, selectedType),
selectedType,
);
} else {
addDStoQueryHistory(dataSourceForm, true);
writeQueryResultsToConsole(
res,
getQuery(fileContent, selectedType),
Expand All @@ -270,6 +275,21 @@ export async function runDataSource(
}
}

export function addDStoQueryHistory(
dataSourceForm: DataSourceFiles,
success: boolean,
) {
addQueryHistory(
dataSourceForm,
ext.connectionNode?.label ? ext.connectionNode.label : "",
ServerType.INSIGHTS,
success,
false,
true,
dataSourceForm.dataSource.selectedType,
);
}

export function getSelectedType(fileContent: DataSourceFiles): string {
const selectedType = fileContent.dataSource.selectedType;
switch (selectedType) {
Expand Down
Loading
Loading