| 1 | /** |
| 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. |
| 3 | * |
| 4 | * This source code is licensed under the MIT license found in the |
| 5 | * LICENSE file in the root directory of this source tree. |
| 6 | */ |
| 7 | |
| 8 | import serverAPI from './ClientToServerAPI'; |
| 9 | import {lazyAtom} from './jotaiUtils'; |
| 10 | |
| 11 | export const externalMergeToolAtom = lazyAtom(() => { |
| 12 | serverAPI.onConnectOrReconnect(() => { |
| 13 | serverAPI.postMessage({ |
| 14 | type: 'getConfiguredMergeTool', |
| 15 | }); |
| 16 | }); |
| 17 | return serverAPI |
| 18 | .nextMessageMatching('gotConfiguredMergeTool', () => true) |
| 19 | .then(event => event.tool); |
| 20 | }, undefined); |
| 21 | |