From 5ab518d09d10891a49e9943546e35534b89a6f73 Mon Sep 17 00:00:00 2001 From: Saransh Saini <66969478+saranshsaini@users.noreply.github.com> Date: Tue, 24 Dec 2024 14:52:44 -0800 Subject: [PATCH] Add try catch around indexing (#152) * fix * version --- CodeiumVS/LanguageServer/LanguageServer.cs | 25 +++++++++++++++++----- CodeiumVS/source.extension.vsixmanifest | 2 +- 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/CodeiumVS/LanguageServer/LanguageServer.cs b/CodeiumVS/LanguageServer/LanguageServer.cs index 07475cd..7e570bd 100644 --- a/CodeiumVS/LanguageServer/LanguageServer.cs +++ b/CodeiumVS/LanguageServer/LanguageServer.cs @@ -1,4 +1,4 @@ -using CodeiumVS.Packets; +using CodeiumVS.Packets; using EnvDTE; using Microsoft.VisualStudio; using Microsoft.VisualStudio.Imaging; @@ -854,17 +854,32 @@ async Task AddFilesToIndexLists(EnvDTE.Project project) foreach (EnvDTE.ProjectItem item in project.ProjectItems) { - if (item.SubProject != null) + try { - await AddFilesToIndexLists(item.SubProject); - + if (item.SubProject != null) + { + await AddFilesToIndexLists(item.SubProject); + } + } + catch (Exception ex) + { + await _package.LogAsync($"Failed to process sub-project: {ex.Message}"); + continue; } } } foreach (EnvDTE.Project project in dte.Solution.Projects) { - await AddFilesToIndexLists(project); + try + { + await AddFilesToIndexLists(project); + } + catch (Exception ex) + { + await _package.LogAsync($"Failed to process project: {ex.Message}"); + continue; + } } List result = new List(); result.AddRange(specifiedProjectsToIndexPath); diff --git a/CodeiumVS/source.extension.vsixmanifest b/CodeiumVS/source.extension.vsixmanifest index 5fb45c3..d6b7696 100644 --- a/CodeiumVS/source.extension.vsixmanifest +++ b/CodeiumVS/source.extension.vsixmanifest @@ -1,7 +1,7 @@ - + Codeium The modern coding superpower: free AI code acceleration plugin for your favorite languages. Type less. Code more. Ship faster. https://www.codeium.com