Exemple #1
0
        internal CarClassifier(ITextBuffer buffer,
                               IStandardClassificationService classifications,
                               IClassificationTypeRegistryService classificationRegistry)
        {
            ClassificationRegistry = classificationRegistry;
            Classifications        = classifications;
            Buffer = buffer;

            tokenizer = new CarSyntaxChecker(classifications);
        }
Exemple #2
0
        public static void SetCompletionList()
        {
            string keywordName   = CarSyntaxChecker.GetKeywordName();
            string highMarkup    = CarSyntaxChecker.HighMarkup;
            string attributeName = CarSyntaxChecker.GetAttributeName();

            if (KeywordsStatment.ContainsMarkupInNestedDictionary(highMarkup) && CarSyntaxChecker.MarkupFlag && !CarSyntaxChecker.AttributeFlag)
            {
                completions = KeywordsStatment.GetAllNestedMarkups(highMarkup).Select(keyword => new Completion(keyword)).ToList();
                foreach (var c in completions)
                {
                    if (c.DisplayText.EndsWith("/") || c.DisplayText.Equals("vehicle"))
                    {
                        c.InsertionText = c.DisplayText + ">\n";
                    }
                    else
                    {
                        c.InsertionText = c.DisplayText + ">\n</" + c.DisplayText + ">\n";
                    }
                }
                foreach (var c in completions)
                {
                    if (c.DisplayText.Equals("vehicle"))
                    {
                        c.IconSource = vehiclesImage;
                    }
                    else if (c.DisplayText.Equals("car"))
                    {
                        c.IconSource = carImage;
                    }
                    else
                    {
                        c.IconSource = partsImage;
                    }
                }
            }
            else if (CarSyntaxChecker.ValueFlag)
            {
                if (KeywordsStatment.valuesDictionary.ContainsKey(attributeName))
                {
                    completions = KeywordsStatment.GetAllValuesByAttribute(attributeName).Select(keyword => new Completion(keyword)).ToList();
                    foreach (var c in completions)
                    {
                        c.InsertionText = c.DisplayText + "\" ";
                    }
                    completions.ForEach(completion => completion.IconSource = detailImage);
                }
                else
                {
                    completions = new List <Completion>();
                }
            }
            else if (CarSyntaxChecker.AttributeFlag)
            {
                completions = KeywordsStatment.GetAllAttributesByMarkup(keywordName).Select(keyword => new Completion(keyword)).ToList();
                foreach (var c in completions)
                {
                    c.InsertionText = " " + c.DisplayText + "= ";
                }
                completions.ForEach(completion => completion.IconSource = informationImage);
            }
            else
            {
                completions = new List <Completion>();
            }
        }