Merge pull request #4600 from continuedev/tomasz/jetbrains-explore
Add jetbrains explore hub onboarding card
This commit is contained in:
commit
603feae3d7
8 changed files with 50 additions and 15 deletions
13
core/core.ts
13
core/core.ts
|
|
@ -934,6 +934,15 @@ export class Core {
|
|||
void refreshIfNotIgnored(data.uris);
|
||||
}
|
||||
});
|
||||
|
||||
on("files/closed", async ({ data }) => {
|
||||
if (data.uris) {
|
||||
this.messenger.send("didCloseFiles", {
|
||||
uris: data.uris,
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
on("files/opened", async ({ data }) => {
|
||||
if (data?.uris?.length) {
|
||||
// Do something on files opened
|
||||
|
|
@ -1003,10 +1012,6 @@ export class Core {
|
|||
});
|
||||
|
||||
on("didChangeActiveTextEditor", async ({ data: { filepath } }) => {
|
||||
this.messenger.send("didChangeActiveTextEditor", {
|
||||
filepath,
|
||||
});
|
||||
|
||||
try {
|
||||
const ignore = shouldIgnore(filepath, this.ide);
|
||||
if (!ignore) {
|
||||
|
|
|
|||
|
|
@ -184,6 +184,7 @@ export type ToCoreFromIdeOrWebviewProtocol = {
|
|||
"files/opened": [{ uris?: string[] }, void];
|
||||
"files/created": [{ uris?: string[] }, void];
|
||||
"files/deleted": [{ uris?: string[] }, void];
|
||||
"files/closed": [{ uris?: string[] }, void];
|
||||
|
||||
// Docs etc. Indexing. TODO move codebase to this
|
||||
"indexing/reindex": [{ type: string; id: string }, void];
|
||||
|
|
|
|||
|
|
@ -84,5 +84,5 @@ export const CORE_TO_WEBVIEW_PASS_THROUGH: (keyof ToWebviewFromCoreProtocol)[] =
|
|||
"getWebviewHistoryLength",
|
||||
"getCurrentSessionId",
|
||||
"docs/suggestions",
|
||||
"didChangeActiveTextEditor",
|
||||
"didCloseFiles",
|
||||
];
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ export type ToWebviewFromIdeOrCoreProtocol = {
|
|||
},
|
||||
void,
|
||||
];
|
||||
didChangeActiveTextEditor: [{ filepath: string }, void];
|
||||
didCloseFiles: [{ uris: string[] }, void];
|
||||
isContinueInputFocused: [undefined, boolean];
|
||||
addContextItem: [
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
package com.github.continuedev.continueintellijextension.activities
|
||||
|
||||
import com.intellij.openapi.fileEditor.FileEditorManagerListener
|
||||
import com.github.continuedev.continueintellijextension.auth.AuthListener
|
||||
import com.github.continuedev.continueintellijextension.auth.ContinueAuthService
|
||||
import com.github.continuedev.continueintellijextension.auth.ControlPlaneSessionInfo
|
||||
|
|
@ -37,6 +37,7 @@ import com.intellij.openapi.vfs.newvfs.events.VFileDeleteEvent
|
|||
import com.intellij.openapi.vfs.newvfs.events.VFileContentChangeEvent
|
||||
import com.intellij.openapi.vfs.newvfs.events.VFileCreateEvent
|
||||
import com.intellij.ide.ui.LafManagerListener
|
||||
import com.intellij.openapi.vfs.VirtualFile
|
||||
|
||||
fun showTutorial(project: Project) {
|
||||
val tutorialFileName = getTutorialFileName()
|
||||
|
|
@ -199,6 +200,24 @@ class ContinuePluginStartupActivity : StartupActivity, DumbAware {
|
|||
}
|
||||
})
|
||||
|
||||
|
||||
connection.subscribe(FileEditorManagerListener.FILE_EDITOR_MANAGER, object : FileEditorManagerListener {
|
||||
override fun fileClosed(source: FileEditorManager, file: VirtualFile) {
|
||||
file.toUriOrNull()?.let { uri ->
|
||||
val data = mapOf("uris" to listOf(uri))
|
||||
continuePluginService.coreMessenger?.request("files/closed", data, null) { _ -> }
|
||||
}
|
||||
}
|
||||
override fun fileOpened(source: FileEditorManager, file: VirtualFile) {
|
||||
file.toUriOrNull()?.let { uri ->
|
||||
val data = mapOf("uris" to listOf(uri))
|
||||
continuePluginService.coreMessenger?.request("files/opened", data, null) { _ -> }
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
|
||||
// Listen for theme changes
|
||||
connection.subscribe(LafManagerListener.TOPIC, LafManagerListener {
|
||||
val colors = GetTheme().getTheme();
|
||||
|
|
|
|||
|
|
@ -71,6 +71,7 @@ class MessageTypes {
|
|||
"getWebviewHistoryLength",
|
||||
"getCurrentSessionId",
|
||||
"docs/suggestions",
|
||||
"didCloseFiles",
|
||||
)
|
||||
|
||||
// Note: If updating these values, make a corresponding update in
|
||||
|
|
|
|||
|
|
@ -310,6 +310,12 @@ export class VsCodeExtension {
|
|||
});
|
||||
});
|
||||
|
||||
vscode.workspace.onDidCloseTextDocument(async (event) => {
|
||||
this.core.invoke("files/closed", {
|
||||
uris: [event.uri.toString()],
|
||||
});
|
||||
});
|
||||
|
||||
vscode.workspace.onDidCreateFiles(async (event) => {
|
||||
this.core.invoke("files/created", {
|
||||
uris: event.files.map((uri) => uri.toString()),
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
import { useRef } from "react";
|
||||
import { useWebviewListener } from "../../hooks/useWebviewListener";
|
||||
import { useAppDispatch } from "../../redux/hooks";
|
||||
import { setIsExploreDialogOpen } from "../../redux/slices/uiSlice";
|
||||
|
|
@ -9,17 +8,21 @@ import {
|
|||
} from "../../util/localStorage";
|
||||
|
||||
const useTutorialListener = (onTutorialClosed: () => void) => {
|
||||
const isTutorialOpenRef = useRef(false);
|
||||
useWebviewListener("didCloseFiles", async (data) => {
|
||||
const uris = data?.uris ?? [];
|
||||
|
||||
useWebviewListener("didChangeActiveTextEditor", async (data) => {
|
||||
const isTutorial =
|
||||
data?.filepath?.toLowerCase().endsWith("continue_tutorial.py") ?? false;
|
||||
const isTutorial = uris.some((uri) => {
|
||||
const lowercaseUri = uri.toLowerCase();
|
||||
return (
|
||||
lowercaseUri.endsWith("continue_tutorial.py") ||
|
||||
lowercaseUri.endsWith("continue_tutorial.java") ||
|
||||
lowercaseUri.endsWith("continue_tutorial.ts")
|
||||
);
|
||||
});
|
||||
|
||||
if (isTutorialOpenRef.current && !isTutorial) {
|
||||
if (isTutorial) {
|
||||
onTutorialClosed();
|
||||
}
|
||||
|
||||
isTutorialOpenRef.current = isTutorial;
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue