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 1212 {
1313 "path" : " packages/amazonq" ,
1414 },
15+ {
16+ "path" : " ../language-server-runtimes" ,
17+ },
18+ {
19+ "path" : " ../language-servers" ,
20+ },
1521 ],
1622 "settings" : {
1723 "typescript.tsdk" : " node_modules/typescript/lib" ,
Original file line number Diff line number Diff line change 1313 "args" : [" --extensionDevelopmentPath=${workspaceFolder}" ],
1414 "env" : {
1515 "SSMDOCUMENT_LANGUAGESERVER_PORT" : " 6010" ,
16- "WEBPACK_DEVELOPER_SERVER" : " http://localhost:8080"
16+ "WEBPACK_DEVELOPER_SERVER" : " http://localhost:8080" ,
1717 // 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"
2020 },
2121 "envFile" : " ${workspaceFolder}/.local.env" ,
2222 "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(
604604 languageClient . onRequest ( openWorkspaceFileRequestType . method , async ( params : OpenWorkspaceFileParams ) => {
605605 try {
606606 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+ }
609621 if ( params . makeActive ) {
610622 await vscode . window . showTextDocument ( doc , { preview : false , preserveFocus : false } )
611623 }
You can’t perform that action at this time.
0 commit comments