private static VimEditorHost GetOrCreateVimEditorHost() { if (s_cachedVimEditorHost == null) { var editorHostFactory = new EditorHostFactory(); editorHostFactory.Add(new AssemblyCatalog(typeof(IVim).Assembly)); // Other Exports needed to construct VsVim editorHostFactory.Add(new TypeCatalog( typeof(TestableClipboardDevice), typeof(TestableKeyboardDevice), typeof(TestableMouseDevice), typeof(global::Vim.UnitTest.Exports.VimHost), typeof(VimErrorDetector), typeof(DisplayWindowBrokerFactoryService), typeof(WordCompletionSessionFactoryService), typeof(AlternateKeyUtil), typeof(VimProtectedOperations), typeof(OutlinerTaggerProvider))); var compositionContainer = editorHostFactory.CreateCompositionContainer(); s_cachedVimEditorHost = new VimEditorHost(compositionContainer); } return(s_cachedVimEditorHost); }
private static VimEditorHost GetOrCreateVimEditorHost() { var key = Thread.CurrentThread.ManagedThreadId; if (!s_cachedVimEditorHostMap.TryGetValue(key, out VimEditorHost host)) { var editorHostFactory = new EditorHostFactory(); editorHostFactory.Add(new AssemblyCatalog(typeof(IVim).Assembly)); // Other Exports needed to construct VsVim editorHostFactory.Add(new TypeCatalog( typeof(TestableClipboardDevice), typeof(TestableKeyboardDevice), typeof(TestableMouseDevice), typeof(global::Vim.UnitTest.Exports.VimHost), typeof(VimErrorDetector), typeof(DisplayWindowBrokerFactoryService), typeof(WordCompletionSessionFactoryService), typeof(AlternateKeyUtil), typeof(OutlinerTaggerProvider))); var compositionContainer = editorHostFactory.CreateCompositionContainer(); host = new VimEditorHost(compositionContainer); s_cachedVimEditorHostMap[key] = host; } return(host); }
private static VimEditorHost CreateVimEditorHost() { var editorHostFactory = new EditorHostFactory(); editorHostFactory.Add(new AssemblyCatalog(typeof(Vim.IVim).Assembly)); editorHostFactory.Add(new AssemblyCatalog(typeof(Vim.UI.Wpf.VimKeyProcessor).Assembly)); editorHostFactory.Add(new AssemblyCatalog(typeof(VsCommandTarget).Assembly)); editorHostFactory.Add(new AssemblyCatalog(typeof(ISharedService).Assembly)); editorHostFactory.Add(new TypeCatalog( typeof(Vim.VisualStudio.UnitTest.MemoryLeakTest.ServiceProvider), typeof(Vim.VisualStudio.UnitTest.MemoryLeakTest.VsEditorAdaptersFactoryService), typeof(VimErrorDetector))); return(new VimEditorHost(editorHostFactory.CreateCompositionContainer())); }
private VsfEditorHost GetOrCreateEditorHost() { if (cachedEditorHost == null) { var editorHostFactory = new EditorHostFactory(); var catalog = new AggregateCatalog( new AssemblyCatalog(typeof(LanguageFactory).Assembly), new AssemblyCatalog(typeof(PkgSource).Assembly), new AssemblyCatalog(typeof(TextBufferBraces).Assembly) ); editorHostFactory.Add(catalog); var compositionContainer = editorHostFactory.CreateCompositionContainer(); cachedEditorHost = new VsfEditorHost(compositionContainer); } return(cachedEditorHost); }
private VsfEditorHost GetOrCreateEditorHost() { if (cachedEditorHost == null) { var editorHostFactory = new EditorHostFactory(); var catalog = new AggregateCatalog( new AssemblyCatalog(typeof(IUpdatableSettings).Assembly), // Viasfora.Settings new AssemblyCatalog(typeof(LanguageFactory).Assembly), // Viasfora.Languages new AssemblyCatalog(typeof(Guids).Assembly), // Viasfora.Core new AssemblyCatalog(typeof(TextBufferBraces).Assembly), // Viasfora.Rainbow new AssemblyCatalog(typeof(XmlTaggerProvider).Assembly) // Viasfora.Xml ); editorHostFactory.Add(catalog); var compositionContainer = editorHostFactory.CreateCompositionContainer(); cachedEditorHost = new VsfEditorHost(compositionContainer); } return(cachedEditorHost); }
public void Init() { { var A = new EditorHostFactory(); var B = A.CreateCompositionContainer(); IEditorFormatMapService efms = B.GetExportedValue <IEditorFormatMapService>(); if (!VsSettings.IsInitialized) { VsSettings.Initialize(this.pkg, efms); } } CreateMenu(); cmdExec = new CommandExecutorService() { }; disableVsVimCmdAvailable = cmdExec.IsCommandAvailable(VsVimSetDisabled); enableVsVimCmdAvailable = cmdExec.IsCommandAvailable(VsVimSetEnabled); viEmuPluginPresent = cmdExec.IsCommandAvailable(ViEmuEnableDisableCommand); iVsUiShell = Package.GetGlobalService(typeof(SVsUIShell)) as IVsUIShell; iVsUiShell4 = iVsUiShell as IVsUIShell4; JumpLabelUserControl.WarmupCache(); // warmup options GeneralOptions.Instance.caretPositionSensivity = GeneralOptions.Instance.caretPositionSensivity; // warmp up: #if MEASUREEXECTIME var watch2_0 = System.Diagnostics.Stopwatch.StartNew(); #endif var wfs = iVsUiShell.GetDocumentWindowFrames().GetValueOrDefault(); if (wfs.Count > 0) { Trace.WriteLine("GetDocumentWindowFrames warmed up"); foreach (var wf in wfs) { wf.GetProperty((int)VsFramePropID.Caption, out var oce); wf.SetProperty((int)VsFramePropID.Caption, (string)oce); } } #if MEASUREEXECTIME watch2_0.Stop(); Trace.WriteLine($"PeasyMotion Adornment warmup document tabs: {watch2_0.ElapsedMilliseconds} ms"); #endif }
private VsfEditorHost GetOrCreateEditorHost() { if ( cachedEditorHost == null ) { var editorHostFactory = new EditorHostFactory(); var catalog = new AggregateCatalog( new AssemblyCatalog(typeof(LanguageFactory).Assembly), new AssemblyCatalog(typeof(PkgSource).Assembly), new AssemblyCatalog(typeof(TextBufferBraces).Assembly) ); editorHostFactory.Add(catalog); var compositionContainer = editorHostFactory.CreateCompositionContainer(); cachedEditorHost = new VsfEditorHost(compositionContainer); } return cachedEditorHost; }
private static VimEditorHost GetOrCreateVimEditorHost() { if (s_cachedVimEditorHost == null) { var editorHostFactory = new EditorHostFactory(); editorHostFactory.Add(new AssemblyCatalog(typeof(IVim).Assembly)); // Other Exports needed to construct VsVim editorHostFactory.Add(new TypeCatalog( typeof(TestableClipboardDevice), typeof(TestableKeyboardDevice), typeof(TestableMouseDevice), typeof(global::Vim.UnitTest.Exports.VimHost), typeof(VimErrorDetector), typeof(DisplayWindowBrokerFactoryService), typeof(WordCompletionSessionFactoryService), typeof(AlternateKeyUtil), typeof(VimProtectedOperations), typeof(OutlinerTaggerProvider))); var compositionContainer = editorHostFactory.CreateCompositionContainer(); s_cachedVimEditorHost = new VimEditorHost(compositionContainer); } return s_cachedVimEditorHost; }
private VsfEditorHost GetOrCreateEditorHost() { if ( cachedEditorHost == null ) { var editorHostFactory = new EditorHostFactory(); editorHostFactory.Add(new AssemblyCatalog(typeof(IVsfSettings).Assembly)); var compositionContainer = editorHostFactory.CreateCompositionContainer(); cachedEditorHost = new VsfEditorHost(compositionContainer); } return cachedEditorHost; }