public int GetHandledEvents(out IVsEnumBSTR ppUnk)
        {
            var node = LookupNode();
            var semanticModel = GetSemanticModel();
            var handledEvents = CodeModelService.GetHandledEventNames(node, semanticModel);
            ppUnk = new VsEnumBSTR(handledEvents);

            return VSConstants.S_OK;
        }
        public int GetHandledEvents(out IVsEnumBSTR ppUnk)
        {
            var node          = LookupNode();
            var semanticModel = GetSemanticModel();
            var handledEvents = CodeModelService.GetHandledEventNames(node, semanticModel);

            ppUnk = new VsEnumBSTR(handledEvents);

            return(VSConstants.S_OK);
        }
Esempio n. 3
0
        public override int GetProximityExpressions(
            IVsTextBuffer buffer,
            int line,
            int col,
            int cLines,
            out IVsEnumBSTR ppEnum)
        {
            ppEnum = null;

            /*
             * TRACE2( "LanguageService(%S)::GetProximityExpressions: line %i", m_languageName, line );
             * OUTARG(exprs);
             * INARG(textBuffer);
             *
             * //check the linecount
             * if (lineCount <= 0) lineCount = 1;
             *
             * //get the source
             * //TODO: this only works for sources that are opened in the environment
             * HRESULT hr;
             * Source* source = NULL;
             * hr = GetSource( textBuffer, &source );
             * if (FAILED(hr)) return hr;
             *
             * //parse and find the proximity expressions
             * StringList* strings = NULL;
             * hr = source->GetAutos( line, line + lineCount, &strings );
             * RELEASE(source);
             * if (FAILED(hr)) return hr;
             *
             * hr = strings->QueryInterface( IID_IVsEnumBSTR, reinterpret_cast<void**>(exprs) );
             * RELEASE(strings);
             * if (FAILED(hr)) return hr;
             *
             * return S_OK;
             */
            return(NativeMethods.S_FALSE);
        }
Esempio n. 4
0
        /// <summary>
        /// Generates proximity expressions.
        /// </summary>
        /// <remarks>
        /// This method is implemented by a language service to provide information needed to populate the
        /// <strong>Autos</strong> debugging window. When the debugger calls this method, the debugger is
        /// requesting the names of any parameters and variables in a span of lines beginning with the
        /// starting position identified by the <paramref name="line"/> and <paramref name="col"/> parameters
        /// in the specified text buffer. The extent of lines beyond this point is specified by the
        /// <paramref name="cLines"/> parameter.
        /// </remarks>
        /// <param name="buffer">[in] The <see cref="IVsTextBuffer"/> interface for the text buffer containing the expression.</param>
        /// <param name="line">[in] Number of the line containing the start of the expression.</param>
        /// <param name="col">[in] Column position within the line.</param>
        /// <param name="cLines">[in] Number of lines within the expression.</param>
        /// <param name="expressions">[out] Returns an IVsEnumBSTR object that is used to enumerate BSTRs.</param>
        /// <returns>If the method succeeds, it returns S_OK. If it fails, it returns an error code.</returns>
        public virtual int GetProximityExpressions([NotNull] IVsTextBuffer buffer, int line, int col, int cLines, out IVsEnumBSTR expressions)
        {
            Requires.NotNull(buffer, nameof(buffer));

            expressions = null;
            return(VSConstants.S_FALSE);
        }
Esempio n. 5
0
 public virtual int GetProximityExpressions(IVsTextBuffer buffer, int line, int col, int cLines, out IVsEnumBSTR ppEnum);
 public int Clone(out IVsEnumBSTR ppenum) {
     ppenum = new EnumBSTR(_enumerable);
     return VSConstants.S_OK;
 }
