Skip to content

Commit 3a19856

Browse files
committed
feat(chat): Add ripgrep path
1 parent fbf8bd0 commit 3a19856

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

packages/amazonq/src/lsp/lspInstaller.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* SPDX-License-Identifier: Apache-2.0
44
*/
55

6-
import { fs, getNodeExecutableName, BaseLspInstaller, ResourcePaths } from 'aws-core-vscode/shared'
6+
import { fs, getNodeExecutableName, getRgExecutableName, BaseLspInstaller, ResourcePaths } from 'aws-core-vscode/shared'
77
import path from 'path'
88
import { ExtendedAmazonQLSPConfig, getAmazonQLspConfig } from './config'
99

@@ -22,21 +22,25 @@ export class AmazonQLspInstaller extends BaseLspInstaller.BaseLspInstaller<
2222
protected override async postInstall(assetDirectory: string): Promise<void> {
2323
const resourcePaths = this.resourcePaths(assetDirectory)
2424
await fs.chmod(resourcePaths.node, 0o755)
25+
await fs.chmod(resourcePaths.rg, 0o755)
2526
}
2627

2728
protected override resourcePaths(assetDirectory?: string): AmazonQResourcePaths {
2829
if (!assetDirectory) {
2930
return {
3031
lsp: this.config.path ?? '',
3132
node: getNodeExecutableName(),
33+
rg: getRgExecutableName(),
3234
ui: this.config.ui ?? '',
3335
}
3436
}
3537

3638
const nodePath = path.join(assetDirectory, `servers/${getNodeExecutableName()}`)
39+
const rgPath = path.join(assetDirectory, `servers/${getRgExecutableName()}`)
3740
return {
3841
lsp: path.join(assetDirectory, 'servers/aws-lsp-codewhisperer.js'),
3942
node: nodePath,
43+
rg: rgPath,
4044
ui: path.join(assetDirectory, 'clients/amazonq-ui.js'),
4145
}
4246
}

packages/core/src/shared/lsp/types.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ export interface ResourcePaths {
3838
* Example: `"<cachedir>/aws/toolkits/language-servers/AmazonQ/3.3.0/servers/node"`
3939
*/
4040
node: string
41+
/**
42+
* Path to `rg` (or `rg.exe`) executable/binary.
43+
* Example: `"<cachedir>/aws/toolkits/language-servers/AmazonQ/3.3.0/servers/rg"`
44+
*/
45+
rg: string
4146
}
4247

4348
export interface LspResolution<T extends ResourcePaths> extends LspResult {

packages/core/src/shared/lsp/utils/platform.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ export function getNodeExecutableName(): string {
1313
return process.platform === 'win32' ? 'node.exe' : 'node'
1414
}
1515

16+
export function getRgExecutableName(): string {
17+
return process.platform === 'win32' ? 'rg.exe' : 'rg'
18+
}
19+
1620
/**
1721
* Get a json payload that will be sent to the language server, who is waiting to know what the encryption key is.
1822
* Code reference: https://github.com/aws/language-servers/blob/7da212185a5da75a72ce49a1a7982983f438651a/client/vscode/src/credentialsActivation.ts#L77

0 commit comments

Comments
 (0)