public int Exec(ref Guid pguidCmdGroup, uint nCmdID, uint nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut)
        {
            var cmdGrp = pguidCmdGroup;
            //
            bool handled = false;
            int  hresult = VSConstants.S_OK;

            // 1. Pre-process
            if (pguidCmdGroup == VSConstants.VSStd2K)
            {
                switch (nCmdID)
                {
                case (int)VSConstants.VSStd2KCmdID.HELPKEYWORD:
                case (int)VSConstants.VSStd2KCmdID.HELP:
                    break;
                }
            }
            else if (pguidCmdGroup == VSConstants.GUID_VSStandardCommandSet97)
            {
                switch (nCmdID)
                {
                case (int)VSConstants.VSStd97CmdID.F1Help:
                case (int)VSConstants.VSStd97CmdID.WindowHelp:
                    //handled = true;
                    //Todo RvdH Call X# Help
                    break;

                case (int)VSConstants.VSStd97CmdID.GotoDefn:
                    XSharpGotoDefinition.GotoDefn(TextView);
                    return(VSConstants.S_OK);
                }
            }

            // 2. Let others do their thing
            ThreadHelper.JoinableTaskFactory.Run(async delegate
            {
                await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();

                hresult = Next.Exec(ref cmdGrp, nCmdID, nCmdexecopt, pvaIn, pvaOut);
            });

            if (ErrorHandler.Succeeded(hresult))
            {
                // 3. Post process
                if (pguidCmdGroup == Microsoft.VisualStudio.VSConstants.VSStd2K)
                {
                    switch (nCmdID)
                    {
                    case (int)VSConstants.VSStd2KCmdID.HELP:
                    case (int)VSConstants.VSStd2KCmdID.HELPKEYWORD:
                        break;
                    }
                    //
                    if (handled)
                    {
                        return(VSConstants.S_OK);
                    }
                }
            }

            return(hresult);
        }
        public void AugmentPeekSession(IPeekSession session, IList <IPeekableItem> peekableItems)
        {
            try
            {
                XSharpModel.ModelWalker.Suspend();
                if (!string.Equals(session.RelationshipName, PredefinedPeekRelationships.Definitions.Name, StringComparison.OrdinalIgnoreCase))
                {
                    return;
                }
                //
                var tp = session.GetTriggerPoint(_textBuffer.CurrentSnapshot);
                if (!tp.HasValue)
                {
                    return;
                }
                var triggerPoint = tp.Value;

                // LookUp for the BaseType, reading the TokenList (From left to right)
                var location = _textBuffer.FindLocation(triggerPoint);
                if (location == null)
                {
                    return;
                }

                CompletionState state;
                var             tokenList = XSharpTokenTools.GetTokensUnderCursor(location, out state);
                var             result    = new List <IXSymbol>();
                result.AddRange(XSharpLookup.RetrieveElement(location, tokenList, state, out var notProcessed, true));
                //
                if (result.Count > 0)
                {
                    if (result[0] is XSourceSymbol symbol)
                    {
                        peekableItems.Add(new XSharpDefinitionPeekItem(symbol, _peekResultFactory));
                    }
                    else if (result[0] is XPESymbol pesymbol)
                    {
                        XPETypeSymbol petype;
                        if (pesymbol is XPETypeSymbol)
                        {
                            petype = (XPETypeSymbol)pesymbol;
                        }
                        else if (pesymbol is XPEMemberSymbol member)
                        {
                            petype = (XPETypeSymbol)member.Parent;
                        }
                        else
                        {
                            return;
                        }
                        var file   = XSharpGotoDefinition.CreateFileForSystemType(petype, pesymbol);
                        var entity = XSharpGotoDefinition.FindElementInFile(file, petype, pesymbol);
                        if (entity != null)
                        {
                            peekableItems.Add(new XSharpDefinitionPeekItem(entity, _peekResultFactory));
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                XSettings.LogException(ex, "XSharpPeekItemSource.AugmentPeekSession failed : ");
            }
            finally
            {
                ModelWalker.Resume();
            }
        }