Ejemplo n.º 1
0
        public IEnumerable <string> SuggestCandidates(string text)
        {
            if (string.IsNullOrWhiteSpace(text))
            {
                return(SupportedCommands.Select(c => c.Key));
            }

            var segments = text
                           .Split(' ')
                           .Select(s => s.Trim())
                           .ToList();

            var command = segments.FirstOrDefault();

            if (command == null || segments.Count < 1)
            {
                return(Enumerable.Empty <string>());
            }

            if (!command.EndsWith(" ") && segments.Count == 1)
            {
                return(SupportedCommands.Where(c => c.Key.StartsWith(command)).Select(c => c.Key));
            }

            var arguments = string.Join(" ", segments.Skip(1));

            return(SupportedCommands
                   .Where(c => c.Key == command)
                   .OfType <IAutoCompletionSupport>()
                   .SelectMany(c => c.SuggestCandidates(arguments))
                   .Select(s => string.Join(" ", command, s)));
        }
Ejemplo n.º 2
0
        protected VSCommandTarget(IVsTextView vsTextView, IWpfTextView textView)
        {
            TextView       = textView;
            CommandGroupId = typeof(T).GUID;
            CommandIdSet   = new HashSet <uint>(SupportedCommands.Select(x => ConvertFromCommand(x)));

            _NextCommandTarget = AttachTo(vsTextView, this);
        }
Ejemplo n.º 3
0
 internal virtual Dictionary <string, IEnumerable <string> > GetSettingsStrings()
 {
     return(new Dictionary <string, IEnumerable <string> >
     {
         { nameof(TextKeysBlacklist), TextKeysBlacklist },
         { nameof(CalcKeys), CalcKeys },
         { nameof(FormatKeys), FormatKeys },
         { nameof(SupportedCommands), SupportedCommands.Select(c => c.ToString()) },
         { nameof(SpecializedKeyCommands), SpecializedKeyCommands.Select(c => c.ToString()) },
         { nameof(GetRandomNameDirs), GetRandomNameDirs().ToList() },
         { nameof(GetScenarioDirs), GetScenarioDirs().ToList() }
     });
 }