本文整理汇总了C#中IVimData类的典型用法代码示例。如果您正苦于以下问题:C# IVimData类的具体用法?C# IVimData怎么用?C# IVimData使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IVimData类属于命名空间,在下文中一共展示了IVimData类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateCommonOperations
internal static ICommonOperations CreateCommonOperations(
ITextView textView,
IVimLocalSettings localSettings,
IOutliningManager outlining = null,
IStatusUtil statusUtil = null,
ISearchService searchService = null,
IUndoRedoOperations undoRedoOperations = null,
IVimData vimData = null,
IVimHost vimHost = null,
ITextStructureNavigator navigator = null,
IClipboardDevice clipboardDevice = null,
IFoldManager foldManager = null)
{
var editorOperations = EditorUtil.GetOperations(textView);
var editorOptions = EditorUtil.FactoryService.EditorOptionsFactory.GetOptions(textView);
var jumpList = new JumpList(new TrackingLineColumnService());
var keyMap = new KeyMap();
foldManager = foldManager ?? new FoldManager(textView.TextBuffer);
statusUtil = statusUtil ?? new StatusUtil();
searchService = searchService ?? CreateSearchService(localSettings.GlobalSettings);
undoRedoOperations = undoRedoOperations ??
new UndoRedoOperations(statusUtil, FSharpOption<ITextUndoHistory>.None);
vimData = vimData ?? new VimData();
vimHost = vimHost ?? new MockVimHost();
navigator = navigator ?? CreateTextStructureNavigator(textView.TextBuffer);
clipboardDevice = clipboardDevice ?? new MockClipboardDevice();
var operationsData = new OperationsData(
editorOperations,
editorOptions,
foldManager,
jumpList,
keyMap,
localSettings,
outlining != null ? FSharpOption.Create(outlining) : FSharpOption<IOutliningManager>.None,
CreateRegisterMap(clipboardDevice),
searchService,
EditorUtil.FactoryService.SmartIndentationService,
statusUtil,
textView,
undoRedoOperations,
vimData,
vimHost,
navigator);
return new CommonOperations(operationsData);
}
示例2: CreateVim
public static Mock<IVim> CreateVim(
IRegisterMap registerMap = null,
IMarkMap map = null,
IVimGlobalSettings settings = null,
IVimHost host = null,
IKeyMap keyMap = null,
IKeyboardDevice keyboardDevice = null,
IMouseDevice mouseDevice = null,
IVimData vimData = null,
IMacroRecorder macroRecorder = null,
ISearchService searchService = null,
Dictionary<string, VariableValue> variableMap = null,
MockRepository factory = null)
{
factory = factory ?? new MockRepository(MockBehavior.Strict);
registerMap = registerMap ?? CreateRegisterMap().Object;
map = map ?? new MarkMap(new BufferTrackingService());
settings = settings ?? new GlobalSettings();
host = host ?? new MockVimHost();
keyMap = keyMap ?? (new KeyMap(settings, new Dictionary<string, VariableValue>()));
macroRecorder = macroRecorder ?? CreateMacroRecorder(factory: factory).Object;
searchService = searchService ?? factory.Create<ISearchService>().Object;
keyboardDevice = keyboardDevice ?? (factory.Create<IKeyboardDevice>(MockBehavior.Loose)).Object;
mouseDevice = mouseDevice ?? (factory.Create<IMouseDevice>(MockBehavior.Loose)).Object;
vimData = vimData ?? VimUtil.CreateVimData();
variableMap = variableMap ?? new Dictionary<string, VariableValue>();
var mock = factory.Create<IVim>(MockBehavior.Strict);
mock.SetupGet(x => x.RegisterMap).Returns(registerMap);
mock.SetupGet(x => x.MarkMap).Returns(map);
mock.SetupGet(x => x.GlobalSettings).Returns(settings);
mock.SetupGet(x => x.VimHost).Returns(host);
mock.SetupGet(x => x.KeyMap).Returns(keyMap);
mock.SetupGet(x => x.VimData).Returns(vimData);
mock.SetupGet(x => x.MacroRecorder).Returns(macroRecorder);
mock.SetupGet(x => x.SearchService).Returns(searchService);
mock.SetupGet(x => x.VariableMap).Returns(variableMap);
return mock;
}
示例3: RunCommand
/// <summary>
/// Run the specified command, capture it's output and return it to the caller
/// </summary>
public virtual string RunCommand(string command, string arguments, IVimData vimdata)
{
var startInfo = new ProcessStartInfo
{
FileName = command,
Arguments = arguments,
RedirectStandardOutput = true,
UseShellExecute = false,
WorkingDirectory = vimdata.CurrentDirectory
};
try
{
var process = Process.Start(startInfo);
process.WaitForExit();
return process.StandardOutput.ReadToEnd();
}
catch (Exception ex)
{
return ex.Message;
}
}
示例4: RunCommandFunc
string IVimHost.RunCommand(string command, string arguments, IVimData vimData)
{
return RunCommandFunc(command, arguments, vimData);
}
示例5: Create
public void Create(params string[] lines)
{
_textView = CreateTextView(lines);
_textView.Caret.MoveTo(new SnapshotPoint(_textView.TextSnapshot, 0));
_textBuffer = _textView.TextBuffer;
_factory = new MockRepository(MockBehavior.Strict);
_editOpts = _factory.Create<IEditorOperations>();
_vimHost = _factory.Create<IVimHost>();
_vimHost.Setup(x => x.IsDirty(It.IsAny<ITextBuffer>())).Returns(false);
_operations = _factory.Create<ICommonOperations>();
_operations.SetupGet(x => x.EditorOperations).Returns(_editOpts.Object);
_statusUtil = _factory.Create<IStatusUtil>();
_fileSystem = _factory.Create<IFileSystem>(MockBehavior.Strict);
_foldManager = _factory.Create<IFoldManager>(MockBehavior.Strict);
_vimData = new VimData();
_vim = MockObjectFactory.CreateVim(RegisterMap, host: _vimHost.Object, vimData: _vimData, factory: _factory);
var localSettings = new LocalSettings(Vim.GlobalSettings);
var vimTextBuffer = MockObjectFactory.CreateVimTextBuffer(
_textBuffer,
vim: _vim.Object,
localSettings: localSettings,
factory: _factory);
var vimBufferData = CreateVimBufferData(
vimTextBuffer.Object,
_textView,
statusUtil: _statusUtil.Object);
var vimBuffer = CreateVimBuffer(vimBufferData);
_interpreter = new Interpreter.VimInterpreter(
vimBuffer,
_operations.Object,
_foldManager.Object,
_fileSystem.Object,
_factory.Create<IBufferTrackingService>().Object);
}
示例6: Create
private void Create(ITextView textView, IEditorOptions editorOptions = null)
{
_textView = textView;
_textBuffer = textView.TextBuffer;
_snapshot = _textBuffer.CurrentSnapshot;
_textBuffer.Changed += delegate { _snapshot = _textBuffer.CurrentSnapshot; };
_globalSettings = new Vim.GlobalSettings();
_localSettings = new LocalSettings(_globalSettings, FSharpOption.CreateForReference(editorOptions), FSharpOption.CreateForReference(textView));
_markMap = new MarkMap(new TrackingLineColumnService());
_vimData = new VimData();
_search = VimUtil.CreateSearchService(_globalSettings);
_jumpList = VimUtil.CreateJumpList();
_statusUtil = new Mock<IStatusUtil>(MockBehavior.Strict);
_navigator = VimUtil.CreateTextStructureNavigator(_textView, WordKind.NormalWord);
_motionUtil = new MotionUtil(
_textView,
_markMap,
_localSettings,
_search,
_navigator,
_jumpList,
_statusUtil.Object,
VimUtil.GetWordUtil(textView),
_vimData);
}
示例7: Create
private void Create(ITextView textView)
{
_textView = textView;
_textBuffer = textView.TextBuffer;
_buffer = _textView.TextBuffer;
_snapshot = _buffer.CurrentSnapshot;
_buffer.Changed += delegate { _snapshot = _buffer.CurrentSnapshot; };
_globalSettings = new Vim.GlobalSettings();
_localSettings = new LocalSettings(_globalSettings, _textView);
_markMap = new MarkMap(new TrackingLineColumnService());
_vimData = new VimData();
_search = VimUtil.CreateSearchService(_globalSettings);
_jumpList = VimUtil.CreateJumpList();
_statusUtil = new Mock<IStatusUtil>(MockBehavior.Strict);
_navigator = VimUtil.CreateTextStructureNavigator(_textView.TextBuffer);
_motionUtil = new MotionUtil(
_textView,
_markMap,
_localSettings,
_search,
_navigator,
_jumpList,
_statusUtil.Object,
_vimData);
}
示例8: Create
public void Create(params string[] lines)
{
_textView = EditorUtil.CreateTextView(lines);
_vimData = new VimData();
_editorOptions = EditorUtil.FactoryService.EditorOptionsFactory.GetOptions(_textView);
_textView.Caret.MoveTo(new SnapshotPoint(_textView.TextSnapshot, 0));
_textBuffer = _textView.TextBuffer;
_factory = new MockRepository(MockBehavior.Strict);
_registerMap = VimUtil.CreateRegisterMap(MockObjectFactory.CreateClipboardDevice(_factory).Object);
_host = _factory.Create<IVimHost>();
_jumpList = _factory.Create<IJumpList>();
_editorOperations = _factory.Create<IEditorOperations>();
_editorOperations.Setup(x => x.AddAfterTextBufferChangePrimitive());
_editorOperations.Setup(x => x.AddBeforeTextBufferChangePrimitive());
_globalSettings = _factory.Create<IVimGlobalSettings>();
_globalSettings.SetupGet(x => x.Magic).Returns(true);
_globalSettings.SetupGet(x => x.SmartCase).Returns(false);
_globalSettings.SetupGet(x => x.IgnoreCase).Returns(true);
_globalSettings.SetupGet(x => x.IsVirtualEditOneMore).Returns(false);
_globalSettings.SetupGet(x => x.UseEditorIndent).Returns(false);
_globalSettings.SetupGet(x => x.UseEditorSettings).Returns(false);
_globalSettings.SetupGet(x => x.VirtualEdit).Returns(String.Empty);
_globalSettings.SetupGet(x => x.WrapScan).Returns(true);
_settings = MockObjectFactory.CreateLocalSettings(_globalSettings.Object, _factory);
_settings.SetupGet(x => x.AutoIndent).Returns(false);
_settings.SetupGet(x => x.GlobalSettings).Returns(_globalSettings.Object);
_settings.SetupGet(x => x.ExpandTab).Returns(true);
_settings.SetupGet(x => x.TabStop).Returns(4);
_outlining = _factory.Create<IOutliningManager>();
_outlining
.Setup(x => x.ExpandAll(It.IsAny<SnapshotSpan>(), It.IsAny<Predicate<ICollapsed>>()))
.Returns<IEnumerable<ICollapsible>>(null);
_globalSettings.SetupGet(x => x.ShiftWidth).Returns(2);
_statusUtil = _factory.Create<IStatusUtil>();
_searchService = VimUtil.CreateSearchService(_globalSettings.Object);
_undoRedoOperations = VimUtil.CreateUndoRedoOperations(_statusUtil.Object);
var data = new OperationsData(
vimData: _vimData,
vimHost: _host.Object,
editorOperations: _editorOperations.Object,
textView: _textView,
outliningManager: FSharpOption.Create(_outlining.Object),
jumpList: _jumpList.Object,
localSettings: _settings.Object,
undoRedoOperations: _undoRedoOperations,
registerMap: _registerMap,
editorOptions: _editorOptions,
keyMap: null,
statusUtil: _statusUtil.Object,
foldManager: null,
searchService: _searchService,
wordUtil: VimUtil.GetWordUtil(_textView));
_operationsRaw = new CommonOperations(data);
_operations = _operationsRaw;
}
示例9: Create
protected void Create(params string[] lines)
{
_textView = CreateTextView(lines);
_textBuffer = _textView.TextBuffer;
_globalSettings = Vim.GlobalSettings;
_globalSettings.IgnoreCase = true;
_globalSettings.HighlightSearch = true;
_vimData = Vim.VimData;
_asyncTaggerSourceRaw = new HighlightSearchTaggerSource(
_textView,
_globalSettings,
_vimData,
Vim.VimHost);
_asyncTaggerSource = _asyncTaggerSourceRaw;
}
示例10: Create
protected void Create(ITextView textView)
{
_textView = textView;
_textBuffer = textView.TextBuffer;
_snapshot = _textBuffer.CurrentSnapshot;
_textBuffer.Changed += delegate { _snapshot = _textBuffer.CurrentSnapshot; };
_vimTextBuffer = Vim.CreateVimTextBuffer(_textBuffer);
_statusUtil = new Mock<IStatusUtil>(MockBehavior.Strict);
var vimBufferData = CreateVimBufferData(_vimTextBuffer, _textView, statusUtil: _statusUtil.Object);
_globalSettings = vimBufferData.LocalSettings.GlobalSettings;
_localSettings = vimBufferData.LocalSettings;
_markMap = vimBufferData.Vim.MarkMap;
_vimData = vimBufferData.Vim.VimData;
_search = vimBufferData.Vim.SearchService;
var wordNavigator = CreateTextStructureNavigator(_textView.TextBuffer, WordKind.NormalWord);
_motionUtil = new MotionUtil(vimBufferData);
}
示例11: Create
protected virtual void Create(params string[] lines)
{
_textView = CreateTextView(lines);
_textBuffer = _textView.TextBuffer;
_vimBuffer = Vim.CreateVimBuffer(_textView);
_vimBuffer.ErrorMessage +=
(_, message) =>
{
if (_assertOnErrorMessage)
{
throw new Exception("Error Message: " + message.Message);
}
};
_vimBuffer.WarningMessage +=
(_, message) =>
{
if (_assertOnWarningMessage)
{
throw new Exception("Warning Message: " + message.Message);
}
};
_vimBufferData = _vimBuffer.VimBufferData;
_vimTextBuffer = _vimBuffer.VimTextBuffer;
_normalMode = _vimBuffer.NormalMode;
_keyMap = _vimBuffer.Vim.KeyMap;
_localSettings = _vimBuffer.LocalSettings;
_globalSettings = _localSettings.GlobalSettings;
_windowSettings = _vimBuffer.WindowSettings;
_jumpList = _vimBuffer.JumpList;
_vimHost = (MockVimHost)_vimBuffer.Vim.VimHost;
_vimHost.BeepCount = 0;
_vimData = Vim.VimData;
_foldManager = FoldManagerFactory.GetFoldManager(_textView);
_clipboardDevice = (TestableClipboardDevice)CompositionContainer.GetExportedValue<IClipboardDevice>();
// Many of the operations operate on both the visual and edit / text snapshot
// simultaneously. Ensure that our setup code is producing a proper IElisionSnapshot
// for the Visual portion so we can root out any bad mixing of instances between
// the two
Assert.True(_textView.VisualSnapshot is IElisionSnapshot);
Assert.True(_textView.VisualSnapshot != _textView.TextSnapshot);
}
示例12: Create
protected void Create(params string[] lines)
{
_vimHost = (MockVimHost)Vim.VimHost;
_textView = CreateTextView(lines);
_textBuffer = _textView.TextBuffer;
_vimTextBuffer = CreateVimTextBufferCore(_textBuffer);
_localSettings = _vimTextBuffer.LocalSettings;
var foldManager = CreateFoldManager(_textView);
_factory = new MockRepository(MockBehavior.Loose);
_statusUtil = _factory.Create<IStatusUtil>();
_bulkOperations = new TestableBulkOperations();
var vimBufferData = CreateVimBufferData(
_vimTextBuffer,
_textView,
statusUtil: _statusUtil.Object);
_jumpList = vimBufferData.JumpList;
_windowSettings = vimBufferData.WindowSettings;
_vimData = Vim.VimData;
_macroRecorder = Vim.MacroRecorder;
_globalSettings = Vim.GlobalSettings;
var operations = CreateCommonOperations(vimBufferData);
var lineChangeTracker = new LineChangeTracker(vimBufferData);
_motionUtil = new MotionUtil(vimBufferData, operations);
_commandUtil = new CommandUtil(
vimBufferData,
_motionUtil,
operations,
foldManager,
new InsertUtil(vimBufferData, _motionUtil, operations),
_bulkOperations,
MouseDevice,
lineChangeTracker);
var outliningManagerService = CompositionContainer.GetExportedValue<IOutliningManagerService>();
_outliningManager = outliningManagerService.GetOutliningManager(_textView);
}
示例13: Create
protected void Create(params string[] lines)
{
_statusUtil = new TestableStatusUtil();
_vimData = Vim.VimData;
_vimBufferData = CreateVimBufferData(
CreateTextView(lines),
statusUtil: _statusUtil);
_vimBuffer = CreateVimBuffer(_vimBufferData);
_vimTextBuffer = _vimBufferData.VimTextBuffer;
_localSettings = _vimBufferData.LocalSettings;
_globalSettings = _localSettings.GlobalSettings;
_textBuffer = _vimBufferData.TextBuffer;
_textView = _vimBufferData.TextView;
_interpreter = new global::Vim.Interpreter.Interpreter(
_vimBuffer,
CommonOperationsFactory.GetCommonOperations(_vimBufferData),
FoldManagerFactory.GetFoldManager(_vimBufferData.TextView),
new FileSystem(),
BufferTrackingService);
_keyMap = Vim.KeyMap;
}
示例14: Create
private void Create(params string[] lines)
{
_vimHost = (MockVimHost)Vim.VimHost;
_textView = CreateTextView(lines);
_globalSettings = Vim.GlobalSettings;
_globalSettings.IncrementalSearch = true;
_globalSettings.WrapScan = true;
var vimTextBuffer = Vim.CreateVimTextBuffer(_textView.TextBuffer);
_factory = new MockRepository(MockBehavior.Strict);
_statusUtil = _factory.Create<IStatusUtil>();
_statusUtil.Setup(x => x.OnWarning(Resources.Common_SearchBackwardWrapped));
_statusUtil.Setup(x => x.OnWarning(Resources.Common_SearchForwardWrapped));
_vimData = Vim.VimData;
var vimBufferData = CreateVimBufferData(vimTextBuffer, _textView);
var operations = CommonOperationsFactory.GetCommonOperations(vimBufferData);
_searchRaw = new IncrementalSearch(vimBufferData, operations);
_search = _searchRaw;
}
示例15: Create
private void Create(params string[] lines)
{
_textBuffer = CreateTextBuffer(lines);
_textView = MockObjectFactory.CreateTextView(_textBuffer);
_textView.SetupGet(x => x.HasAggregateFocus).Returns(true);
// Setup normal mode so that we can provide an ICommandRunner to
// recieve commands from
_factory = new MockRepository(MockBehavior.Loose) {DefaultValue = DefaultValue.Mock};
_runner = _factory.Create<ICommandRunner>(MockBehavior.Loose);
_normalMode = _factory.Create<INormalMode>(MockBehavior.Strict);
_normalMode.SetupGet(x => x.CommandRunner).Returns(_runner.Object);
// Create the IVimBuffer instance
_buffer = _factory.Create<IVimBuffer>(MockBehavior.Loose);
_buffer.DefaultValue = DefaultValue.Mock;
_buffer.SetupGet(x => x.NormalMode).Returns(_normalMode.Object);
_vimData = VimUtil.CreateVimData();
var vim = MockObjectFactory.CreateVim(vimData: _vimData);
_tracker = new ChangeTracker(vim.Object);
_tracker.OnVimBufferCreated(_buffer.Object);
}