Skip to content

Commit

Permalink
Removed dialog when loading solution to prevent hangs and OOM excepti…
Browse files Browse the repository at this point in the history
…ons. (Reverts 683139e) (Related to #119, #120, #123, #124)
  • Loading branch information
Irame committed Jan 19, 2022
1 parent 84ac264 commit 64255a7
Showing 1 changed file with 1 addition and 53 deletions.
54 changes: 1 addition & 53 deletions SmartCmdArgs/SmartCmdArgs/CmdArgsPackage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -380,36 +380,6 @@ public void LoadSettings()
vm.VcsSupportEnabled = settings.VcsSupportEnabled;
}

private string FormatCmdArgumentJsonListForMessage(IEnumerable<CmdArgumentJson> list)
{
var sb = new StringBuilder();

internalFormat(list, level: 0);

void internalFormat(IEnumerable<CmdArgumentJson> items, int level)
{
foreach (var arg in items)
{
sb.Append(new string(' ', level * 4));

sb.Append(arg.Command);

if (arg.Items != null)
{
sb.AppendLine(":");
internalFormat(arg.Items, level + 1);
sb.AppendLine();
}
else
{
sb.AppendLine();
}
}
}

return sb.ToString().Trim();
}

private void UpdateCommandsForProject(IVsHierarchy project)
{
if (project == null)
Expand Down Expand Up @@ -506,30 +476,8 @@ private void UpdateCommandsForProject(IVsHierarchy project)
}
else if (IsVcsSupportEnabled)
{
var args = ReadCommandlineArgumentsFromProject(project).ToList();

projectData = new ProjectDataJson();

if (args.Any())
{
var argsStr = FormatCmdArgumentJsonListForMessage(args);

var msgResult = MessageDialog.Show("Smart Command Line Arguments extension", $"VSC support is enabled, and the project '{project.GetName()}' has no associated JSON file but the following arguments in the project configuration:\n\n{argsStr}\n\nShould they be cleared like the missing JSON file dictates?", MessageDialogCommandSet.YesNo);

if (msgResult == MessageDialogCommand.Yes)
{
Logger.Info("Will clear all data because VCS support is enabled, the json file is missing and the user confirmed it.");
}
else
{
Logger.Info($"VCS support is enabled but the JSON file is missing. User don't want to clear the project arguments. Therefore, commands will be gathered from configurations for project '{project.GetName()}'.");
projectData.Items.AddRange(args);
}
}
else
{
Logger.Info("VCS support is enabled but the JSON file is missing. Will use empty project data because of empty project configuration.");
}
Logger.Info("Will clear all data because of missing json file and enabled VCS support.");
}
// we try to read the suo file data
else if (solutionData.ProjectArguments.TryGetValue(projectGuid, out projectData))
Expand Down

0 comments on commit 64255a7

Please sign in to comment.