Beispiel #1
0
        public Type GetCompletionType(AutoComplete completion)
        {
            if (_completionType == null)
            {
                _completionType = completion.Types.FirstOrDefault(t => t.Name == Type);

                if (_completionType == null)
                    _completionType = completion.GetBaseType();
            }

            return _completionType;
        }
Beispiel #2
0
        public bool IsSameLanguageAs(AutoComplete completion)
        {
            if (completion == null)
                return false;

            if (completion.LanguageName != LanguageName)
                return false;

            return true;
        }
Beispiel #3
0
        private void ShowCompletionSettings(AutoComplete completion, string languageName)
        {
            var language = Controller.Current.Languages.GetLanguageByName(languageName);
            var frameworks = completion.GetEnabledFrameworks();

            ActiveCompletion = completion;
            NoCompletionSettings.Visibility = Visibility.Collapsed;
            CompletionSettings.Visibility = Visibility.Visible;

            CompletionState.Content = "Enable for " + language.Name;
            CompletionState.IsChecked = completion.IsEnabled;

            FrameworksContainer.IsEnabled = completion.IsEnabled;
            FrameworksContainer.Children.Clear();

            foreach (var framework in ActiveCompletion.Frameworks)
            {
                var content = framework.Name;
                var cb = new CheckBox();

                cb.Content = content;

                if (frameworks.Contains(content))
                {
                    cb.IsChecked = true;
                }

                cb.Click += (s, e) =>
                {
                    if (cb.IsChecked.Value)
                    {
                        EnableFramework(content);
                    }
                    else
                    {
                        DisableFramework(content);
                    }
                };

                FrameworksContainer.Children.Add(cb);
            }
        }
Beispiel #4
0
        public void Reset(EditorSegment segment, AutoComplete completion)
        {
            Segment = segment;

            if (LanguageCompletion != null && !LanguageCompletion.IsSameLanguageAs(completion))
            {
                GlobalIdentifiers = new List<IdentifierMatch>();
                AvailableOptions = new List<AutoCompleteItem>();
                TokensBeforeCaret = new List<string>();
            }

            LanguageCompletion = completion;
        }