Esempio n. 7
0
 public virtual int GetProximityExpressions(IVsTextBuffer buffer, int line, int col, int cLines, out IVsEnumBSTR ppEnum);
 public int GetProximityExpressions(IVsTextBuffer pBuffer, int iLine, int iCol, int cLines, out IVsEnumBSTR ppEnum) {
     ppEnum = null;
     return VSConstants.E_FAIL;
 }
        int IVsLanguageDebugInfo.GetProximityExpressions(IVsTextBuffer pBuffer, int iLine, int iCol, int cLines, out IVsEnumBSTR ppEnum)
        {
            ppEnum = null;
            var      file = getFile(pBuffer);
            var      list = new List <String>();
            XElement member;

            // We use our orignal syntax here (so SELF and ":"). The expression compiler
            // in the debugger takes care of translating SELF to this and ':' to '.'
            if (file != null)
            {
                member = file.FindMemberAtRow(iLine);
                switch (member.Kind)
                {
                case Kind.Method:
                case Kind.Access:
                case Kind.Assign:
                case Kind.Property:
                case Kind.Event:
                case Kind.Field:
                case Kind.Constructor:
                case Kind.Destructor:
                case Kind.Operator:
                    if (!member.Modifiers.HasFlag(Modifiers.Static))
                    {
                        list.Add(XSettings.FormatKeyword("SELF"));
                    }
                    break;
                }
                var buffer = _editorAdaptersFactoryService.GetDataBuffer(pBuffer);
                Dictionary <string, XVariable> locals = null;
                if (member != null)
                {
                    if (member is XMemberDefinition)
                    {
                        locals = new Dictionary <string, XVariable>(StringComparer.OrdinalIgnoreCase);
                        var tm   = member as XMemberDefinition;
                        var vars = tm.GetLocals(buffer.CurrentSnapshot, iLine, file.Project.ParseOptions.Dialect);
                        foreach (var v in vars)
                        {
                            locals.Add(v.Name, (XVariable)v);
                        }
                        foreach (var p in tm.Parameters)
                        {
                            locals.Add(p.Name, (XVariable)p);
                        }
                    }
                    addtokens(buffer, iLine, list, file, locals);
                }
            }


            ppEnum = new VsEnumBSTR(list);
            return(VSConstants.S_OK);
        }
Esempio n. 10
0
        /// <summary>
        /// Called by debugger to get the list of expressions for the Autos debugger tool window.
        /// </summary>
        /// <remarks>
        /// MSDN docs specify that <paramref name="iLine"/> and <paramref name="iCol"/> specify the beginning of the span,
        /// but they actually specify the end of it (going <paramref name="cLines"/> lines back).
        /// </remarks>
        public int GetProximityExpressions(IVsTextBuffer pBuffer, int iLine, int iCol, int cLines, out IVsEnumBSTR ppEnum)
        {
            var model   = _serviceProvider.GetService(typeof(SComponentModel)) as IComponentModel;
            var service = model.GetService <IVsEditorAdaptersFactoryService>();
            var buffer  = service.GetDataBuffer(pBuffer);


            var projFile = buffer.GetAnalysisEntry();
            var names    = projFile.Analyzer.GetProximityExpressionsAsync(projFile, buffer, iLine, iCol, cLines).WaitOrDefault(1000);

            ppEnum = new EnumBSTR(names);
            return(VSConstants.S_OK);
        }
Esempio n. 11
0
        /// <summary>
        /// Generates proximity expressions.
        /// </summary>
        /// <remarks>
        /// This method is implemented by a language service to provide information needed to populate the
        /// <strong>Autos</strong> debugging window. When the debugger calls this method, the debugger is
        /// requesting the names of any parameters and variables in a span of lines beginning with the
        /// starting position identified by the <paramref name="line"/> and <paramref name="col"/> parameters
        /// in the specified text buffer. The extent of lines beyond this point is specified by the
        /// <paramref name="cLines"/> parameter.
        /// </remarks>
        /// <param name="buffer">[in] The <see cref="IVsTextBuffer"/> interface for the text buffer containing the expression.</param>
        /// <param name="line">[in] Number of the line containing the start of the expression.</param>
        /// <param name="col">[in] Column position within the line.</param>
        /// <param name="cLines">[in] Number of lines within the expression.</param>
        /// <param name="expressions">[out] Returns an IVsEnumBSTR object that is used to enumerate BSTRs.</param>
        /// <returns>If the method succeeds, it returns S_OK. If it fails, it returns an error code.</returns>
        public virtual int GetProximityExpressions(IVsTextBuffer buffer, int line, int col, int cLines, out IVsEnumBSTR expressions)
        {
            Contract.Requires <ArgumentNullException>(buffer != null, "buffer");

            expressions = null;
            return(VSConstants.S_FALSE);
        }
