File tree Expand file tree Collapse file tree 3 files changed +23
-5
lines changed Expand file tree Collapse file tree 3 files changed +23
-5
lines changed Original file line number Diff line number Diff line change 12
12
{
13
13
"path" : " packages/amazonq" ,
14
14
},
15
+ {
16
+ "path" : " ../language-server-runtimes" ,
17
+ },
18
+ {
19
+ "path" : " ../language-servers" ,
20
+ },
15
21
],
16
22
"settings" : {
17
23
"typescript.tsdk" : " node_modules/typescript/lib" ,
Original file line number Diff line number Diff line change 13
13
"args" : [" --extensionDevelopmentPath=${workspaceFolder}" ],
14
14
"env" : {
15
15
"SSMDOCUMENT_LANGUAGESERVER_PORT" : " 6010" ,
16
- "WEBPACK_DEVELOPER_SERVER" : " http://localhost:8080"
16
+ "WEBPACK_DEVELOPER_SERVER" : " http://localhost:8080" ,
17
17
// Below allows for overrides used during development
18
- // "__AMAZONQLSP_PATH": "${workspaceFolder }/../../../language-servers/app/aws-lsp-codewhisperer-runtimes/out/agent-standalone.js",
19
- // "__AMAZONQLSP_UI": "${workspaceFolder }/../../../language-servers/chat-client/build/amazonq-ui.js"
18
+ "__AMAZONQLSP_PATH" : " ${workspaceFolder}/../../../language-servers/app/aws-lsp-codewhisperer-runtimes/out/agent-standalone.js" ,
19
+ "__AMAZONQLSP_UI" : " ${workspaceFolder}/../../../language-servers/chat-client/build/amazonq-ui.js"
20
20
},
21
21
"envFile" : " ${workspaceFolder}/.local.env" ,
22
22
"outFiles" : [" ${workspaceFolder}/dist/**/*.js" , " ${workspaceFolder}/../core/dist/**/*.js" ],
Original file line number Diff line number Diff line change @@ -604,8 +604,20 @@ export function registerMessageListeners(
604
604
languageClient . onRequest ( openWorkspaceFileRequestType . method , async ( params : OpenWorkspaceFileParams ) => {
605
605
try {
606
606
const uri = vscode . Uri . file ( params . filePath )
607
- const doc = await vscode . workspace . openTextDocument ( uri )
608
- await vscode . window . showTextDocument ( doc , { preview : false } )
607
+
608
+ // Check if the file is already opened in any visible text editor
609
+ const existingEditor = vscode . window . visibleTextEditors . find (
610
+ ( editor ) => editor . document . uri . toString ( ) === uri . toString ( )
611
+ )
612
+
613
+ let doc : vscode . TextDocument
614
+ if ( existingEditor ) {
615
+ // File is already open, use the existing document
616
+ doc = existingEditor . document
617
+ } else {
618
+ // File is not open, open it
619
+ doc = await vscode . workspace . openTextDocument ( uri )
620
+ }
609
621
if ( params . makeActive ) {
610
622
await vscode . window . showTextDocument ( doc , { preview : false , preserveFocus : false } )
611
623
}
You can’t perform that action at this time.
0 commit comments