private Node GetNextSibling(ArrayElementNode arrayElementNode) { ComplexNode parent = arrayElementNode.Parent as ComplexNode; SortedNodeList <Node> children = JsonHelpers.GetChildren(parent); return(parent != null?GetNextChild(arrayElementNode, children) : null); }
public override void Invoke(CancellationToken cancellationToken) { Telemetry.TrackUserTask("Invoke-UpdateSuggestedAction"); if (_disabled) { return; } try { IDependencies dependencies = _provider.DependenciesFactory.FromConfigFile(_provider.ConfigFilePath); IProvider provider = dependencies.GetProvider(_provider.InstallationState.ProviderId); ILibraryCatalog catalog = provider?.GetCatalog(); if (catalog == null) { return; } SortedNodeList <Node> children = JsonHelpers.GetChildren(_provider.LibraryObject); MemberNode member = children.OfType <MemberNode>().FirstOrDefault(m => m.UnquotedNameText == ManifestConstants.Library); if (member != null) { using (ITextEdit edit = TextBuffer.CreateEdit()) { edit.Replace(new Span(member.Value.Start, member.Value.Width), "\"" + _updatedLibraryId + "\""); edit.Apply(); } } } catch (Exception ex) { Logger.LogEvent(ex.ToString(), LogLevel.Error); Telemetry.TrackException("UpdateSuggestedActionFailed", ex); } }