Example #1
0
        /// <summary>
        /// Shows the completion list automaticly after typing three chars
        /// </summary>
        private void SciControlCharAdded(ScintillaControl sci, Int32 value)
        {
            String language = sci.ConfigurationLanguage.ToLower();

            if (this.IsSupported(language))
            {
                Language config     = ScintillaControl.Configuration.GetLanguage(sci.ConfigurationLanguage);
                String   characters = config.characterclass.Characters;
                // Do not autocomplete in word
                Char c = (char)sci.CharAt(sci.CurrentPos);
                if (characters.IndexOf(c) >= 0)
                {
                    return;
                }
                // Autocomplete after typing word chars only
                if (characters.IndexOf((char)value) < 0)
                {
                    return;
                }
                String curWord = sci.GetWordLeft(sci.CurrentPos - 1, false);
                if (curWord == null || curWord.Length < 3)
                {
                    return;
                }
                List <ICompletionListItem> items = this.GetCompletionListItems(language, sci.FileName);
                if (items != null && items.Count > 0)
                {
                    items.Sort();
                    CompletionList.Show(items, true, curWord);
                    CompletionList.DisableAutoInsertion();
                }
            }
        }
Example #2
0
        /// <summary>
        /// Shows the completion list automaticly after typing three chars
        /// </summary>
        private void SciControlCharAdded(ScintillaControl sci, Int32 value)
        {
            ITabbedDocument doc = DocumentManager.FindDocument(sci);

            if (this.isSupported && !settingObject.DisableAutoCompletion)
            {
                String     lang       = sci.ConfigurationLanguage;
                AutoInsert insert     = settingObject.AutoInsertType;
                Language   config     = ScintillaControl.Configuration.GetLanguage(lang);
                String     characters = config.characterclass.Characters;
                // Do not autocomplete in word
                Char c = (char)sci.CharAt(sci.CurrentPos);
                if (characters.IndexOf(c) >= 0)
                {
                    return;
                }
                // Autocomplete after typing word chars only
                if (characters.IndexOf((char)value) < 0)
                {
                    return;
                }
                String curWord = sci.GetWordLeft(sci.CurrentPos - 1, false);
                if (curWord == null || curWord.Length < 3)
                {
                    return;
                }
                List <ICompletionListItem> items = this.GetCompletionListItems(lang, sci.FileName);
                if (items != null && items.Count > 0)
                {
                    items.Sort();
                    CompletionList.Show(items, true, curWord);
                    if (insert == AutoInsert.Never || (insert == AutoInsert.CPP && sci.Lexer != 3 /*CPP*/) || lang == "text")
                    {
                        CompletionList.DisableAutoInsertion();
                    }
                }
            }
        }