Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
saranshsaini committed Jan 25, 2025
1 parent d06f05a commit c7ca2e0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
11 changes: 8 additions & 3 deletions CodeiumVS/LanguageServer/LanguageServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -759,6 +759,7 @@ private async Task InitializeTrackedWorkspaceAsync()
string projectListPath = _package.SettingsPage.IndexingFilesListPath.Trim();
try
{
projectListPath = projectListPath.Trim();
if (!string.IsNullOrEmpty(projectListPath) && File.Exists(projectListPath))
{
string[] lines = File.ReadAllLines(projectListPath);
Expand Down Expand Up @@ -806,12 +807,16 @@ private async Task InitializeTrackedWorkspaceAsync()

private async Task<List<string>> GetFilesToIndex(HashSet<string> processedProjects, HashSet<string> openFilePaths, int remainingToFind, DTE dte)
{

await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();
HashSet<string> openFilesProjectsToIndexPath = new HashSet<string>();
HashSet<string> remainingProjectsToIndexPath = new HashSet<string>();
async Task AddFilesToIndexLists(EnvDTE.Project project)
async Task AddFilesToIndexLists(EnvDTE.Project project);
// Safeguard against any edge case I didn't think of
int maxRecursiveCalls = 50;
{
if (openFilesProjectsToIndexPath.Count >= remainingToFind || (openFilePaths.Count == 0 && remainingProjectsToIndexPath.Count >= remainingToFind))
maxRecursiveCalls--;
if (openFilesProjectsToIndexPath.Count >= remainingToFind || (openFilePaths.Count == 0 && remainingProjectsToIndexPath.Count >= remainingToFind) || maxRecursiveCalls == 0)
{
return;
}
Expand Down Expand Up @@ -860,7 +865,7 @@ async Task AddFilesToIndexLists(EnvDTE.Project project)
foreach (var path in fullPaths.Skip(1))
{
string directory = Path.GetDirectoryName(path);
while (!directory.StartsWith(commonRoot, StringComparison.OrdinalIgnoreCase) && commonRoot.Split("\\").Length > 3)
while (!directory.StartsWith(commonRoot, StringComparison.OrdinalIgnoreCase) && commonRoot.Split(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar).Where(s => !string.IsNullOrWhiteSpace(s)).Count() > 4)
{
commonRoot = Path.GetDirectoryName(commonRoot);
}
Expand Down
2 changes: 1 addition & 1 deletion CodeiumVS/source.extension.vsixmanifest
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<PackageManifest Version="2.0.0" xmlns="http://schemas.microsoft.com/developer/vsx-schema/2011" xmlns:d="http://schemas.microsoft.com/developer/vsx-schema-design/2011">
<Metadata>
<Identity Id="Codeium.VisualStudio" Version="1.8.97" Language="en-US" Publisher="Codeium" />
<Identity Id="Codeium.VisualStudio" Version="1.8.98" Language="en-US" Publisher="Codeium" />
<DisplayName>Codeium</DisplayName>
<Description xml:space="preserve">The modern coding superpower: free AI code acceleration plugin for your favorite languages. Type less. Code more. Ship faster.</Description>
<MoreInfo>https://www.codeium.com</MoreInfo>
Expand Down

0 comments on commit c7ca2e0

Please sign in to comment.