示例#1
0
        public MarkdownLanguageInfo(SVsServiceProvider serviceProvider)
        {
            _serviceProvider = serviceProvider;

            IVsTextManager2 textManager = (IVsTextManager2)serviceProvider.GetService(typeof(SVsTextManager));

            LANGPREFERENCES2[] preferences = new LANGPREFERENCES2[1];
            preferences[0].guidLang = typeof(MarkdownLanguageInfo).GUID;
            ErrorHandler.ThrowOnFailure(textManager.GetUserPreferences2(null, null, preferences, null));
            _languagePreferences       = CreateLanguagePreferences(preferences[0]);
            _languagePreferencesCookie = ((IConnectionPointContainer)textManager).Advise <LanguagePreferences, IVsTextManagerEvents2>(_languagePreferences);
        }
示例#2
0
        /// <summary>
        /// Initializes the singleton instance of the command.
        /// </summary>
        /// <param name="package">Owner package, not null.</param>
        public static async Task InitializeAsync(AsyncPackage package)
        {
            // Switch to the main thread - the call to AddCommand in ParseVueTemplate's constructor requires
            // the UI thread.
            await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(package.DisposalToken);

            _textManagerSvc = await package.GetServiceAsync(typeof(Microsoft.VisualStudio.TextManager.Interop.SVsTextManager)) as Microsoft.VisualStudio.TextManager.Interop.IVsTextManager2;

            Microsoft.Assumes.Present(_textManagerSvc);

            _dte2 = await package.GetServiceAsync(typeof(EnvDTE.DTE)) as EnvDTE80.DTE2;

            Microsoft.Assumes.Present(_dte2);

            OleMenuCommandService commandService = await package.GetServiceAsync((typeof(IMenuCommandService))) as OleMenuCommandService;

            Instance = new ParseVueTemplate(package, commandService);
        }