diff --git a/clients/eclipse/feature/feature.xml b/clients/eclipse/feature/feature.xml index 6555cd4f7543..658aaa6be516 100644 --- a/clients/eclipse/feature/feature.xml +++ b/clients/eclipse/feature/feature.xml @@ -2,7 +2,7 @@ @@ -19,6 +19,6 @@ + version="0.0.2.32"/> diff --git a/clients/eclipse/plugin/META-INF/MANIFEST.MF b/clients/eclipse/plugin/META-INF/MANIFEST.MF index 9c9e3de5e32c..ba56a202848b 100644 --- a/clients/eclipse/plugin/META-INF/MANIFEST.MF +++ b/clients/eclipse/plugin/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Tabby Plugin for Eclipse Bundle-SymbolicName: com.tabbyml.tabby4eclipse;singleton:=true -Bundle-Version: 0.0.2.31 +Bundle-Version: 0.0.2.32 Bundle-Activator: com.tabbyml.tabby4eclipse.Activator Bundle-Vendor: com.tabbyml Require-Bundle: org.eclipse.ui, diff --git a/clients/eclipse/plugin/src/com/tabbyml/tabby4eclipse/Version.java b/clients/eclipse/plugin/src/com/tabbyml/tabby4eclipse/Version.java index 58cba2420a50..c567a1dd9860 100644 --- a/clients/eclipse/plugin/src/com/tabbyml/tabby4eclipse/Version.java +++ b/clients/eclipse/plugin/src/com/tabbyml/tabby4eclipse/Version.java @@ -67,6 +67,10 @@ public boolean isEqual(Version other, boolean ignorePatch) { return this.patch == other.patch; } + public boolean isZero() { + return this.major == 0 && this.minor == 0 && this.patch == 0; + } + private int parseInt(String str) { try { return Integer.parseInt(str); diff --git a/clients/eclipse/plugin/src/com/tabbyml/tabby4eclipse/chat/ChatViewUtils.java b/clients/eclipse/plugin/src/com/tabbyml/tabby4eclipse/chat/ChatViewUtils.java index f3992776b9ec..bbe763fc2b34 100644 --- a/clients/eclipse/plugin/src/com/tabbyml/tabby4eclipse/chat/ChatViewUtils.java +++ b/clients/eclipse/plugin/src/com/tabbyml/tabby4eclipse/chat/ChatViewUtils.java @@ -88,7 +88,7 @@ public static String checkServerHealth(Map serverHealth) { if (version != null) { Version parsedVersion = new Version(version); Version requiredVersion = new Version(MIN_SERVER_VERSION); - if (!parsedVersion.isGreaterOrEqualThan(requiredVersion)) { + if (!parsedVersion.isZero() && !parsedVersion.isGreaterOrEqualThan(requiredVersion)) { return String.format( "Tabby Chat requires Tabby server version %s or later. Your server is running version %s.", MIN_SERVER_VERSION, version); @@ -212,24 +212,25 @@ public static boolean openInEditor(FileLocation fileLocation) { public static void openExternal(String url) { Program.launch(url); } - + public static List readGitRepositoriesInWorkspace() { List repositories = new ArrayList<>(); - IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot(); - IProject[] projects = workspaceRoot.getProjects(); - - for (IProject project : projects) { - try { - URI projectRootUri = project.getLocation().toFile().toURI(); - com.tabbyml.tabby4eclipse.lsp.protocol.GitRepository repo = GitProvider.getInstance().getRepository(new GitRepositoryParams(projectRootUri.toString())); - if (repo != null) { - repositories.add(new GitRepository(repo.getRemoteUrl())); - } - } catch (Exception e) { - logger.warn("Error when read git repository.", e); - } - } - return repositories; + IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot(); + IProject[] projects = workspaceRoot.getProjects(); + + for (IProject project : projects) { + try { + URI projectRootUri = project.getLocation().toFile().toURI(); + com.tabbyml.tabby4eclipse.lsp.protocol.GitRepository repo = GitProvider.getInstance() + .getRepository(new GitRepositoryParams(projectRootUri.toString())); + if (repo != null) { + repositories.add(new GitRepository(repo.getRemoteUrl())); + } + } catch (Exception e) { + logger.warn("Error when read git repository.", e); + } + } + return repositories; } public static void setClipboardContent(String content) { @@ -261,7 +262,8 @@ public static void applyContentInEditor(String content) { public static Filepath fileUriToChatPanelFilepath(URI fileUri) { String fileUriString = fileUri.toString(); - com.tabbyml.tabby4eclipse.lsp.protocol.GitRepository gitRepo = GitProvider.getInstance().getRepository(new GitRepositoryParams(fileUriString)); + com.tabbyml.tabby4eclipse.lsp.protocol.GitRepository gitRepo = GitProvider.getInstance() + .getRepository(new GitRepositoryParams(fileUriString)); String gitUrl = (gitRepo != null) ? gitRepo.getRemoteUrl() : null; if (gitUrl != null) { gitRemoteUrlToLocalRoot.put(gitUrl, gitRepo.getRoot());