public void ShouldPutSemicolonInFrontOfEachLine() { _selectedLines.Add("line one"); _selectedLines.Add("line two"); _selectedLines.Add("line three"); _blockComment.Execute(); List <string> expectedResult = new List <string>(); expectedResult.Add(";line one"); expectedResult.Add(";line two"); expectedResult.Add(";line three"); _textBufferAdapter.AssertWasCalled(t => t.ReplaceSelectedLines(expectedResult)); }
private void EnableMenuCommandsOnNewClojureBuffers() { var componentModel = (IComponentModel)GetService(typeof(SComponentModel)); ITextEditorFactoryService editorFactoryService = componentModel.GetService <ITextEditorFactoryService>(); editorFactoryService.TextViewCreated += (o, e) => { e.TextView.GotAggregateFocus += (sender, args) => { _thirdPartyEditorCommands.Clear(); if (e.TextView.TextSnapshot.ContentType.TypeName.ToLower() != "clojure") { return; } var editorOptionsBuilder = new EditorOptionsBuilder(componentModel.GetService <IEditorOptionsFactoryService>().GetOptions(e.TextView)); var tokenizedBuffer = TokenizedBufferBuilder.TokenizedBuffers[e.TextView.TextBuffer]; var formatter = new AutoFormatter(new TextBufferAdapter(e.TextView), tokenizedBuffer); var blockComment = new BlockComment(new TextBufferAdapter(e.TextView)); var blockUncomment = new BlockUncomment(new TextBufferAdapter(e.TextView)); _thirdPartyEditorCommands.AddCommand(new MenuCommand((commandSender, commandArgs) => formatter.Format(editorOptionsBuilder.Get()), CommandIDs.FormatDocument)); _thirdPartyEditorCommands.AddCommand(new MenuCommand((commandSender, commandArgs) => blockComment.Execute(), CommandIDs.BlockComment)); _thirdPartyEditorCommands.AddCommand(new MenuCommand((commandSender, commandArgs) => blockUncomment.Execute(), CommandIDs.BlockUncomment)); _thirdPartyEditorCommands.AddCommand(new MenuCommand((commandSender, commandArgs) => { }, CommandIDs.GotoDefinition)); }; }; }