Esempio n. 12
0
 public int Clone(out IVsEnumBSTR ppEnum)
 {
     ppEnum = new VsEnumBSTR(_values);
     return VSConstants.S_OK;
 }
Esempio n. 13
0
        int IVsLanguageDebugInfo.GetProximityExpressions(IVsTextBuffer pBuffer, int iLine, int iCol, int cLines, out IVsEnumBSTR ppEnum)
        {
            ppEnum = null;
            var           file = getFile(pBuffer);
            var           list = new List <String>();
            XSourceEntity member;

            // We use our original syntax here (so SELF and ":"). The expression compiler
            // in the debugger takes care of translating SELF to this and ':' to '.'
            if (file != null)
            {
                member = file.FindMemberAtRow(iLine);
                if (member.Kind.IsClassMember(file.Project.ParseOptions.Dialect))
                {
                    if (!member.Modifiers.HasFlag(Modifiers.Static))
                    {
                        list.Add(XSettings.FormatKeyword("SELF"));
                    }
                }

                var buffer = _editorAdaptersFactoryService.GetDataBuffer(pBuffer);
                Dictionary <string, IXVariableSymbol> locals = null;
                if (member != null)
                {
                    if (member is XSourceMemberSymbol tm)
                    {
                        locals = new Dictionary <string, IXVariableSymbol>(StringComparer.OrdinalIgnoreCase);
                        var location = new XSharpSearchLocation(tm.File, tm, buffer.CurrentSnapshot, iLine);
                        var vars     = tm.GetLocals(location);
                        foreach (var v in vars)
                        {
                            if (!locals.ContainsKey(v.Name))
                            {
                                locals.Add(v.Name, v);
                            }
                        }
                        foreach (var p in tm.Parameters)
                        {
                            if (!locals.ContainsKey(p.Name))
                            {
                                locals.Add(p.Name, p);
                            }
                        }
                    }
                    addtokens(buffer, iLine, list, file, locals);
                }
            }


            ppEnum = new VsEnumBSTR(list);
            return(VSConstants.S_OK);
        }
Esempio n. 14
0
 /// <summary>
 /// Called by debugger to get the list of expressions for the Autos debugger tool window.
 /// </summary>
 /// <remarks>
 /// MSDN docs specify that <paramref name="iLine"/> and <paramref name="iCol"/> specify the beginning of the span,
 /// but they actually specify the end of it (going <paramref name="cLines"/> lines back).
 /// </remarks>
 public int GetProximityExpressions(IVsTextBuffer pBuffer, int iLine, int iCol, int cLines, out IVsEnumBSTR ppEnum)
 {
     ppEnum = new EnumBSTR(Enumerable.Empty <string>());
     return(VSConstants.S_OK);
 }
Esempio n. 15
0
        /// <summary>
        /// Called by debugger to get the list of expressions for the Autos debugger tool window.
        /// </summary>
        /// <remarks>
        /// MSDN docs specify that <paramref name="iLine"/> and <paramref name="iCol"/> specify the beginning of the span,
        /// but they actually specify the end of it (going <paramref name="cLines"/> lines back).
        /// </remarks>
        public int GetProximityExpressions(IVsTextBuffer pBuffer, int iLine, int iCol, int cLines, out IVsEnumBSTR ppEnum) {
            var model = _serviceProvider.GetService(typeof(SComponentModel)) as IComponentModel;
            var service = model.GetService<IVsEditorAdaptersFactoryService>();
            var buffer = service.GetDataBuffer(pBuffer);


            var projFile = buffer.GetAnalysisEntry(_serviceProvider);
            if (projFile != null) {
                var names = projFile.Analyzer.GetProximityExpressionsAsync(projFile, buffer, iLine, iCol, cLines).WaitOrDefault(1000);
                ppEnum = new EnumBSTR(names);
            } else {
                ppEnum = new EnumBSTR(Enumerable.Empty<string>());
            }
            return VSConstants.S_OK;
        }
