Skip to content

Commit 642eeb7

Browse files
committed
norefs Changed timeout before codelenses are recalculated from 5 seconds to 3 seconds. Moved to the setting.
1 parent 1870754 commit 642eeb7

File tree

6 files changed

+16
-6
lines changed

6 files changed

+16
-6
lines changed

Extension/ExtensionPackage.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
global using System;
44
global using Task = System.Threading.Tasks.Task;
55
using EnvDTE;
6+
using Extension;
67
using Microsoft.VisualStudio;
78
using Microsoft.VisualStudio.OLE.Interop;
89
using Microsoft.VisualStudio.Shell.Interop;
@@ -24,6 +25,7 @@ namespace SyncToAsync.Extension
2425
[InstalledProductRegistration(Vsix.Name, Vsix.Description, Vsix.Version)]
2526
[ProvideAutoLoad(VSConstants.UICONTEXT.NoSolution_string, PackageAutoLoadFlags.BackgroundLoad)]
2627
[ProvideAutoLoad(VSConstants.UICONTEXT.SolutionExistsAndFullyLoaded_string, PackageAutoLoadFlags.BackgroundLoad)]
28+
[ProvideOptionPage(typeof(global::Extension.OptionsProvider.GeneralOptions), "Sync <-> Async", "General", 0, 0, true, SupportsProfiles = true)]
2729
[ProvideMenuResource("Menus.ctmenu", 1)]
2830
[Guid(PackageGuids.ExtensionString)]
2931
public sealed class ExtensionPackage : ToolkitPackage
@@ -148,7 +150,7 @@ private void Work()
148150
var restart = false;
149151
do
150152
{
151-
restart = _restartSignal.WaitOne(TimeSpan.FromSeconds(5));
153+
restart = _restartSignal.WaitOne(TimeSpan.FromSeconds(General.Instance.TimeoutToRecalculate));
152154
}
153155
while (restart);
154156

Extension/Helper/SyntaxHelper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ namespace SyncToAsync.Extension
99
{
1010
public static class SyntaxHelper
1111
{
12-
public static SyntaxNode? Up<T>(this SyntaxNode node)
12+
public static T? Up<T>(this SyntaxNode node)
1313
where T : SyntaxNode
1414
{
1515
SyntaxNode? cnode = node;

Extension/Options/General.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ namespace Extension
55
{
66
internal partial class OptionsProvider
77
{
8-
// Register the options with this attribute on your package class:
9-
// [ProvideOptionPage(typeof(OptionsProvider.GeneralOptions), "Extension", "General", 0, 0, true, SupportsProfiles = true)]
108
[ComVisible(true)]
119
public class GeneralOptions : BaseOptionPage<General>
1210
{
@@ -20,5 +18,11 @@ public class General : BaseOptionModel<General>
2018
[Description("Specifies whether to activate the CodeLens for sync<->async moving or not.")]
2119
[DefaultValue(true)]
2220
public bool Enabled { get; set; } = true;
21+
22+
[Category("General")]
23+
[DisplayName("Recalculate timeout")]
24+
[Description("Specifies how many seconds after last typing this extension waits to recalculate codelenses.")]
25+
[DefaultValue(true)]
26+
public int TimeoutToRecalculate { get; set; } = 3;
2327
}
2428
}

Extension/source.extension.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ internal sealed partial class Vsix
1111
public const string Name = "SyncToAsync Codelens";
1212
public const string Description = @"A Visual Studio extension that creates a custom codelense to move from async method to its sync sibling method and vice versa.";
1313
public const string Language = "en-US";
14-
public const string Version = "1.7";
14+
public const string Version = "1.8";
1515
public const string Author = "lsoft";
1616
public const string Tags = "";
1717
}

Extension/source.extension.vsixmanifest

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<PackageManifest Version="2.0.0" xmlns="http://schemas.microsoft.com/developer/vsx-schema/2011" xmlns:d="http://schemas.microsoft.com/developer/vsx-schema-design/2011">
33
<Metadata>
4-
<Identity Id="SyncToAsync.Extension.9a01841b-be97-49d6-a582-71671d3bade1" Version="1.7" Language="en-US" Publisher="lsoft" />
4+
<Identity Id="SyncToAsync.Extension.9a01841b-be97-49d6-a582-71671d3bade1" Version="1.8" Language="en-US" Publisher="lsoft" />
55
<DisplayName>SyncToAsync Codelens</DisplayName>
66
<Description xml:space="preserve">A Visual Studio extension that creates a custom codelense to move from async method to its sync sibling method and vice versa.</Description>
77
<Icon>Resources\Icon.png</Icon>

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,7 @@
33
A Visual Studio extension (VSIX) which creates codelenses allowed to goto to sync sibling method for async methods and vice-versa even if sibling method is in different file or code generated (for example, via [source generator](https://github.com/zompinc/sync-method-generator)).
44

55
![Image 1](example0.png)
6+
7+
When you types the codelenses are in watinig state. After few second after you stopped typing, the codelenses are recalculated. This timeout can be found in `Sync <-> Async` options tab in VS options window.
8+
9+
You can download this extension from [VS marketplace](https://marketplace.visualstudio.com/items?itemName=lsoft.SyncToAsyncExtension).

0 commit comments

Comments
 (0)