3
3
* SPDX-License-Identifier: Apache-2.0
4
4
*/
5
5
6
- import { fs , getNodeExecutableName , BaseLspInstaller , ResourcePaths } from 'aws-core-vscode/shared'
6
+ import { fs , getNodeExecutableName , getRgExecutableName , BaseLspInstaller , ResourcePaths } from 'aws-core-vscode/shared'
7
7
import path from 'path'
8
8
import { ExtendedAmazonQLSPConfig , getAmazonQLspConfig } from './config'
9
9
10
10
export interface AmazonQResourcePaths extends ResourcePaths {
11
11
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
12
17
}
13
18
14
19
export class AmazonQLspInstaller extends BaseLspInstaller . BaseLspInstaller <
@@ -22,21 +27,27 @@ export class AmazonQLspInstaller extends BaseLspInstaller.BaseLspInstaller<
22
27
protected override async postInstall ( assetDirectory : string ) : Promise < void > {
23
28
const resourcePaths = this . resourcePaths ( assetDirectory )
24
29
await fs . chmod ( resourcePaths . node , 0o755 )
30
+ if ( await fs . exists ( resourcePaths . ripGrep ) ) {
31
+ await fs . chmod ( resourcePaths . ripGrep , 0o755 )
32
+ }
25
33
}
26
34
27
35
protected override resourcePaths ( assetDirectory ?: string ) : AmazonQResourcePaths {
28
36
if ( ! assetDirectory ) {
29
37
return {
30
38
lsp : this . config . path ?? '' ,
31
39
node : getNodeExecutableName ( ) ,
40
+ ripGrep : `ripgrep/${ getRgExecutableName ( ) } ` ,
32
41
ui : this . config . ui ?? '' ,
33
42
}
34
43
}
35
44
36
45
const nodePath = path . join ( assetDirectory , `servers/${ getNodeExecutableName ( ) } ` )
46
+ const rgPath = path . join ( assetDirectory , `servers/ripgrep/${ getRgExecutableName ( ) } ` )
37
47
return {
38
48
lsp : path . join ( assetDirectory , 'servers/aws-lsp-codewhisperer.js' ) ,
39
49
node : nodePath ,
50
+ ripGrep : rgPath ,
40
51
ui : path . join ( assetDirectory , 'clients/amazonq-ui.js' ) ,
41
52
}
42
53
}
0 commit comments