/// <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); }
/// <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); }
/// <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); }
/// <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); }
public int Clone(out IVsEnumBSTR ppenum) { ppenum = new EnumBSTR(_enumerable); return(VSConstants.S_OK); }