diff --git a/.README/hide-detailed-console-query.png b/.README/hide-detailed-console-query.png deleted file mode 100644 index 92f1ae68b..000000000 Binary files a/.README/hide-detailed-console-query.png and /dev/null differ diff --git a/.README/hide-source-expressions.png b/.README/hide-source-expressions.png new file mode 100644 index 000000000..ca2fe6232 Binary files /dev/null and b/.README/hide-source-expressions.png differ diff --git a/.github/workflows/prod_release.yml b/.github/workflows/prod_release.yml index b7f28a267..8a2bb1bcc 100644 --- a/.github/workflows/prod_release.yml +++ b/.github/workflows/prod_release.yml @@ -115,3 +115,7 @@ jobs: run: npm run publish env: VSCE_PAT: ${{ secrets.VSCE_PAT }} + - name: Publish to Open VSX Registry + uses: HaaLeo/publish-vscode-extension@v2 + with: + pat: ${{ secrets.OPEN_VSX_TOKEN }} diff --git a/CHANGELOG.md b/CHANGELOG.md index dff6cfe36..7913f2cda 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,26 @@ All notable changes to the **kdb VS Code extension** are documented in this file. +# v1.15.0 + +### Enhancements + +- Deprecated the `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 triggered multiple errors +- Resolved an issue with walkthrough error messages not displaying correctly +- Resolved an issue where recently added connections were not showing +- Resolved an issue where authentication details were missing for modified connections +- Updated the subscribe notification text + +### Internal Improvements + +- Updated dependencies to address security vulnerabilities + # v1.14.0 ### Enhancements diff --git a/README.md b/README.md index 0e323795d..739873c80 100644 --- a/README.md +++ b/README.md @@ -96,7 +96,7 @@ If you want to use q outside of VS Code, set a [`QHOME` environment variable](ht If q is installed at `C:\q`, then `QHOME` is `C:\q`. -**Note!** The kdb VS Code Extension treats the `QHOME` environment variable and the `kdb.qHomeDirectory` setting as identical when locating the q executable for REPL and bundled q connections. For more details, refer to the [QHomeDirectory](https://github.com/KxSystems/kx-vscode/wiki/qHomeDirectory) wiki page. +**Note!** The kdb VS Code Extension treats the `QHOME` environment variable and the `kdb.qHomeDirectory` setting as identical when locating the q executable for REPL and bundled q connections. For more details, refer to the [QHomeDirectory](https://github.com/KxSystems/kx-vscode/wiki/qHomeDirectory) wiki page. ### Versions available @@ -805,9 +805,9 @@ All query executions happen remotely from the **kdb VS Code extension** either a ![Output autoscrolling](https://raw.githubusercontent.com/KxSystems/kx-vscode/main/.README/auto-scrolling.png) - **Note** You can hide or show the full details in the console output. Go to settings of the VS Code, search for kdb, check the option **Hide Detailed Console Query Output** (this option is checked by default) + **Note** You can hide or show the full details in the console output. Go to settings of the VS Code, search for kdb, check the option **Hide Source Expressions** (this option is checked by default) - ![Hide Detailed Console Query Output](https://raw.githubusercontent.com/KxSystems/kx-vscode/main/.README/hide-detailed-console-query.png) + ![Hide Source Expressions](https://raw.githubusercontent.com/KxSystems/kx-vscode/main/.README/hide-source-expressions.png) - **KDB Results** - This window displays the kdb returned data in a table. @@ -904,7 +904,7 @@ To update kdb VS Code settings, search for **kdb** from _Preferences_ > _Setting | **Hide notification for installation path, after first install** | yes/no; default no | | **Hide subscribe for registration notification** | yes/no; default no | | **Hide the extension survey dialog box** | yes/no; default no | -| **Hide detailed console query output** | yes/no; default yes | +| **Hide source expressions** | yes/no; default yes | | **kdb Insights Enterprise connections for explorer** | [edit JSON settings](#kdb-insights-enterprise-connections-for-explorer) | | **Linting** | Enable linting for q and quke files | | **Refactoring** | Choose refactoring scope | diff --git a/package-lock.json b/package-lock.json index aa6577b71..b7ebbc0cf 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "kdb", - "version": "1.14.0", + "version": "1.15.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "kdb", - "version": "1.14.0", + "version": "1.15.0", "license": "MIT", "dependencies": { "@ag-grid-community/core": "^32.3.5", @@ -14,7 +14,7 @@ "@vscode/extension-telemetry": "^1.0.0", "@windozer/node-q": "^2.6.0", "ag-grid-community": "^33.3.2", - "axios": "^1.11.0", + "axios": ">=1.12.0", "chevrotain": "^10.5.0", "extract-zip": "^2.0.1", "fs-extra": "^11.3.0", @@ -3398,9 +3398,9 @@ } }, "node_modules/axios": { - "version": "1.11.0", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.11.0.tgz", - "integrity": "sha512-1Lx3WLFQWm3ooKDYZD1eXmoGO9fxYQjrycfHFC8P0sCfQVXyROp0p9PFWBehewBOdCwHc+f/b8I0fMto5eSfwA==", + "version": "1.12.2", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.12.2.tgz", + "integrity": "sha512-vMJzPewAlRyOgxV2dU0Cuz2O8zzzx9VYtbJOaBgXFeLc4IV/Eg50n4LowmehOOR61S8ZMpc2K5Sa7g6A4jfkUw==", "license": "MIT", "dependencies": { "follow-redirects": "^1.15.6", diff --git a/package.json b/package.json index 9a1d2bd03..7ef2ef5c0 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "displayName": "kdb", "description": "IDE support for kdb product suite including the q programming language", "publisher": "KX", - "version": "1.14.0", + "version": "1.15.0", "engines": { "vscode": "^1.96.0" }, @@ -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/" @@ -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": { + "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": { @@ -1212,7 +1219,7 @@ "@vscode/extension-telemetry": "^1.0.0", "@windozer/node-q": "^2.6.0", "ag-grid-community": "^33.3.2", - "axios": "^1.11.0", + "axios": ">=1.12.0", "chevrotain": "^10.5.0", "extract-zip": "^2.0.1", "fs-extra": "^11.3.0", @@ -1227,4 +1234,4 @@ "vscode-languageserver-textdocument": "^1.0.12", "vscode-uri": "^3.1.0" } -} +} \ No newline at end of file diff --git a/resources/walkthrough/qinstall.md b/resources/walkthrough/qinstall.md new file mode 100644 index 000000000..a9e36ea0e --- /dev/null +++ b/resources/walkthrough/qinstall.md @@ -0,0 +1 @@ +# Install q diff --git a/server/src/qLangServer.ts b/server/src/qLangServer.ts index df4cc7518..6f507f985 100644 --- a/server/src/qLangServer.ts +++ b/server/src/qLangServer.ts @@ -61,6 +61,7 @@ import { WhiteSpace, CommentEndOfLine, CommentLiteral, + Documentation, } from "./parser"; import { Name, @@ -460,6 +461,7 @@ export default class QLangServer { break; case ExitCommentBegin: case LineComment: + case Documentation: if (!range) start(); break; case CommentBegin: diff --git a/sonar-project.properties b/sonar-project.properties index 95eb6cd72..f673fff46 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -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 \ No newline at end of file diff --git a/src/commands/installTools.ts b/src/commands/installTools.ts index 5920fa05d..85925db8d 100644 --- a/src/commands/installTools.ts +++ b/src/commands/installTools.ts @@ -202,10 +202,6 @@ export async function installTools(): Promise { logger, }); } - await writeFile( - join(__dirname, "qinstall.md"), - `# q runtime installed location: \n### ${QHOME}`, - ); notify(`Installation of q found here: ${QHOME}`, MessageKind.DEBUG, { logger, }); @@ -314,14 +310,16 @@ export async function startLocalProcess(viewItem: KdbNode): Promise { } export async function stopLocalProcess(viewItem: KdbNode): Promise { - 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( diff --git a/src/commands/serverCommand.ts b/src/commands/serverCommand.ts index a52af3e81..3442cda27 100644 --- a/src/commands/serverCommand.ts +++ b/src/commands/serverCommand.ts @@ -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 { const servers: Server | undefined = getServers(); @@ -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, @@ -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, @@ -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(); } diff --git a/src/extension.ts b/src/extension.ts index 41a5e7c5d..d855e6db0 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -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); }, }, diff --git a/src/utils/core.ts b/src/utils/core.ts index a6f283795..6187ceb2e 100644 --- a/src/utils/core.ts +++ b/src/utils/core.ts @@ -353,7 +353,7 @@ export function getAutoFocusOutputOnEntrySetting(): boolean { export function getHideDetailedConsoleQueryOutputSetting(): boolean { return workspace .getConfiguration("kdb") - .get("hideDetailedConsoleQueryOutput", true); + .get("hideSourceExpressions", true); } export function setOutputWordWrapper(): void { diff --git a/src/utils/registration.ts b/src/utils/registration.ts index 6d5052300..e08dee4cc 100644 --- a/src/utils/registration.ts +++ b/src/utils/registration.ts @@ -23,7 +23,7 @@ export function showRegistrationNotification(): void { .get("kdb.hideSubscribeRegistrationNotification", false); if (setting === false) { notify( - "Subscribe to updates", + "Subscribe to the kdb VS Code extension newsletter?", MessageKind.INFO, {}, "Opt-In",