🐛 small fixes
This commit is contained in:
parent
539c6a8ac3
commit
45951a9237
8 changed files with 29 additions and 11 deletions
|
|
@ -27,15 +27,15 @@ import java.io.File
|
|||
import java.net.NetworkInterface
|
||||
import java.net.URI
|
||||
import java.util.*
|
||||
//import io.socket.client.IO
|
||||
//import io.socket.client.Socket
|
||||
//
|
||||
//
|
||||
//var uri: URI = URI.create("https://example.com")
|
||||
//var options: IO.Options = IO.Options.builder() // ...
|
||||
// .build()
|
||||
//
|
||||
//var socket: Socket = IO.socket(uri, options)
|
||||
import io.socket.client.IO
|
||||
import io.socket.client.Socket
|
||||
|
||||
|
||||
var uri: URI = URI.create("https://example.com")
|
||||
var options: IO.Options = IO.Options.builder()
|
||||
.build()
|
||||
|
||||
var socket: Socket = IO.socket(uri, options)
|
||||
|
||||
fun uuid(): String {
|
||||
return UUID.randomUUID().toString()
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import kotlinx.coroutines.CoroutineScope
|
|||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.cancel
|
||||
import kotlinx.coroutines.launch
|
||||
import java.util.UUID
|
||||
|
||||
@Service(Service.Level.PROJECT)
|
||||
class ContinuePluginService(project: Project) : Disposable {
|
||||
|
|
@ -20,6 +21,7 @@ class ContinuePluginService(project: Project) : Disposable {
|
|||
var ideProtocolClient: IdeProtocolClient? = null
|
||||
var sessionId: String? = null
|
||||
var worksapcePaths: Array<String>? = null
|
||||
var windowId: String = UUID.randomUUID().toString()
|
||||
|
||||
override fun dispose() {
|
||||
coroutineScope.cancel()
|
||||
|
|
|
|||
|
|
@ -82,6 +82,15 @@ class ContinuePluginToolWindowFactory : ToolWindowFactory, DumbAware {
|
|||
when (type) {
|
||||
"onLoad" -> {
|
||||
GlobalScope.launch {
|
||||
println("onLoad..............................")
|
||||
browser.executeJavaScriptAsync(
|
||||
"window.windowId = \"${continuePluginService.windowId}\";" +
|
||||
"window.serverUrl = \"${getContinueServerUrl()}\";" +
|
||||
"window.vscMachineId = \"${getMachineUniqueID()}\";" +
|
||||
"window.vscMediaUrl = \"http://continue\";" +
|
||||
"window.workspacePaths = ${Gson().toJson(continuePluginService.worksapcePaths)};"
|
||||
)
|
||||
|
||||
// Set the colors to match Intellij theme
|
||||
val globalScheme = EditorColorsManager.getInstance().globalScheme
|
||||
val defaultBackground = globalScheme.defaultBackground
|
||||
|
|
|
|||
|
|
@ -666,6 +666,7 @@ const ComboBox = React.forwardRef((props: ComboBoxProps, ref) => {
|
|||
}
|
||||
dispatch(setTakenActionTrue(null));
|
||||
} else if (event.data.type === "focusContinueInputWithNewSession") {
|
||||
client?.stopSession();
|
||||
dispatch(newSession());
|
||||
dispatch(setTakenActionTrue(null));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -127,6 +127,7 @@ const Layout = () => {
|
|||
useEffect(() => {
|
||||
const handleKeyDown = (event: any) => {
|
||||
if (event.metaKey && event.altKey && event.code === "KeyN") {
|
||||
client?.stopSession();
|
||||
dispatch(newSession());
|
||||
}
|
||||
if ((event.metaKey || event.ctrlKey) && event.code === "KeyC") {
|
||||
|
|
|
|||
|
|
@ -32,6 +32,9 @@ function useSetup(
|
|||
useEffect(() => {
|
||||
// Override persisted state
|
||||
dispatch(setActive(false));
|
||||
|
||||
// Tell JetBrains the webview is ready
|
||||
postToIde("onLoad", {});
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
|
|
|
|||
|
|
@ -464,7 +464,7 @@ function GUI(props: GUIProps) {
|
|||
let userInputIndex = -1;
|
||||
for (let i = index; i >= 0; i--) {
|
||||
if (
|
||||
sessionState.history.length > i &&
|
||||
typeof sessionState.history[i] !== "undefined" &&
|
||||
sessionState.history[i].name === "User Input" &&
|
||||
sessionState.history[i].hide === false
|
||||
) {
|
||||
|
|
@ -477,7 +477,7 @@ function GUI(props: GUIProps) {
|
|||
|
||||
for (let i = userInputIndex + 1; i < sessionState.history.length; i++) {
|
||||
if (
|
||||
sessionState.history.length > i &&
|
||||
typeof sessionState.history[i] !== "undefined" &&
|
||||
sessionState.history[i].name === "User Input" &&
|
||||
sessionState.history[i].hide === false
|
||||
) {
|
||||
|
|
@ -571,6 +571,7 @@ function GUI(props: GUIProps) {
|
|||
{sessionState.history.filter((n) => !n.hide).length > 0 && (
|
||||
<HeaderButtonWithText
|
||||
onClick={() => {
|
||||
client?.stopSession();
|
||||
dispatch(newSession());
|
||||
}}
|
||||
text="New Session (⌥⌘N)"
|
||||
|
|
|
|||
|
|
@ -218,6 +218,7 @@ function History() {
|
|||
}
|
||||
const json: PersistedSessionInfo =
|
||||
await response.json();
|
||||
client?.stopSession();
|
||||
dispatch(newSession(json));
|
||||
navigate("/");
|
||||
}}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue