示例#1
0
        internal static CommandUtil CreateCommandUtil(
            ITextView textView,
            ICommonOperations operations                     = null,
            IMotionUtil motionUtil                           = null,
            IStatusUtil statusUtil                           = null,
            IRegisterMap registerMap                         = null,
            IMarkMap markMap                                 = null,
            IVimData vimData                                 = null,
            IVimLocalSettings localSettings                  = null,
            IUndoRedoOperations undoRedOperations            = null,
            ISmartIndentationService smartIndentationService = null,
            IFoldManager foldManager                         = null,
            IVimHost vimHost                                 = null,
            IMacroRecorder recorder                          = null,
            ISearchService searchService                     = null,
            ITextStructureNavigator wordNavigator            = null,
            IJumpList jumpList                               = null)
        {
            statusUtil              = statusUtil ?? new StatusUtil();
            undoRedOperations       = undoRedOperations ?? VimUtil.CreateUndoRedoOperations(statusUtil);
            localSettings           = localSettings ?? new LocalSettings(new GlobalSettings());
            registerMap             = registerMap ?? CreateRegisterMap(MockObjectFactory.CreateClipboardDevice().Object);
            markMap                 = markMap ?? new MarkMap(new TrackingLineColumnService());
            vimData                 = vimData ?? new VimData();
            motionUtil              = motionUtil ?? CreateTextViewMotionUtil(textView, markMap: markMap, vimData: vimData, settings: localSettings);
            operations              = operations ?? CreateCommonOperations(textView, localSettings, vimData: vimData, statusUtil: statusUtil);
            smartIndentationService = smartIndentationService ?? CreateSmartIndentationService();
            foldManager             = foldManager ?? CreateFoldManager(textView.TextBuffer);
            searchService           = searchService ?? CreateSearchService(localSettings.GlobalSettings);
            wordNavigator           = wordNavigator ?? CreateTextStructureNavigator(textView.TextBuffer, WordKind.NormalWord);
            jumpList                = jumpList ?? CreateJumpList();
            vimHost                 = vimHost ?? new MockVimHost();
            var vim = MockObjectFactory.CreateVim(
                registerMap: registerMap,
                map: markMap,
                host: vimHost,
                vimData: vimData,
                recorder: recorder,
                searchService: searchService);
            var buffer = MockObjectFactory.CreateVimBuffer(
                textView: textView,
                settings: localSettings,
                motionUtil: motionUtil,
                vim: vim.Object,
                wordNavigator: wordNavigator,
                jumpList: jumpList);

            return(new CommandUtil(
                       buffer.Object,
                       operations,
                       statusUtil,
                       undoRedOperations,
                       smartIndentationService,
                       foldManager));
        }