From 0d6cb863bd43d15a83f2e995b007325c636c96e1 Mon Sep 17 00:00:00 2001 From: Jason Guo Date: Thu, 15 May 2025 13:58:08 -0700 Subject: [PATCH 1/3] feat(chat): Add ripgrep path --- ...eature-09ac6888-de83-418b-afa7-d1cc58f687b2.json | 4 ++++ packages/amazonq/src/lsp/lspInstaller.ts | 13 ++++++++++++- packages/core/src/shared/lsp/utils/platform.ts | 4 ++++ 3 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 packages/amazonq/.changes/next-release/Feature-09ac6888-de83-418b-afa7-d1cc58f687b2.json diff --git a/packages/amazonq/.changes/next-release/Feature-09ac6888-de83-418b-afa7-d1cc58f687b2.json b/packages/amazonq/.changes/next-release/Feature-09ac6888-de83-418b-afa7-d1cc58f687b2.json new file mode 100644 index 00000000000..a16bfd0afce --- /dev/null +++ b/packages/amazonq/.changes/next-release/Feature-09ac6888-de83-418b-afa7-d1cc58f687b2.json @@ -0,0 +1,4 @@ +{ + "type": "Feature", + "description": "Add grepSearch dependency for agentic chat" +} diff --git a/packages/amazonq/src/lsp/lspInstaller.ts b/packages/amazonq/src/lsp/lspInstaller.ts index 72fa091f027..ecc39a00b14 100644 --- a/packages/amazonq/src/lsp/lspInstaller.ts +++ b/packages/amazonq/src/lsp/lspInstaller.ts @@ -3,12 +3,17 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { fs, getNodeExecutableName, BaseLspInstaller, ResourcePaths } from 'aws-core-vscode/shared' +import { fs, getNodeExecutableName, getRgExecutableName, BaseLspInstaller, ResourcePaths } from 'aws-core-vscode/shared' import path from 'path' import { ExtendedAmazonQLSPConfig, getAmazonQLspConfig } from './config' export interface AmazonQResourcePaths extends ResourcePaths { ui: string + /** + * Path to `rg` (or `rg.exe`) executable/binary. + * Example: `"/aws/toolkits/language-servers/AmazonQ/3.3.0/servers/rg"` + */ + rg: string } export class AmazonQLspInstaller extends BaseLspInstaller.BaseLspInstaller< @@ -22,6 +27,9 @@ export class AmazonQLspInstaller extends BaseLspInstaller.BaseLspInstaller< protected override async postInstall(assetDirectory: string): Promise { const resourcePaths = this.resourcePaths(assetDirectory) await fs.chmod(resourcePaths.node, 0o755) + if (await fs.exists(resourcePaths.rg)) { + await fs.chmod(resourcePaths.rg, 0o755) + } } protected override resourcePaths(assetDirectory?: string): AmazonQResourcePaths { @@ -29,14 +37,17 @@ export class AmazonQLspInstaller extends BaseLspInstaller.BaseLspInstaller< return { lsp: this.config.path ?? '', node: getNodeExecutableName(), + rg: `ripgrep/${getRgExecutableName()}`, ui: this.config.ui ?? '', } } const nodePath = path.join(assetDirectory, `servers/${getNodeExecutableName()}`) + const rgPath = path.join(assetDirectory, `servers/ripgrep/${getRgExecutableName()}`) return { lsp: path.join(assetDirectory, 'servers/aws-lsp-codewhisperer.js'), node: nodePath, + rg: rgPath, ui: path.join(assetDirectory, 'clients/amazonq-ui.js'), } } diff --git a/packages/core/src/shared/lsp/utils/platform.ts b/packages/core/src/shared/lsp/utils/platform.ts index 2555793ceb5..39284e8a0ac 100644 --- a/packages/core/src/shared/lsp/utils/platform.ts +++ b/packages/core/src/shared/lsp/utils/platform.ts @@ -13,6 +13,10 @@ export function getNodeExecutableName(): string { return process.platform === 'win32' ? 'node.exe' : 'node' } +export function getRgExecutableName(): string { + return process.platform === 'win32' ? 'rg.exe' : 'rg' +} + /** * Get a json payload that will be sent to the language server, who is waiting to know what the encryption key is. * Code reference: https://github.com/aws/language-servers/blob/7da212185a5da75a72ce49a1a7982983f438651a/client/vscode/src/credentialsActivation.ts#L77 From 4ea4a0121100ef797e6556f0ef8ae1c7fa7b1a20 Mon Sep 17 00:00:00 2001 From: Jason Guo Date: Thu, 15 May 2025 17:03:17 -0700 Subject: [PATCH 2/3] update rg path name --- packages/amazonq/src/lsp/lspInstaller.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/amazonq/src/lsp/lspInstaller.ts b/packages/amazonq/src/lsp/lspInstaller.ts index ecc39a00b14..84d5ee8961b 100644 --- a/packages/amazonq/src/lsp/lspInstaller.ts +++ b/packages/amazonq/src/lsp/lspInstaller.ts @@ -13,7 +13,7 @@ export interface AmazonQResourcePaths extends ResourcePaths { * Path to `rg` (or `rg.exe`) executable/binary. * Example: `"/aws/toolkits/language-servers/AmazonQ/3.3.0/servers/rg"` */ - rg: string + ripGrep: string } export class AmazonQLspInstaller extends BaseLspInstaller.BaseLspInstaller< @@ -27,8 +27,8 @@ export class AmazonQLspInstaller extends BaseLspInstaller.BaseLspInstaller< protected override async postInstall(assetDirectory: string): Promise { const resourcePaths = this.resourcePaths(assetDirectory) await fs.chmod(resourcePaths.node, 0o755) - if (await fs.exists(resourcePaths.rg)) { - await fs.chmod(resourcePaths.rg, 0o755) + if (await fs.exists(resourcePaths.ripGrep)) { + await fs.chmod(resourcePaths.ripGrep, 0o755) } } @@ -37,7 +37,7 @@ export class AmazonQLspInstaller extends BaseLspInstaller.BaseLspInstaller< return { lsp: this.config.path ?? '', node: getNodeExecutableName(), - rg: `ripgrep/${getRgExecutableName()}`, + ripGrep: `ripgrep/${getRgExecutableName()}`, ui: this.config.ui ?? '', } } @@ -47,7 +47,7 @@ export class AmazonQLspInstaller extends BaseLspInstaller.BaseLspInstaller< return { lsp: path.join(assetDirectory, 'servers/aws-lsp-codewhisperer.js'), node: nodePath, - rg: rgPath, + ripGrep: rgPath, ui: path.join(assetDirectory, 'clients/amazonq-ui.js'), } } From 9cd0fdbf4754f2a9540183fa89f4bb85452c9669 Mon Sep 17 00:00:00 2001 From: Jason Guo Date: Mon, 19 May 2025 13:40:57 -0700 Subject: [PATCH 3/3] remove changelog --- .../Feature-09ac6888-de83-418b-afa7-d1cc58f687b2.json | 4 ---- 1 file changed, 4 deletions(-) delete mode 100644 packages/amazonq/.changes/next-release/Feature-09ac6888-de83-418b-afa7-d1cc58f687b2.json diff --git a/packages/amazonq/.changes/next-release/Feature-09ac6888-de83-418b-afa7-d1cc58f687b2.json b/packages/amazonq/.changes/next-release/Feature-09ac6888-de83-418b-afa7-d1cc58f687b2.json deleted file mode 100644 index a16bfd0afce..00000000000 --- a/packages/amazonq/.changes/next-release/Feature-09ac6888-de83-418b-afa7-d1cc58f687b2.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "type": "Feature", - "description": "Add grepSearch dependency for agentic chat" -}