Exemplo n.º 1
0
        public async Task <object> UpdateToolTipAsync(int offset)
        {
            if (offset != -1 && ShellViewModel.Instance.CurrentPerspective == Perspective.Editor)
            {
                var symbol = await _editor?.GetSymbolAsync(offset);

                if (symbol != null)
                {
                    switch (symbol.Kind)
                    {
                    case CursorKind.CompoundStatement:
                    case CursorKind.NoDeclarationFound:
                    case CursorKind.NotImplemented:
                    case CursorKind.FirstDeclaration:
                    case CursorKind.InitListExpression:
                    case CursorKind.IntegerLiteral:
                    case CursorKind.ReturnStatement:
                    case CursorKind.WhileStatement:
                    case CursorKind.BinaryOperator:
                        return(null);

                    default:
                        return(new SymbolViewModel(symbol));
                    }
                }
            }

            if (offset != -1 && ShellViewModel.Instance.CurrentPerspective == Perspective.Debug)
            {
                var expression = _editor?.GetWordAtOffset(offset);

                if (expression != string.Empty)
                {
                    var debugManager = IoC.Get <IDebugManager2>();

                    var newToolTip = new DebugHoverProbeViewModel();

                    bool result = newToolTip.AddWatch(expression);

                    return(newToolTip);
                }
            }

            return(null);
        }