Esempio n. 16
0
        int IVsLanguageDebugInfo.GetProximityExpressions(IVsTextBuffer pBuffer, int iLine, int iCol, int cLines, out IVsEnumBSTR ppEnum)
        {
            if (pBuffer == null)
            {
                throw new ArgumentNullException("pBuffer");
            }

            return(GetProximityExpressions(pBuffer, iLine, iCol, cLines, out ppEnum));
        }
Esempio n. 17
0
 public override int GetProximityExpressions(IVsTextBuffer pBuffer, int iLine, int iCol, int cLines, out IVsEnumBSTR ppEnum) {
     // TODO: implement this to light up Autos toolwindow.
     ppEnum = null;
     return VSConstants.E_NOTIMPL;
 }
Esempio n. 18
0
        /// <summary>
        /// Called by debugger to get the list of expressions for the Autos debugger tool window.
        /// </summary>
        /// <remarks>
        /// MSDN docs specify that <paramref name="iLine"/> and <paramref name="iCol"/> specify the beginning of the span,
        /// but they actually specify the end of it (going <paramref name="cLines"/> lines back).
        /// </remarks>
        public int GetProximityExpressions(IVsTextBuffer pBuffer, int iLine, int iCol, int cLines, out IVsEnumBSTR ppEnum) {
            var model = _serviceProvider.GetService(typeof(SComponentModel)) as IComponentModel;
            var service = model.GetService<IVsEditorAdaptersFactoryService>();
            var buffer = service.GetDataBuffer(pBuffer);
            IPythonProjectEntry projEntry;
            if (buffer.TryGetPythonProjectEntry(out projEntry)) {
                int startLine = Math.Max(iLine - cLines + 1, 0);
                if (startLine <= iLine) {
                    var ast = projEntry.Tree;
                    var walker = new ProximityExpressionWalker(ast, startLine, iLine);
                    ast.Walk(walker);
                    var exprs = walker.GetExpressions();
                    ppEnum = new EnumBSTR(exprs.ToArray());
                    return VSConstants.S_OK;
                }
            }

            ppEnum = null;
            return VSConstants.E_FAIL;
        }
Esempio n. 19
0
        /// <include file='doc\LanguageService.uex' path='docs/doc[@for="LanguageService.GetProximityExpressions"]/*' />
        public virtual int GetProximityExpressions(IVsTextBuffer buffer, int line, int col, int cLines, out IVsEnumBSTR ppEnum) {
            ppEnum = null;
            /*
        TRACE2( "LanguageService(%S)::GetProximityExpressions: line %i", m_languageName, line );
        OUTARG(exprs);
        INARG(textBuffer);

        //check the linecount
        if (lineCount <= 0) lineCount = 1;

        //get the source 
        //TODO: this only works for sources that are opened in the environment
        HRESULT hr;
        Source* source = NULL;
        hr = GetSource( textBuffer, &source );
        if (FAILED(hr)) return hr;

        //parse and find the proximity expressions
        StringList* strings = NULL;
        hr = source->GetAutos( line, line + lineCount, &strings );
        RELEASE(source);
        if (FAILED(hr)) return hr;

        hr = strings->QueryInterface( IID_IVsEnumBSTR, reinterpret_cast<void**>(exprs) );
        RELEASE(strings);
        if (FAILED(hr)) return hr;
  
        return S_OK;
      */
            return NativeMethods.S_FALSE;
        }
        public int GetProximityExpressions(IVsTextBuffer pBuffer, int iLine, int iCol, int cLines, out IVsEnumBSTR ppEnum)
        {
            var textBuffer = _editorAdaptersFactory.GetDataBuffer(pBuffer);

            if (textBuffer == null)
            {
                // Can't resolve the text buffer, let someone else deal with this breakpoint.
                ppEnum = null;
                return(VSConstants.E_NOTIMPL);
            }

            var snapshot = textBuffer.CurrentSnapshot;

            if (!ValidateLocation(snapshot, iLine, iCol))
            {
                // The point disappeared between sessions. Do not evaluate proximity expressions here.
                ppEnum = null;
                return(VSConstants.E_FAIL);
            }

            var dialogResult = _waitDialogFactory.TryCreateWaitDialog(
                title: "Determining proximity expressions...",
                message: "Razor Debugger",
                async(context) =>
            {
                var proximityExpressions = await _proximityExpressionResolver.TryResolveProximityExpressionsAsync(textBuffer, iLine, iCol, context.CancellationToken).ConfigureAwait(false);
                return(proximityExpressions);
            });

            if (dialogResult == null)
            {
                // Failed to create the dialog at all.
                ppEnum = null;
                return(VSConstants.E_FAIL);
            }

            if (dialogResult.Cancelled)
            {
                ppEnum = null;
                return(VSConstants.E_FAIL);
            }

            if (dialogResult.Result == null)
            {
                ppEnum = null;
                return(VSConstants.E_FAIL);
            }

            ppEnum = new VsEnumBSTR(dialogResult.Result);
            return(VSConstants.S_OK);
        }
