33 * SPDX-License-Identifier: Apache-2.0
44 */
55
6+ import * as nodeFs from 'fs'
67import vscode from 'vscode'
78import { fs , getNodeExecutableName , getRgExecutableName , BaseLspInstaller , ResourcePaths } from 'aws-core-vscode/shared'
89import path from 'path'
@@ -45,11 +46,15 @@ export class AmazonQLspInstaller extends BaseLspInstaller.BaseLspInstaller<
4546
4647 const nodePath = path . join ( assetDirectory , `servers/${ getNodeExecutableName ( ) } ` )
4748 const rgPath = path . join ( assetDirectory , `servers/ripgrep/${ getRgExecutableName ( ) } ` )
49+ // Check for amazonq-ui.js in both locations for backwards compatibility
50+ const amazonqUiInClientsPath = path . join ( assetDirectory , 'clients/amazonq-ui.js' )
51+ const amazonqUiInServersPath = path . join ( assetDirectory , 'servers/amazonq-ui.js' )
52+ const uiPath = nodeFs . existsSync ( amazonqUiInClientsPath ) ? amazonqUiInClientsPath : amazonqUiInServersPath
4853 return {
4954 lsp : path . join ( assetDirectory , 'servers/aws-lsp-codewhisperer.js' ) ,
5055 node : nodePath ,
5156 ripGrep : rgPath ,
52- ui : path . join ( assetDirectory , 'clients/amazonq-ui.js' ) ,
57+ ui : uiPath ,
5358 }
5459 }
5560
@@ -58,10 +63,14 @@ export class AmazonQLspInstaller extends BaseLspInstaller.BaseLspInstaller<
5863
5964export function getBundledResourcePaths ( ctx : vscode . ExtensionContext ) : AmazonQResourcePaths {
6065 const assetDirectory = vscode . Uri . joinPath ( ctx . extensionUri , 'resources' , 'language-server' ) . fsPath
66+ // Check for amazonq-ui.js in both locations for backwards compatibility
67+ const amazonqUiInClientsPath = path . join ( assetDirectory , 'clients/amazonq-ui.js' )
68+ const amazonqUiInServersPath = path . join ( assetDirectory , 'servers/amazonq-ui.js' )
69+ const uiPath = nodeFs . existsSync ( amazonqUiInClientsPath ) ? amazonqUiInClientsPath : amazonqUiInServersPath
6170 return {
6271 lsp : path . join ( assetDirectory , 'servers' , 'aws-lsp-codewhisperer.js' ) ,
6372 node : process . execPath ,
6473 ripGrep : '' ,
65- ui : path . join ( assetDirectory , 'clients' , 'amazonq-ui.js' ) ,
74+ ui : uiPath ,
6675 }
6776}
0 commit comments