Skip to content

Commit

Permalink
ProjectConfigService.GetItemsFromProjectConfig now returns a list
Browse files Browse the repository at this point in the history
  • Loading branch information
Irame committed Sep 27, 2023
1 parent 25a0a03 commit dc62322
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public interface IProjectConfigService
{
bool IsSupportedProject(IVsHierarchyWrapper project);

void GetItemsFromProjectConfig(IVsHierarchyWrapper project, List<CmdItemJson> allArgs);
List<CmdItemJson> GetItemsFromProjectConfig(IVsHierarchyWrapper project);

void UpdateProjectConfig(IVsHierarchyWrapper project);
}
Expand Down Expand Up @@ -698,17 +698,21 @@ private static bool TryGetProjectConfigHandlers(IVsHierarchyWrapper project, out
return supportedProjects.TryGetValue(projectKind, out handler);
}

public void GetItemsFromProjectConfig(IVsHierarchyWrapper project, List<CmdItemJson> allArgs)
public List<CmdItemJson> GetItemsFromProjectConfig(IVsHierarchyWrapper project)
{
var result = new List<CmdItemJson>();

if (TryGetProjectConfigHandlers(project, out ProjectConfigHandlers handler))
{
handler.GetItemsFromConfig(
project.GetProject(),
allArgs,
result,
includeArgs: optionsSettings.ManageCommandLineArgs,
includeEnvVars: optionsSettings.ManageEnvironmentVars,
includeWorkDir: optionsSettings.ManageWorkingDirectories);
}

return result;
}

public void UpdateProjectConfig(IVsHierarchyWrapper project)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ public void UpdateCommandsForProject(IVsHierarchyWrapper project)
projectData = new ProjectDataJson();

Logger.Info($"Gathering commands from configurations for project '{project.GetName()}'.");
projectData.Items.AddRange(ReadCommandlineArgumentsFromProject(project));
projectData.Items.AddRange(projectConfig.GetItemsFromProjectConfig(project));
}

// push projectData to the ViewModel
Expand All @@ -197,13 +197,6 @@ public void UpdateCommandsForProject(IVsHierarchyWrapper project)
Logger.Info($"Updated Commands for project '{project.GetName()}'.");
}

private List<CmdItemJson> ReadCommandlineArgumentsFromProject(IVsHierarchyWrapper project)
{
var prjCmdArgs = new List<CmdItemJson>();
projectConfig.GetItemsFromProjectConfig(project, prjCmdArgs);
return prjCmdArgs;
}

private ISet<CmdParameter> GetAllActiveItemsForProject(IVsHierarchyWrapper project)
{
if (!optionsSettings.ManageCommandLineArgs
Expand Down

0 comments on commit dc62322

Please sign in to comment.