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
28 changes: 8 additions & 20 deletions src/commands/workspaceCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import { ConnectionManagementService } from "../services/connectionManagerServic
import { InsightsNode, KdbNode, LabelNode } from "../services/kdbTreeProvider";
import { updateCellMetadata } from "../services/notebookProviders";
import { getBasename, offerConnectAction } from "../utils/core";
import { importOldDsFiles, oldFilesExists } from "../utils/dataSource";
import { importOldDsFiles } from "../utils/dataSource";
import {
Cancellable,
MessageKind,
Expand Down Expand Up @@ -221,12 +221,7 @@ export async function pickConnection(uri: Uri) {
/* c8 ignore start */
const server = getServerForUri(uri);
const servers = getServers();

const items = ["(none)"];
if (isQ(uri) || isNotebook(uri) || isPython(uri) || isSql(uri)) {
items.push(ext.REPL);
}
items.push(...servers);
const items = ["(none)", ...servers];

let picked = await window.showQuickPick(items, {
title: `Choose Connection (${getBasename(uri)})`,
Expand Down Expand Up @@ -449,14 +444,6 @@ function isSql(uri: Uri | undefined) {
return uri && uri.path.endsWith(".sql");
}

function isQ(uri: Uri | undefined) {
return uri && uri.path.endsWith(".q");
}

function isNotebook(uri: Uri | undefined) {
return uri && uri.path.endsWith(".kxnb");
}

function isPython(uri: Uri | undefined) {
return uri && uri.path.endsWith(".py");
}
Expand Down Expand Up @@ -532,7 +519,12 @@ export async function runActiveEditor(type?: ExecutionTypes) {
/* c8 ignore start */
if (ext.activeTextEditor) {
const uri = ext.activeTextEditor.document.uri;
if (getServerForUri(uri) === ext.REPL) {
let server = getServerForUri(uri);
if (server === ext.REPL) {
server = undefined;
await setServerForUri(uri, undefined);
}
if (server === undefined) {
runOnRepl(ext.activeTextEditor, type);
return;
}
Expand Down Expand Up @@ -693,10 +685,6 @@ export function connectWorkspaceCommands() {
activeEditorChanged(window.activeTextEditor);
}

export function checkOldDatasourceFiles() {
ext.oldDSformatExists = oldFilesExists();
}

export async function importOldDSFiles() {
/* c8 ignore start */
if (ext.oldDSformatExists) {
Expand Down
12 changes: 2 additions & 10 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ import {
import { installKdbX, showWelcome } from "./commands/setupCommand";
import {
ConnectionLensProvider,
checkOldDatasourceFiles,
connectWorkspaceCommands,
importOldDSFiles,
pickConnection,
Expand Down Expand Up @@ -108,7 +107,6 @@ import {
import {
checkLocalInstall,
checkOpenSslInstalled,
fixUnnamedAlias,
getInsights,
getServers,
hasWorkspaceOrShowOption,
Expand Down Expand Up @@ -156,8 +154,6 @@ export async function activate(context: vscode.ExtensionContext) {
"datasource",
);

fixUnnamedAlias();

vscode.commands.executeCommand("setContext", "kdb.QHOME", env.QHOME);

vscode.window.registerTreeDataProvider("kdb-servers", ext.serverProvider);
Expand Down Expand Up @@ -220,8 +216,6 @@ export async function activate(context: vscode.ExtensionContext) {
}),
);

checkOldDatasourceFiles();

const lastResult: QueryResult | undefined = undefined;
const resultSchema = "vscode-kdb-q";
const resultProvider = new (class
Expand Down Expand Up @@ -266,9 +260,6 @@ export async function activate(context: vscode.ExtensionContext) {
),
);

connectWorkspaceCommands();
await connectBuildTools();

//q language server
const serverModule = path.join(context.extensionPath, "out", "server.js");
const debugOptions = { execArgv: ["--nolazy", "--inspect=6009"] };
Expand Down Expand Up @@ -313,8 +304,8 @@ export async function activate(context: vscode.ExtensionContext) {
);

await client.start();

connectClientCommands(context, client);
await connectBuildTools();

const yamlExtension = vscode.extensions.getExtension("redhat.vscode-yaml");
if (yamlExtension) {
Expand Down Expand Up @@ -1014,6 +1005,7 @@ function registerAllExtensionCommands(): void {
vscode.commands.registerCommand(command.command, command.callback),
);
});
connectWorkspaceCommands();
}

export async function deactivate(): Promise<void> {
Expand Down
82 changes: 0 additions & 82 deletions src/q/list_mem.q

This file was deleted.

13 changes: 11 additions & 2 deletions src/services/notebookController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@ import {
runDataSource,
} from "../commands/dataSourceCommand";
import { executeQuery } from "../commands/serverCommand";
import { findConnection, getServerForUri } from "../commands/workspaceCommand";
import {
findConnection,
getServerForUri,
setServerForUri,
} from "../commands/workspaceCommand";
import { ext } from "../extensionVariables";
import { CellKind } from "../models/notebook";
import { getBasename } from "../utils/core";
Expand Down Expand Up @@ -107,7 +111,12 @@ export class KxNotebookController {
notebook: vscode.NotebookDocument,
controller: vscode.NotebookController,
): Promise<void> {
if (getServerForUri(notebook.uri) === ext.REPL) {
let server = getServerForUri(notebook.uri);
if (server === ext.REPL) {
server = undefined;
await setServerForUri(notebook.uri, undefined);
}
if (server === undefined) {
return this.executeRepl(cells, notebook, controller);
}

Expand Down
41 changes: 0 additions & 41 deletions src/utils/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -272,47 +272,6 @@ export function getServers(): Server {
: {};
}

// TODO: Remove this on 1.9.0 release
export function fixUnnamedAlias(): void {
/* c8 ignore start */
const servers = getServers();
const insights = getInsights();
let counter = 1;

if (servers) {
const updatedServers: Server = {};
for (const key in servers) {
if (Object.prototype.hasOwnProperty.call(servers, key)) {
const server = servers[key];
if (server.serverAlias === "") {
server.serverAlias = `unnamedServer-${counter}`;
counter++;
}
updatedServers[server.serverAlias] = server;
}
}
updateServers(updatedServers);
ext.serverProvider.refresh(servers);
}

if (insights) {
const updatedInsights: Insights = {};
for (const key in insights) {
if (Object.prototype.hasOwnProperty.call(insights, key)) {
const insight = insights[key];
if (insight.alias === "") {
insight.alias = `unnamedServer-${counter}`;
counter++;
}
updatedInsights[insight.alias] = insight;
}
}
updateInsights(updatedInsights);
ext.serverProvider.refreshInsights(insights);
}
/* c8 ignore stop */
}

export function getAutoFocusOutputOnEntrySetting(): boolean {
return workspace
.getConfiguration("kdb")
Expand Down
6 changes: 0 additions & 6 deletions test/suite/commands/workspaceCommand.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -240,12 +240,6 @@ describe("workspaceCommand", () => {
afterEach(() => {
oldFilesExistsStub.restore();
});

it("should check for old datasource files", async () => {
oldFilesExistsStub.returns(true);
await workspaceCommand.checkOldDatasourceFiles();
sinon.assert.calledOnce(oldFilesExistsStub);
});
});

describe("importOldDSFiles", () => {
Expand Down
Loading