public Task <CodeLensDataPointDescriptor> GetDataAsync(CodeLensDescriptorContext context, CancellationToken token) { try { Changelist commit = HelixUtility.GetLastCommit(rep, descriptor.FilePath); if (commit == null) { return(Task.FromResult <CodeLensDataPointDescriptor>(null)); } CodeLensDataPointDescriptor response = new CodeLensDataPointDescriptor() { Description = commit.OwnerName, //commit.Author.Name, TooltipText = $"Last change committed by {commit.OwnerName} at {commit.ModifiedDate.ToString(CultureInfo.CurrentCulture)}", IntValue = null, // no int value ImageId = GetCommitTypeIcon(commit), }; return(Task.FromResult(response)); } catch (Exception ex) { System.Windows.Forms.MessageBox.Show( "file: " + descriptor.FilePath + "\r\n" + "port: " + this.rep.Server.Address + "\r\n" + "user: "******"\r\n" + "client: " + this.rep.Connection.Client.Name + "\r\n" + "Exception:" + "\r\n" + ex.ToString()); return(Task.FromResult <CodeLensDataPointDescriptor>(null)); } }
public Task <CodeLensDataPointDescriptor> GetDataAsync(CodeLensDescriptorContext context, CancellationToken token) { // get the most recent commit Commit commit = GitUtil.GetCommits(this.gitRepo, this.descriptor.FilePath, 1).FirstOrDefault(); if (commit == null) { return(Task.FromResult <CodeLensDataPointDescriptor>(null)); } CodeLensDataPointDescriptor response = new CodeLensDataPointDescriptor() { Description = commit.Author.Name, TooltipText = $"Last change committed by {commit.Author.Name} at {commit.Author.When.ToString(CultureInfo.CurrentCulture)}", IntValue = null, // no int value ImageId = GetCommitTypeIcon(commit), }; return(Task.FromResult(response)); }
public Task <CodeLensDataPointDescriptor?> GetDataAsync(CodeLensDescriptorContext descriptorContext, CancellationToken token) { if (!_repositoryService.TryGetKnownRepository( Descriptor.FilePath, out _, out RepositoryInfo? repositoryInfo) || repositoryInfo == null) { return(Task.FromResult <CodeLensDataPointDescriptor?>(null)); } var response = new CodeLensDataPointDescriptor { Description = $"Copy link to this {Descriptor.Kind.ToString().ToLower()}", TooltipText = $"Generate and copy a link to this {Descriptor.Kind.ToString().ToLower()}.", IntValue = null, // no int value ImageId = new ImageId(KnownImageIds.ImageCatalogGuid, KnownImageIds.Link) }; return(Task.FromResult <CodeLensDataPointDescriptor?>(response)); }
public async Task <CodeLensDataPointDescriptor> GetDataAsync(CodeLensDescriptorContext context, CancellationToken token) { try { _bindings = await GetReferenceSetAsync(context, token); _dataHasLoaded.Set(); if (_bindings == null) { var response = new CodeLensDataPointDescriptor() { Description = $"Dpdt: no data available", TooltipText = $"Dpdt binding actual status", IntValue = null, // no int value ImageId = GetTypeIcon(), }; return(response); } if (_bindings.Status == DpdtBindingReferenceSetStatusEnum.Disabled) { var response = new CodeLensDataPointDescriptor() { Description = $"Dpdt: DISABLED", TooltipText = $"Dpdt binding actual status", IntValue = null, // no int value ImageId = GetTypeIcon(), }; return(response); } if (_bindings.Status == DpdtBindingReferenceSetStatusEnum.InProgress) { var response = new CodeLensDataPointDescriptor() { Description = $"Dpdt: scanning...", TooltipText = $"Dpdt binding actual status", IntValue = null, // no int value ImageId = GetTypeIcon(), }; return(response); } var bindCount = _bindings.GetBindingCount(); if (bindCount > 1) { var response = new CodeLensDataPointDescriptor() { Description = $"Dpdt: bind at {bindCount} points", TooltipText = $"Dpdt binding actual status", IntValue = null, // no int value ImageId = GetTypeIcon(), }; return(response); } else if (bindCount == 0) { var response = new CodeLensDataPointDescriptor() { Description = $"Dpdt: no bind found", TooltipText = $"Dpdt binding actual status", IntValue = null, // no int value ImageId = GetTypeIcon() }; return(response); } else { var response = new CodeLensDataPointDescriptor() { Description = $"Dpdt: bind at {_bindings.BindingTargets[0].ClusterDetail.FullName}", TooltipText = $"Dpdt binding actual status", IntValue = null, // no int value ImageId = GetTypeIcon(), }; return(response); } } catch (Exception ex) { LogCL(ex); throw; } }