Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,26 @@

All notable changes to the **kdb VS Code extension** are documented in this file.

# v1.15.0

### Enhancments

- Deprecated `Hide Detailed Console Query Output` setting and added a new `Hide Source Expressions` setting.

### Fixes

- Resolved an issue where QDoc comments were not collapsing as expected
- Resolved an issue where query history was not showing for some files
- Resolved an issue where stopping the bundled q showed multiple errors
- Resolved a walkthrough error message issue
- Resolved an issue where recently added connections were not showing
- Resolved an issue where authentication details were missing for modified connections
- Changed the subscribe notification text

### Internal Improvements

- Updated dependencies to address security vulnerabilities

# v1.14.0

### Enhancements
Expand Down
9 changes: 8 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
"title": "q runtime installed",
"description": " \n",
"media": {
"markdown": "out/qinstall.md"
"markdown": "resources/walkthrough/qinstall.md"
},
"completionEvents": [
"onLink:https://code.kx.com/q/learn/install/"
Expand Down Expand Up @@ -166,6 +166,13 @@
"type": "boolean",
"description": "Hide detailed console query output",
"default": true,
"scope": "machine",
"deprecationMessage": "This setting is deprecated, use kdb.hideSourceExpressions instead"
},
"kdb.hideSourceExpressions": {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to handle copying the existing value from hideDetailedConsoleQueryOutput into this new setting?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

deprecationMessage is set for the old setting and it is in change log as well and it is by default true so IMHO there is no need to copy the previous setting to the new one. Only the users who set this false will need to go to settings and change the new setting.

"type": "boolean",
"description": "When disabled, the console shows all evaluated expressions, intermediate steps, and results from your query. Enable this to streamline logs and reduce visual clutter when running simple or production-ready queries.",
"default": true,
"scope": "machine"
},
"kdb.autoFocusOutputOnEntry": {
Expand Down
1 change: 1 addition & 0 deletions resources/walkthrough/qinstall.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Install q
2 changes: 1 addition & 1 deletion sonar-project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ sonar.test.inclusions=test/**/*.ts
sonar.test.exclusions=**/*.js,**/node_modules/**
sonar.javascript.lcov.reportPaths=lcov.info
sonar.typescript.lcov.reportPaths=lcov.info
sonar.coverage.exclusions=server/src/utils/parserUtils.ts,src/ipc/**,src/models/**,src/extension.ts,src/classes/**,src/commands/installTools.ts,src/utils/cpUtils.ts,test/**,**/*.test.ts,**/*.spec.ts
sonar.coverage.exclusions=server/src/utils/parserUtils.ts,src/ipc/**,src/models/**,src/extension.ts,src/classes/**,src/commands/installTools.ts,src/utils/cpUtils.ts,test/**,**/*.test.ts,**/*.spec.ts,src/commands/serverCommand.ts
sonar.cpd.exclusions=src/services/completionProvider.ts,src/extension.ts
sonar.sourceEncoding=UTF-8
22 changes: 10 additions & 12 deletions src/commands/installTools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,10 +202,6 @@ export async function installTools(): Promise<void> {
logger,
});
}
await writeFile(
join(__dirname, "qinstall.md"),
`# q runtime installed location: \n### ${QHOME}`,
);
notify(`Installation of q found here: ${QHOME}`, MessageKind.DEBUG, {
logger,
});
Expand Down Expand Up @@ -314,14 +310,16 @@ export async function startLocalProcess(viewItem: KdbNode): Promise<void> {
}

export async function stopLocalProcess(viewItem: KdbNode): Promise<void> {
ext.localProcessObjects[viewItem.children[0]].kill();
notify(
`Child process id ${ext.localProcessObjects[viewItem.children[0]]
.pid!} removed in cache.`,
MessageKind.DEBUG,
{ logger },
);
await removeLocalConnectionStatus(`${getServerName(viewItem.details)}`);
const proc = ext.localProcessObjects[viewItem.children[0]];
proc.once("exit", () => {
notify(
`Child process id ${proc.pid!} removed in cache.`,
MessageKind.DEBUG,
{ logger },
);
removeLocalConnectionStatus(`${getServerName(viewItem.details)}`);
});
proc.kill();
}

export async function stopLocalProcessByServerName(
Expand Down
79 changes: 63 additions & 16 deletions src/commands/serverCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,49 @@ function removeAuthConnection(serverKey: string) {
}
}

// Not possible to test secrets
/* c8 ignore next */
export function updateAuthDataKey(oldServerKey: string, newServerKey: string) {
const storeAuthData = ext.secretSettings.storeAuthData as {
[key: string]: any;
};

if (Object.prototype.hasOwnProperty.call(storeAuthData, newServerKey)) {
notify(
`Auth data already exists for key: ${newServerKey}`,
MessageKind.ERROR,
{ logger },
);
return;
}

storeAuthData[newServerKey] = storeAuthData[oldServerKey];
delete storeAuthData[oldServerKey];

return;
}

// Not possible to test secrets
/* c8 ignore next */
export function handleEditAuthData(
oldServerKey: string,
newServerKey: string,
editAuth: boolean,
isAuth?: boolean,
username?: string,
password?: string,
) {
if (editAuth) {
removeAuthConnection(oldServerKey);
if (isAuth && username !== "" && password !== "") {
addAuthConnection(newServerKey, username!, password!);
return;
}
} else if (oldServerKey !== newServerKey) {
updateAuthDataKey(oldServerKey, newServerKey);
}
}

export async function enableTLS(serverKey: string): Promise<void> {
const servers: Server | undefined = getServers();

Expand Down Expand Up @@ -530,7 +573,12 @@ export async function editKdbConnection(
});

updatedServers[newKey] = {
auth: removedAuth ? false : kdbData.auth,
auth:
editAuth === false
? oldServer.auth
: removedAuth
? false
: kdbData.auth,
serverName: kdbData.serverName,
serverPort: kdbData.serverPort,
serverAlias: kdbData.serverAlias,
Expand All @@ -541,7 +589,12 @@ export async function editKdbConnection(
await updateServers(updatedServers);
} else {
servers[oldKey] = {
auth: removedAuth ? false : kdbData.auth,
auth:
editAuth === false
? oldServer.auth
: removedAuth
? false
: kdbData.auth,
serverName: kdbData.serverName,
serverPort: kdbData.serverPort,
serverAlias: kdbData.serverAlias,
Expand Down Expand Up @@ -576,20 +629,14 @@ export async function editKdbConnection(
MessageKind.INFO,
{ logger },
);
if (oldKey !== newKey) {
removeConnFromLabels(oldKey);
removeAuthConnection(oldKey);
if (kdbData.auth) {
addAuthConnection(newKey, kdbData.username!, kdbData.password!);
}
} else {
if (editAuth && !removedAuth) {
addAuthConnection(newKey, kdbData.username!, kdbData.password!);
}
if (editAuth && removedAuth) {
removeAuthConnection(newKey);
}
}
handleEditAuthData(
oldKey,
newKey,
editAuth ?? false,
kdbData.auth,
kdbData.username,
kdbData.password,
);

NewConnectionPannel.close();
}
Expand Down
4 changes: 0 additions & 4 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -870,10 +870,6 @@ function registerConnectionsCommands(): CommandRegistration[] {
{
command: "kdb.connections.localProcess.stop",
callback: async (viewItem: KdbNode) => {
await vscode.commands.executeCommand(
"kdb.connections.disconnect",
viewItem,
);
await stopLocalProcess(viewItem);
},
},
Expand Down
2 changes: 1 addition & 1 deletion src/utils/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ export function getAutoFocusOutputOnEntrySetting(): boolean {
export function getHideDetailedConsoleQueryOutputSetting(): boolean {
return workspace
.getConfiguration("kdb")
.get<boolean>("hideDetailedConsoleQueryOutput", true);
.get<boolean>("hideSourceExpressions", true);
}

export function setOutputWordWrapper(): void {
Expand Down
2 changes: 1 addition & 1 deletion src/utils/registration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export function showRegistrationNotification(): void {
.get<boolean>("kdb.hideSubscribeRegistrationNotification", false);
if (setting === false) {
notify(
"Subscribe to updates",
"Subscribe to the kdb VS Code extension newsletter?",
MessageKind.INFO,
{},
"Opt-In",
Expand Down