Esempio n. 1
0
        public DothtmlCompletionContext GetCompletionContext(ICompletionSession session)
        {
            var context = new DothtmlCompletionContext()
            {
                CompletionSession = session,
                Tokens            = classifier.Tokens,
                Parser            = parser,
                Tokenizer         = classifier.Tokenizer,
                RoslynWorkspace   = workspace,
                GlyphService      = glyphService,
                DTE                     = dte,
                Configuration           = configurationProvider.GetConfiguration(dte.ActiveDocument.ProjectItem.ContainingProject),
                MetadataControlResolver = MetadataControlResolver
            };

            try
            {
                parser.Parse(classifier.Tokens);
            }
            catch (Exception ex)
            {
                if (Debugger.IsAttached)
                {
                    Debugger.Break();
                }
                throw;
            }

            return(context);
        }
Esempio n. 2
0
        /// <summary>
        /// Initialization of the package; this method is called right after the package is sited, so this is the place
        /// where you can put all the initialization code that rely on services provided by VisualStudio.
        /// </summary>
        protected override void Initialize()
        {
            Debugger.Break();
            base.Initialize();

            _dte       = (DTE)GetService(typeof(SDTE));
            _dteEvents = _dte.Events.DTEEvents;

            _dteEvents.OnStartupComplete += OnStartupComplete;


            _mPackageDteEvents = ApplicationObject.Events.DTEEvents;
            _mPackageDteEvents.OnBeginShutdown += HandleVisualStudioShutDown;


            var bridge = new LINQBridgeVsExtension(_dte);

            //// Add our command handlers for menu (commands must exist in the .vsct file)
            var mcs = GetService(typeof(IMenuCommandService)) as OleMenuCommandService;

            if (null == mcs)
            {
                return;
            }

            //// Create the command for the menu item.
            var enableCommand  = new CommandID(GuidList.GuidBridgeVsExtensionCmdSet, (int)PkgCmdIdList.CmdIdEnableBridge);
            var menuItemEnable = new OleMenuCommand((s, e) => bridge.Execute(CommandAction.Enable), enableCommand);

            menuItemEnable.BeforeQueryStatus += (s, e) => bridge.UpdateCommand(menuItemEnable, CommandAction.Enable);


            var disableCommand = new CommandID(GuidList.GuidBridgeVsExtensionCmdSet,
                                               (int)PkgCmdIdList.CmdIdDisableBridge);
            var menuItemDisable = new OleMenuCommand((s, e) => bridge.Execute(CommandAction.Disable), disableCommand);

            menuItemDisable.BeforeQueryStatus += (s, e) => bridge.UpdateCommand(menuItemDisable, CommandAction.Disable);

            var aboutCommand  = new CommandID(GuidList.GuidBridgeVsExtensionCmdSet, (int)PkgCmdIdList.CmdIdAbout);
            var menuItemAbout = new OleMenuCommand((s, e) => { var about = new About(); about.ShowDialog(); }, aboutCommand);


            mcs.AddCommand(menuItemEnable);
            mcs.AddCommand(menuItemDisable);
            mcs.AddCommand(menuItemAbout);
        }
Esempio n. 3
0
 /// <summary>
 /// Launch debugger or Break if it's already attached
 /// </summary>
 /// <remarks></remarks>
 public static void DebugHere(Exception ex = null)
 {
     if (Debugger.IsAttached)
     {
         Debugger.Break();
     }
     else
     {
         //If debug is cancelled once, stop trying to launch
         if (DebugSkipped)
         {
             return;
         }
         var launched = Debugger.Launch();
         if (!launched)
         {
             DebugSkipped = true;
         }
     }
 }