Esempio n. 21
0
        /// <summary>
        /// Called by debugger to get the list of expressions for the Autos debugger tool window.
        /// </summary>
        /// <remarks>
        /// MSDN docs specify that <paramref name="iLine"/> and <paramref name="iCol"/> specify the beginning of the span,
        /// but they actually specify the end of it (going <paramref name="cLines"/> lines back).
        /// </remarks>
        public int GetProximityExpressions(IVsTextBuffer pBuffer, int iLine, int iCol, int cLines, out IVsEnumBSTR ppEnum)
        {
            var model   = _serviceProvider.GetService(typeof(SComponentModel)) as IComponentModel;
            var service = model.GetService <IVsEditorAdaptersFactoryService>();
            var buffer  = service.GetDataBuffer(pBuffer);
            IPythonProjectEntry projEntry;

            if (buffer.TryGetPythonProjectEntry(out projEntry))
            {
                int startLine = Math.Max(iLine - cLines + 1, 0);
                if (startLine <= iLine)
                {
                    var ast    = projEntry.Tree;
                    var walker = new ProximityExpressionWalker(ast, startLine, iLine);
                    ast.Walk(walker);
                    var exprs = walker.GetExpressions();
                    ppEnum = new EnumBSTR(exprs.ToArray());
                    return(VSConstants.S_OK);
                }
            }

            ppEnum = null;
            return(VSConstants.E_FAIL);
        }
        public int GetProximityExpressions(IVsTextBuffer pBuffer, int iLine, int iCol, int cLines, out IVsEnumBSTR ppEnum)
        {
            var textBuffer = _editorAdaptersFactory.GetDataBuffer(pBuffer);

            if (textBuffer == null)
            {
                // Can't resolve the text buffer, let someone else deal with this breakpoint.
                ppEnum = null;
                return(VSConstants.E_NOTIMPL);
            }

            var snapshot = textBuffer.CurrentSnapshot;

            if (!ValidateLocation(snapshot, iLine, iCol))
            {
                // The point disappeared between sessions. Do not evaluate proximity expressions here.
                ppEnum = null;
                return(VSConstants.E_FAIL);
            }

            var proximityExpressions = _uiThreadOperationExecutor.Execute(
                title: VS.LSClientRazor.Resources.ProximityExpression_Dialog_Title,
                description: VS.LSClientRazor.Resources.ProximityExpression_Dialog_Description,
                allowCancellation: true,
                showProgress: true,
                (cancellationToken) => _proximityExpressionResolver.TryResolveProximityExpressionsAsync(textBuffer, iLine, iCol, cancellationToken), _joinableTaskFactory);

            if (proximityExpressions is null)
            {
                ppEnum = null;
                return(VSConstants.E_FAIL);
            }

            ppEnum = new VsEnumBSTR(proximityExpressions);
            return(VSConstants.S_OK);
        }
Esempio n. 23
0
 public virtual int GetProximityExpressions(IVsTextBuffer pBuffer, int iLine, int iCol, int cLines, out IVsEnumBSTR ppEnum)
 {
     ppEnum = null;
     return(VSConstants.E_NOTIMPL);
 }
