private void TextBufferFactoryService_TextBufferCreated(object sender, TextBufferCreatedEventArgs e) { ITextBuffer buffer = e.TextBuffer; buffer.ContentTypeChanged += TextBuffer_ContentTypeChanged; EnsureBufferHasTokenizer(e.TextBuffer.ContentType, buffer); }
private void OnBufferCreated(object sender, TextBufferCreatedEventArgs e) { // look for a hole in allocatedBuffers. This is linear in number of extant buffers // but we won't take this path except in diagnostic conditions. for (int b = 0; b < allocatedBuffers.Count; ++b) { if (!allocatedBuffers[b].IsAlive) { allocatedBuffers[b].Target = e.TextBuffer; return; } } allocatedBuffers.Add(new WeakReference(e.TextBuffer)); e.TextBuffer.Properties.AddProperty(typeof(SnapshotTracker), new SnapshotTracker(e.TextBuffer)); }
private static void TextBufferFactoryService_TextBufferCreated(object sender, TextBufferCreatedEventArgs e) { e.TextBuffer.ContentTypeChanged += TextBuffer_ContentTypeChanged; if (e.TextBuffer.ContentType.IsOfType("PowerShell")) { var psts = new PowerShellTokenizationService(e.TextBuffer); _gotoDefinitionCommand.AddTextBuffer(e.TextBuffer); e.TextBuffer.ChangedLowPriority += (o, args) => psts.StartTokenization(); e.TextBuffer.Properties.AddProperty("HasTokenizer", true); } }
private void AddTextBufferCloneServiceToBuffer(object sender, TextBufferCreatedEventArgs e) { e.TextBuffer.Properties.AddProperty(typeof(ITextBufferCloneService), _textBufferCloneService); }