public void TextViewCreated(IWpfTextView textView) { IClassificationType classification = ClassificationRegistry.GetClassificationType(Constants.COLUMN_HIGHLIGHT); IClassificationFormatMap map = //FormatMapService.GetClassificationFormatMap(FontsAndColorsCategories.TextEditorCategory); FormatMapService.GetClassificationFormatMap(textView); textView.Properties.GetOrCreateSingletonProperty( () => { return(new CurrentColumnAdornment(textView, map, classification, Settings)); }); }
private IClassificationTag ClassifyToken(SAGESharp.LSS.Token token, SAGESharp.LSS.Token previousToken) { IClassificationType classification = null; if (token.Type == SAGESharp.LSS.TokenType.Comment || token.Type == SAGESharp.LSS.TokenType.MultilineComment) { classification = StandardClassifications.Comment; } else if (token.Type == SAGESharp.LSS.TokenType.StringLiteral) { classification = StandardClassifications.StringLiteral; } else if (token.Type == SAGESharp.LSS.TokenType.Whitespace) { classification = StandardClassifications.WhiteSpace; } else if (token.Type == SAGESharp.LSS.TokenType.IntegerLiteral || token.Type == SAGESharp.LSS.TokenType.FloatLiteral) { classification = StandardClassifications.NumberLiteral; } else if (token.Type >= SAGESharp.LSS.TokenType.KeywordClass && token.Type <= SAGESharp.LSS.TokenType.KeywordClassID) { classification = StandardClassifications.Keyword; } else if (token.Type == SAGESharp.LSS.TokenType.Symbol && (previousToken?.Type == SAGESharp.LSS.TokenType.KeywordClass || previousToken?.Type == SAGESharp.LSS.TokenType.KeywordNew)) { classification = ClassificationRegistry.GetClassificationType("type"); // "class name", "type" } else if (token.Type == SAGESharp.LSS.TokenType.Symbol && previousToken?.Type == SAGESharp.LSS.TokenType.Period) { classification = StandardClassifications.NumberLiteral; } else if ((token.Type >= SAGESharp.LSS.TokenType.Period && token.Type <= SAGESharp.LSS.TokenType.ColonColonDollarSign) || (token.Type >= SAGESharp.LSS.TokenType.Exclamation && token.Type <= SAGESharp.LSS.TokenType.LessEquals)) { classification = StandardClassifications.Operator; } return(classification == null ? null : new ClassificationTag(classification)); }
public KeywordTag GetTag(String name) { var type = ClassificationRegistry.GetClassificationType(name); return(new KeywordTag(type)); }