Skip to content

Commit 3a175df

Browse files
authored
Merge pull request #7347 from aws/autoMerge/feature/flare-mega
Merge master into feature/flare-mega
2 parents ca75b50 + d66335a commit 3a175df

File tree

4 files changed

+32
-1
lines changed

4 files changed

+32
-1
lines changed

packages/amazonq/src/lsp/lspInstaller.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,17 @@
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

1010
export interface AmazonQResourcePaths extends ResourcePaths {
1111
ui: string
12+
/**
13+
* Path to `rg` (or `rg.exe`) executable/binary.
14+
* Example: `"<cachedir>/aws/toolkits/language-servers/AmazonQ/3.3.0/servers/rg"`
15+
*/
16+
ripGrep: string
1217
}
1318

1419
export class AmazonQLspInstaller extends BaseLspInstaller.BaseLspInstaller<
@@ -22,21 +27,27 @@ export class AmazonQLspInstaller extends BaseLspInstaller.BaseLspInstaller<
2227
protected override async postInstall(assetDirectory: string): Promise<void> {
2328
const resourcePaths = this.resourcePaths(assetDirectory)
2429
await fs.chmod(resourcePaths.node, 0o755)
30+
if (await fs.exists(resourcePaths.ripGrep)) {
31+
await fs.chmod(resourcePaths.ripGrep, 0o755)
32+
}
2533
}
2634

2735
protected override resourcePaths(assetDirectory?: string): AmazonQResourcePaths {
2836
if (!assetDirectory) {
2937
return {
3038
lsp: this.config.path ?? '',
3139
node: getNodeExecutableName(),
40+
ripGrep: `ripgrep/${getRgExecutableName()}`,
3241
ui: this.config.ui ?? '',
3342
}
3443
}
3544

3645
const nodePath = path.join(assetDirectory, `servers/${getNodeExecutableName()}`)
46+
const rgPath = path.join(assetDirectory, `servers/ripgrep/${getRgExecutableName()}`)
3747
return {
3848
lsp: path.join(assetDirectory, 'servers/aws-lsp-codewhisperer.js'),
3949
node: nodePath,
50+
ripGrep: rgPath,
4051
ui: path.join(assetDirectory, 'clients/amazonq-ui.js'),
4152
}
4253
}

packages/core/src/codewhisperer/client/service-2.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -612,11 +612,20 @@
612612
"filename": {
613613
"shape": "FileContextFilenameString"
614614
},
615+
"fileUri": {
616+
"shape": "FileContextFileUriString"
617+
},
615618
"programmingLanguage": {
616619
"shape": "ProgrammingLanguage"
617620
}
618621
}
619622
},
623+
"FileContextFileUriString": {
624+
"type": "string",
625+
"max": 1024,
626+
"min": 1,
627+
"sensitive": true
628+
},
620629
"FileContextFilenameString": {
621630
"type": "string",
622631
"max": 1024,

packages/core/src/codewhisperer/client/user-service-2.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1852,9 +1852,16 @@
18521852
"leftFileContent": { "shape": "FileContextLeftFileContentString" },
18531853
"rightFileContent": { "shape": "FileContextRightFileContentString" },
18541854
"filename": { "shape": "FileContextFilenameString" },
1855+
"fileUri": { "shape": "FileContextFileUriString" },
18551856
"programmingLanguage": { "shape": "ProgrammingLanguage" }
18561857
}
18571858
},
1859+
"FileContextFileUriString": {
1860+
"type": "string",
1861+
"max": 1024,
1862+
"min": 1,
1863+
"sensitive": true
1864+
},
18581865
"FileContextFilenameString": {
18591866
"type": "string",
18601867
"max": 1024,

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)