public async Task LoadInstructionsFromDirectoriesAsync(IEnumerable <string> paths)
        {
            try
            {
                var loadFromDirectoryTasks = paths
                                             .Select(DocPathToAsmType)
                                             .Select(LoadInstructionsFromDirectoryAsync)
                                             .ToArray();

                var results = await Task.WhenAll(loadFromDirectoryTasks).ConfigureAwait(false);

                var instructionSets = results.Where(s => s != null);

                lock (_lock)
                {
                    foreach (var tuple in instructionSets)
                    {
                        var(path, document, set) = tuple;
                        if (document.CurrentSnapshot.TextBuffer.GetTextDocument(out var textDocument))
                        {
                            _sets.Add(path, set);
                            _instructionSetPaths.Add(path, textDocument);
                        }
                    }

                    InstructionsUpdated?.Invoke(_sets.Values);
                }
            }
            catch (AggregateException e)
            {
                var sb = new StringBuilder();
                sb.AppendLine(e.Message);
                sb.AppendLine();

                foreach (var innerEx in e.InnerExceptions)
                {
                    sb.AppendLine(innerEx.Message);
                }

                sb.AppendLine();
                sb.AppendLine("Change the path to instructions");
                Error.ShowErrorMessage(sb.ToString(), "Instruction loader");
            }
        }
 private void InstructionsUpdatedInvoke(AsmType type)
 {
     Asm1Parser.UpdateInstructions(this, type);
     Asm2Parser.UpdateInstructions(this, type);
     InstructionsUpdated?.Invoke(this, type);
 }