Esempio n. 24
0
        /// <summary>
        /// Generates proximity expressions.
        /// </summary>
        /// <remarks>
        /// This method is implemented by a language service to provide information needed to populate the
        /// <strong>Autos</strong> debugging window. When the debugger calls this method, the debugger is
        /// requesting the names of any parameters and variables in a span of lines beginning with the
        /// starting position identified by the <paramref name="line"/> and <paramref name="col"/> parameters
        /// in the specified text buffer. The extent of lines beyond this point is specified by the
        /// <paramref name="cLines"/> parameter.
        /// </remarks>
        /// <param name="buffer">[in] The <see cref="IVsTextBuffer"/> interface for the text buffer containing the expression.</param>
        /// <param name="line">[in] Number of the line containing the start of the expression.</param>
        /// <param name="col">[in] Column position within the line.</param>
        /// <param name="cLines">[in] Number of lines within the expression.</param>
        /// <param name="expressions">[out] Returns an IVsEnumBSTR object that is used to enumerate BSTRs.</param>
        /// <returns>If the method succeeds, it returns S_OK. If it fails, it returns an error code.</returns>
        public virtual int GetProximityExpressions(IVsTextBuffer buffer, int line, int col, int cLines, out IVsEnumBSTR expressions)
        {
            Contract.Requires<ArgumentNullException>(buffer != null, "buffer");

            expressions = null;
            return VSConstants.S_FALSE;
        }
Esempio n. 25
0
 public override int GetProximityExpressions(IVsTextBuffer pBuffer, int iLine, int iCol, int cLines, out IVsEnumBSTR ppEnum)
 {
     // TODO: implement this to light up Autos toolwindow.
     ppEnum = null;
     return(VSConstants.E_NOTIMPL);
 }
Esempio n. 26
0
        int IVsLanguageDebugInfo.GetProximityExpressions(IVsTextBuffer pBuffer, int iLine, int iCol, int cLines, out IVsEnumBSTR ppEnum)
        {
            if (pBuffer == null)
                throw new ArgumentNullException("pBuffer");

            return GetProximityExpressions(pBuffer, iLine, iCol, cLines, out ppEnum);
        }
Esempio n. 27
0
 public int Clone(out IVsEnumBSTR ppEnum)
 {
     ppEnum = new VsEnumBSTR(_values);
     return(VSConstants.S_OK);
 }
Esempio n. 28
0
 public int Clone(out IVsEnumBSTR ppenum)
 {
     ppenum = new EnumBSTR(this._enumerable);
     return(VSConstants.S_OK);
 }
Esempio n. 29
0
        /// <summary>
        /// Called by debugger to get the list of expressions for the Autos debugger tool window.
        /// </summary>
        /// <remarks>
        /// MSDN docs specify that <paramref name="iLine"/> and <paramref name="iCol"/> specify the beginning of the span,
        /// but they actually specify the end of it (going <paramref name="cLines"/> lines back).
        /// </remarks>
        public int GetProximityExpressions(IVsTextBuffer pBuffer, int iLine, int iCol, int cLines, out IVsEnumBSTR ppEnum)
        {
            var model   = _serviceProvider.GetService(typeof(SComponentModel)) as IComponentModel;
            var service = model.GetService <IVsEditorAdaptersFactoryService>();
            var buffer  = service.GetDataBuffer(pBuffer);
            var entry   = buffer.TryGetAnalysisEntry();

            if (entry != null)
            {
                var names = entry.Analyzer.WaitForRequest(entry.Analyzer.GetProximityExpressionsAsync(entry, buffer, iLine, iCol, cLines), "PythonLanguageInfo.GetProximityExpressions");
                ppEnum = new EnumBSTR(names ?? Enumerable.Empty <string>());
            }
            else
            {
                ppEnum = new EnumBSTR(Enumerable.Empty <string>());
            }
            return(VSConstants.S_OK);
        }
Esempio n. 30
0
        /// <include file='doc\LanguageService.uex' path='docs/doc[@for="LanguageService.GetProximityExpressions"]/*' />
        public virtual int GetProximityExpressions(IVsTextBuffer buffer, int line, int col, int cLines, out IVsEnumBSTR ppEnum)
        {
            ppEnum = null;
            /*

              */
            return NativeMethods.S_FALSE;
        }