public RustClassifier(IRustLexer lexer, ITextBuffer buffer, IStandardClassificationService standardClassificationService) { this.buffer = buffer; DocumentState state = DocumentState.CreateAndRegister(lexer, buffer); state.TokensChanged += TokensChanged; this.standardClassificationService = standardClassificationService; InitializeClassifierDictionary(standardClassificationService); }
public static DocumentState CreateAndRegister(IRustLexer lexer, ITextBuffer buffer) { DocumentState state; if (buffer.Properties.TryGetProperty <DocumentState>(Key, out state)) { return(state); } state = new DocumentState(lexer, buffer.CurrentSnapshot); buffer.Changed += (src, arg) => state.ApplyTextChanges(arg); buffer.Properties.AddProperty(Key, state); return(state); }
public DocumentState(IRustLexer lexer, ITextSnapshot version) { this.lexer = lexer; CurrentSnapshot = version; Initialize(); }
public static DocumentState CreateAndRegister(IRustLexer lexer, ITextBuffer buffer) { DocumentState state; if(buffer.Properties.TryGetProperty<DocumentState>(Key, out state)) return state; state = new DocumentState(lexer, buffer.CurrentSnapshot); buffer.Changed += (src, arg) => state.ApplyTextChanges(arg); buffer.Properties.AddProperty(Key, state); return state; }
public RustClassifierProvider(IRustLexer lexer) { this.lexer = lexer; }