small updates
This commit is contained in:
parent
c999d37730
commit
cd0a4fd44f
4 changed files with 69 additions and 30 deletions
|
|
@ -30,10 +30,10 @@ class AutocompleteSpinnerWidget(project: Project): EditorBasedWidget(project), S
|
|||
IconLoader.getIcon("/icons/AnimationLoadingIcon/AnimationLoading5(RiderLight).svg", javaClass),
|
||||
IconLoader.getIcon("/icons/AnimationLoadingIcon/AnimationLoading6(RiderLight).svg", javaClass),
|
||||
IconLoader.getIcon("/icons/AnimationLoadingIcon/AnimationLoading7(RiderLight).svg", javaClass),
|
||||
IconLoader.getIcon("/icons/AnimationLoadingIcon/AnimationLoading8(RiderLight).svg", javaClass),
|
||||
)
|
||||
|
||||
init {
|
||||
Disposer.register(project, this)
|
||||
updateIcon()
|
||||
}
|
||||
|
||||
|
|
@ -49,7 +49,7 @@ class AutocompleteSpinnerWidget(project: Project): EditorBasedWidget(project), S
|
|||
|
||||
override fun getTooltipText(): String? {
|
||||
val enabled = service<ContinueExtensionSettings>().state.enableTabAutocomplete
|
||||
return if (enabled) "Continue Autocomplete Enabled" else "Continue Autocomplete Disabled"
|
||||
return if (enabled) "Continue autocomplete enabled" else "Continue autocomplete disabled"
|
||||
}
|
||||
|
||||
override fun getClickConsumer(): Consumer<MouseEvent>? {
|
||||
|
|
@ -70,7 +70,7 @@ class AutocompleteSpinnerWidget(project: Project): EditorBasedWidget(project), S
|
|||
|
||||
// Update the widget
|
||||
val statusBar = WindowManager.getInstance().getStatusBar(project)
|
||||
statusBar.updateWidget(ID())
|
||||
statusBar?.updateWidget(ID())
|
||||
}
|
||||
|
||||
override fun install(statusBar: StatusBar) {
|
||||
|
|
|
|||
|
|
@ -39,10 +39,7 @@ import com.intellij.psi.PsiDocumentManager
|
|||
import com.intellij.testFramework.LightVirtualFile
|
||||
import com.intellij.ui.awt.RelativePoint
|
||||
import com.intellij.util.concurrency.annotations.RequiresEdt
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.withContext
|
||||
import kotlinx.coroutines.*
|
||||
import java.awt.Toolkit
|
||||
import java.awt.datatransfer.StringSelection
|
||||
import java.io.*
|
||||
|
|
@ -347,6 +344,16 @@ class IdeProtocolClient (
|
|||
respond(workspaceDirectories())
|
||||
}
|
||||
|
||||
"getTags" -> {
|
||||
val artifactId = data as? String
|
||||
if (artifactId == null) {
|
||||
respond(emptyList<Any>())
|
||||
return@launch
|
||||
}
|
||||
val tags = getTags(artifactId)
|
||||
respond(tags)
|
||||
}
|
||||
|
||||
"getWorkspaceConfigs" -> {
|
||||
val workspaceDirs = workspaceDirectories()
|
||||
|
||||
|
|
@ -474,15 +481,8 @@ class IdeProtocolClient (
|
|||
"getBranch" -> {
|
||||
// Get the current branch name
|
||||
val dir = (data as Map<String, Any>)["dir"] as String
|
||||
val builder = ProcessBuilder("git", "rev-parse", "--abbrev-ref", "HEAD")
|
||||
builder.directory(File(dir))
|
||||
val process = builder.start()
|
||||
|
||||
val reader = BufferedReader(InputStreamReader(process.inputStream))
|
||||
val output = reader.readLine()
|
||||
process.waitFor()
|
||||
|
||||
respond(output ?: "NONE")
|
||||
val branch = getBranch(dir)
|
||||
respond(branch)
|
||||
}
|
||||
"getRepoName" -> {
|
||||
// Get the current repository name
|
||||
|
|
@ -742,6 +742,41 @@ class IdeProtocolClient (
|
|||
return getMachineUniqueID()
|
||||
}
|
||||
|
||||
suspend fun getBranch(dir: String): String = withContext(Dispatchers.IO) {
|
||||
try {
|
||||
val builder = ProcessBuilder("git", "rev-parse", "--abbrev-ref", "HEAD")
|
||||
builder.directory(File(dir))
|
||||
val process = builder.start()
|
||||
|
||||
val reader = BufferedReader(InputStreamReader(process.inputStream))
|
||||
val output = reader.readLine()
|
||||
|
||||
process.waitFor()
|
||||
|
||||
output ?: "NONE"
|
||||
} catch (e: Exception) {
|
||||
"NONE"
|
||||
}
|
||||
}
|
||||
|
||||
data class IndexTag(val directory: String, val branch: String, val artifactId: String)
|
||||
|
||||
suspend fun getTags(artifactId: String): List<IndexTag> {
|
||||
val workspaceDirs = workspaceDirectories()
|
||||
|
||||
// Collect branches concurrently using Kotlin coroutines
|
||||
val branches = withContext(Dispatchers.IO) {
|
||||
workspaceDirs.map { dir ->
|
||||
async { getBranch(dir) }
|
||||
}.map { it.await() }
|
||||
}
|
||||
|
||||
// Create the list of IndexTag objects
|
||||
return workspaceDirs.mapIndexed { index, directory ->
|
||||
IndexTag(directory, branches[index], artifactId)
|
||||
}
|
||||
}
|
||||
|
||||
fun readFile(filepath: String): String {
|
||||
try {
|
||||
val content = ApplicationManager.getApplication().runReadAction<String?> {
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ class MessageTypes {
|
|||
"getProblems",
|
||||
"subprocess",
|
||||
"getBranch",
|
||||
"getTags",
|
||||
"getIdeInfo",
|
||||
"getIdeSettings",
|
||||
"errorPopup",
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import { ContextSubmenuItem } from "core";
|
||||
import { WebviewMessengerResult } from "core/protocol/util";
|
||||
import {
|
||||
deduplicateArray,
|
||||
getBasename,
|
||||
|
|
@ -10,9 +11,8 @@ import { useCallback, useContext, useEffect, useMemo, useState } from "react";
|
|||
import { useSelector } from "react-redux";
|
||||
import { IdeMessengerContext } from "../context/IdeMessenger";
|
||||
import { selectContextProviderDescriptions } from "../redux/selectors";
|
||||
import { useWebviewListener } from "./useWebviewListener";
|
||||
import { WebviewMessengerResult } from "core/protocol/util";
|
||||
import { getLocalStorage } from "../util/localStorage";
|
||||
import { useWebviewListener } from "./useWebviewListener";
|
||||
|
||||
const MINISEARCH_OPTIONS = {
|
||||
prefix: true,
|
||||
|
|
@ -188,18 +188,6 @@ function useSubmenuContextProviders() {
|
|||
console.debug("Current fallbackResults:", fallbackResults);
|
||||
console.debug("Current minisearches:", Object.keys(minisearches));
|
||||
|
||||
if (!initialLoadComplete) {
|
||||
console.debug("Initial load not complete, returning loading state");
|
||||
return [
|
||||
{
|
||||
id: "loading",
|
||||
title: "Loading...",
|
||||
description: "Please wait while items are being loaded",
|
||||
providerTitle: providerTitle || "unknown",
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
try {
|
||||
const results = getSubmenuSearchResults(providerTitle, query);
|
||||
if (results.length === 0) {
|
||||
|
|
@ -211,6 +199,21 @@ function useSubmenuContextProviders() {
|
|||
providerTitle,
|
||||
};
|
||||
});
|
||||
|
||||
if (fallbackItems.length === 0 && !initialLoadComplete) {
|
||||
console.debug(
|
||||
"Initial load not complete, returning loading state",
|
||||
);
|
||||
return [
|
||||
{
|
||||
id: "loading",
|
||||
title: "Loading...",
|
||||
description: "Please wait while items are being loaded",
|
||||
providerTitle: providerTitle || "unknown",
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
console.debug("Using fallback results:", fallbackItems.length);
|
||||
console.debug("Fallback items:", fallbackItems);
|
||||
return fallbackItems;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue