diff --git a/binary/build.js b/binary/build.js index 702421830..0b0772873 100644 --- a/binary/build.js +++ b/binary/build.js @@ -120,19 +120,19 @@ async function installNodeModuleInTempDirAndCopyToCurrent(packageName, toCopy) { (async () => { // Informs of where to look for node_sqlite3.node https://www.npmjs.com/package/bindings#:~:text=The%20searching%20for,file%20is%20found // This is only needed for our `pkg` command - fs.writeFileSync( - "out/package.json", - JSON.stringify( - { - name: "binary", - version: "1.0.0", - author: "Continue Dev, Inc", - license: "Apache-2.0", - }, - undefined, - 2, - ), - ); + // fs.writeFileSync( + // "out/package.json", + // JSON.stringify( + // { + // name: "binary", + // version: "1.0.0", + // author: "Continue Dev, Inc", + // license: "Apache-2.0", + // }, + // undefined, + // 2, + // ), + // ); console.log("[info] Downloading prebuilt lancedb..."); for (const target of targets) { diff --git a/binary/package-lock.json b/binary/package-lock.json index 89ecc53cc..e8a453a3a 100644 --- a/binary/package-lock.json +++ b/binary/package-lock.json @@ -48,7 +48,7 @@ "@aws-sdk/client-sagemaker-runtime": "^3.621.0", "@aws-sdk/credential-providers": "^3.620.1", "@continuedev/config-types": "^1.0.13", - "@continuedev/config-yaml": "^1.0.10", + "@continuedev/config-yaml": "^1.0.11", "@continuedev/fetch": "^1.0.4", "@continuedev/llm-info": "^1.0.2", "@continuedev/openai-adapters": "^1.0.10", diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/toolWindow/ContinueBrowser.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/toolWindow/ContinueBrowser.kt index b43cf62c9..30ce8177a 100644 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/toolWindow/ContinueBrowser.kt +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/toolWindow/ContinueBrowser.kt @@ -28,12 +28,16 @@ class ContinueBrowser(val project: Project, url: String) { } val browser: JBCefBrowser + private var browserInitialized = false + init { val isOSREnabled = ServiceManager.getService(ContinueExtensionSettings::class.java).continueState.enableOSR this.browser = JBCefBrowser.createBuilder().setOffScreenRendering(isOSREnabled).build() + + registerAppSchemeHandler() browser.loadURL(url); Disposer.register(ContinuePluginDisposable.getInstance(project), browser) @@ -41,6 +45,21 @@ class ContinueBrowser(val project: Project, url: String) { // Listen for events sent from browser val myJSQueryOpenInBrowser = JBCefJSQuery.create((browser as JBCefBrowserBase?)!!) + browser.jbCefClient.addLoadHandler(object : CefLoadHandlerAdapter() { + override fun onLoadingStateChange( + browser: CefBrowser?, + isLoading: Boolean, + canGoBack: Boolean, + canGoForward: Boolean + ) { + if (!isLoading) { + // The page has finished loading + executeJavaScript(browser, myJSQueryOpenInBrowser) + browserInitialized = true + } + } + }, browser.cefBrowser) + myJSQueryOpenInBrowser.addHandler { msg: String? -> val parser = JsonParser() val json: JsonObject = parser.parse(msg).asJsonObject @@ -114,6 +133,12 @@ class ContinueBrowser(val project: Project, url: String) { data: Any?, messageId: String = uuid() ) { + if (!browserInitialized) { + println("Browser not yet initialized, cannot send message to webview") + return + } + + val jsonData = Gson().toJson( mapOf( "messageId" to messageId,