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'
77import path from 'path'
88import { ExtendedAmazonQLSPConfig , getAmazonQLspConfig } from './config'
99
1010export 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
1419export 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 }
0 commit comments