private void EnableTokenizationOfNewClojureBuffers() { var componentModel = (IComponentModel)GetService(typeof(SComponentModel)); TokenizedBufferBuilder tokenizedBufferBuilder = new TokenizedBufferBuilder(new Tokenizer()); ITextDocumentFactoryService documentFactoryService = componentModel.GetService <ITextDocumentFactoryService>(); documentFactoryService.TextDocumentDisposed += (o, e) => tokenizedBufferBuilder.RemoveTokenizedBuffer(e.TextDocument.TextBuffer); documentFactoryService.TextDocumentCreated += (o, e) => { if (e.TextDocument.FilePath.EndsWith(".clj")) { tokenizedBufferBuilder.CreateTokenizedBuffer(e.TextDocument.TextBuffer); } }; }
private void EnableTokenizationOfNewClojureBuffers() { var componentModel = (IComponentModel)GetService(typeof(SComponentModel)); TokenizedBufferBuilder tokenizedBufferBuilder = new TokenizedBufferBuilder(new Tokenizer()); ITextDocumentFactoryService documentFactoryService = componentModel.GetService <ITextDocumentFactoryService>(); documentFactoryService.TextDocumentDisposed += (o, e) => tokenizedBufferBuilder.RemoveTokenizedBuffer(e.TextDocument.TextBuffer); documentFactoryService.TextDocumentCreated += (o, e) => { if (e.TextDocument.FilePath.EndsWith(".clj")) { tokenizedBufferBuilder.CreateTokenizedBuffer(e.TextDocument.TextBuffer); e.TextDocument.FileActionOccurred += (sender, fileActionEvent) => { if (fileActionEvent.FileActionType == FileActionTypes.ContentSavedToDisk) { RequestClojureCompile(e.TextDocument); } }; } else if (e.TextDocument.FilePath.EndsWith(".cljs")) { tokenizedBufferBuilder.CreateTokenizedBuffer(e.TextDocument.TextBuffer); e.TextDocument.FileActionOccurred += (sender, fileActionEvent) => { if (fileActionEvent.FileActionType == FileActionTypes.ContentSavedToDisk) { RequestClojureScriptCompile(e.TextDocument); } }; } }; }