Skip to content

Commit

Permalink
[vscode] Fix Setting editorServer
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryan Holinshead committed Feb 23, 2024
1 parent 47515a1 commit 5bfde38
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions vscode-extension/src/aiConfigEditor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,29 +107,33 @@ export class AIConfigEditorProvider implements vscode.CustomTextEditorProvider {

// Start the AIConfig editor server process. Don't await at the top level here since that blocks the
// webview render (which happens only when resolveCustomTextEditor returns)
this.startEditorServer(document).then(async (editorServer) => {
editorServer = editorServer;
this.startEditorServer(document).then(async (startedServer) => {
editorServer = startedServer;

this.aiconfigEditorManager.addEditor(
new AIConfigEditorState(
document,
webviewPanel,
editorServer,
startedServer,
this.aiconfigEditorManager
)
);

// Wait for server ready
await waitUntilServerReady(editorServer.url);
await waitUntilServerReady(startedServer.url);

// Now set up the server with the latest document content
await this.startServerWithRetry(editorServer.url, document, webviewPanel);
await this.startServerWithRetry(
startedServer.url,
document,
webviewPanel
);

// Inform the webview of the server URL
if (!isWebviewDisposed) {
webviewPanel.webview.postMessage({
type: "set_server_url",
url: editorServer.url,
url: startedServer.url,
});
}
});
Expand Down

0 comments on commit 5bfde38

Please sign in to comment.