private List <VSShortcut> ParseVSSettingsFile(XDocument vsSettingsFile) { VSShortcutQueryEngine engine = new VSShortcutQueryEngine(ServiceProvider); var userShortcuts = vsSettingsFile.Descendants("UserShortcuts"); var shortcutList = new List <VSShortcut>(); foreach (var userShortcut in userShortcuts) { foreach (var shortcut in userShortcut.Descendants("Shortcut")) { var scope = engine.GetScopeByName(shortcut.Attribute("Scope").Value); var sequences = engine.GetBindingSequencesFromBindingString(shortcut.Value); var conflictTexts = new List <string>(); ThreadHelper.JoinableTaskFactory.Run(async() => { var conflicts = await engine.GetConflictsAsync(scope, sequences); foreach (var conflict in conflicts) { foreach (var binding in conflict.AffectedBindings) { conflictTexts.Add($"[{binding.Item1.Scope.Name}] {binding.Item2.CanonicalName} ({binding.Item1.OriginalDTEString})"); } } }); shortcutList.Add(new VSShortcut { Command = shortcut.Attribute("Command").Value, Scope = shortcut.Attribute("Scope").Value, Shortcut = shortcut.Value, Conflicts = conflictTexts }); } } return(shortcutList); }
private IEnumerable <BindingConflict> GetAllConflictObjects(KeybindingScope scope, IEnumerable <BindingSequence> sequences) { IEnumerable <BindingConflict> conflicts = null; // Must we really assign this to run to compile? ThreadHelper.JoinableTaskFactory.Run(async() => { conflicts = await queryEngine.GetConflictsAsync(AllCommandsCache, scope, sequences); }); return(conflicts); }