Skip to content

Commit

Permalink
Updated NuGet packages and added rating prompt
Browse files Browse the repository at this point in the history
[release]
  • Loading branch information
madskristensen committed May 11, 2022
1 parent 5b3c3c9 commit d77704b
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 5 deletions.
1 change: 1 addition & 0 deletions src/RestClient/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
public class Constants
{
public const char CommentChar = '#';
public const string MarketplaceId = "MadsKristensen.RestClient";
}
}
25 changes: 25 additions & 0 deletions src/RestClientVS/Editor/EditorFeatures.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
using System.Collections.Generic;
using System.ComponentModel.Composition;
using Microsoft.VisualStudio.Imaging;
using System.Linq;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using Microsoft.VisualStudio.Language.Intellisense;
using Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion;
using Microsoft.VisualStudio.Language.StandardClassification;
using Microsoft.VisualStudio.Text;
using Microsoft.VisualStudio.Text.BraceCompletion;
using Microsoft.VisualStudio.Text.Editor;
using Microsoft.VisualStudio.Text.Tagging;
using Microsoft.VisualStudio.Utilities;
using RestClient;
Expand Down Expand Up @@ -79,4 +85,23 @@ internal sealed class BraceMatchingTaggerProvider : BraceMatchingBase
[TagType(typeof(TextMarkerTag))]
public class SameWordHighlighter : SameWordHighlighterBase
{ }

[Export(typeof(IWpfTextViewCreationListener))]
[ContentType(LanguageFactory.LanguageName)]
[TextViewRole(PredefinedTextViewRoles.PrimaryDocument)]
public class UserRating : WpfTextViewCreationListener
{
private readonly RatingPrompt _rating = new(Constants.MarketplaceId, Vsix.Name, General.Instance);
private readonly DateTime _openedDate = DateTime.Now;

protected override void Closed(IWpfTextView textView)
{
if (_openedDate.AddMinutes(2) < DateTime.Now)
{
// Only register use after the document was open for more than 2 minutes.
_rating.RegisterSuccessfulUsage();

}
}
}
}
5 changes: 4 additions & 1 deletion src/RestClientVS/Options/General.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ internal partial class OptionsProvider
public class GeneralOptions : BaseOptionPage<General> { }
}

public class General : BaseOptionModel<General>
public class General : BaseOptionModel<General>, IRatingConfig
{
[Category("General")]
[DisplayName("Request timeout")]
Expand All @@ -29,5 +29,8 @@ public class General : BaseOptionModel<General>
[Browsable(false)]
[DefaultValue(500)]
public int ResponseWindowWidth { get; set; } = 500;

[Browsable(false)]
public int RatingRequests { get; set; }
}
}
8 changes: 4 additions & 4 deletions src/RestClientVS/RestClientVS.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,13 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Community.VisualStudio.VSCT" Version="16.0.29.6" PrivateAssets="all" />
<PackageReference Include="Community.VisualStudio.Toolkit.17" Version="17.0.385" ExcludeAssets="Runtime">
<PackageReference Include="Community.VisualStudio.Toolkit.17" Version="17.0.445" ExcludeAssets="Runtime">
<IncludeAssets>compile; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.VisualStudio.Threading">
<Version>17.0.64</Version>
<PackageReference Include="Microsoft.VSSDK.BuildTools" Version="17.1.4057">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.VSSDK.BuildTools" Version="17.0.5232" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\RestClient\RestClient.csproj">
Expand Down

0 comments on commit d77704b

Please sign in to comment.