Microsoft.R.Editor.Data.RSessionDataObject.GetChildrenAsync C# (CSharp) Method

GetChildrenAsync() public method

public GetChildrenAsync ( ) : Task>
return Task>
        public Task<IReadOnlyList<IRSessionDataObject>> GetChildrenAsync() {
            if (_getChildrenTask == null) {
                lock (syncObj) {
                    if (_getChildrenTask == null) {
                        _getChildrenTask = GetChildrenAsyncInternal();
                    }
                }
            }

            return _getChildrenTask;
        }

Usage Example

Esempio n. 1
0
        private async Task UpdateList()
        {
            if (_updating)
            {
                return;
            }

            try {
                _updating = true;
                // May be null in tests
                var session = Workflow.RSession;
                if (session.IsHostRunning)
                {
                    var stackFrames = await session.TracebackAsync();

                    var globalStackFrame = stackFrames.FirstOrDefault(s => s.IsGlobal);
                    if (globalStackFrame != null)
                    {
                        const REvaluationResultProperties properties =
                            ExpressionProperty |
                            AccessorKindProperty |
                            TypeNameProperty |
                            ClassesProperty |
                            LengthProperty |
                            SlotCountProperty |
                            AttributeCountProperty |
                            DimProperty |
                            FlagsProperty;
                        var evaluation = await globalStackFrame.TryEvaluateAndDescribeAsync("base::environment()", "Global Environment", properties, RValueRepresentations.Str());

                        var settings = Workflow.Shell.GetService <IRSettings>();
                        var e        = new RSessionDataObject(evaluation, settings.EvaluateActiveBindings); // root level doesn't truncate children and return every variables

                        _topLevelVariables.Clear();

                        var children = await e.GetChildrenAsync();

                        if (children != null)
                        {
                            foreach (var x in children)
                            {
                                _topLevelVariables[x.Name] = x; // TODO: BUGBUG: this doesn't address removed variables
                            }
                        }
                    }
                }
            } catch (REvaluationException) { } finally {
                _updating = false;
            }
        }
All Usage Examples Of Microsoft.R.Editor.Data.RSessionDataObject::GetChildrenAsync