66using VisualStudioDiscordRPC . Shared . Plugs ;
77using VisualStudioDiscordRPC . Shared . Nests ;
88using VisualStudioDiscordRPC . Shared . Nests . Base ;
9- using System . Windows ;
10- using VisualStudioDiscordRPC . Shared . Plugs . TimerPlugs ;
9+ using VisualStudioDiscordRPC . Shared . Observers ;
1110
1211namespace VisualStudioDiscordRPC . Shared
1312{
@@ -25,6 +24,7 @@ public class DiscordRpcController
2524 private readonly DiscordRpcClient _discordRpcClient ;
2625 private readonly LocalizationService _localizationService ;
2726 private readonly SettingsService _settingsService ;
27+ private readonly VsObserver _vsObserver ;
2828
2929 private readonly RichPresence _sharedRichPresence ;
3030 private readonly object _richPresenceSync = new object ( ) ;
@@ -102,6 +102,7 @@ static DiscordRpcController()
102102 public DiscordRpcController ( int updateMillisecondsTimeout )
103103 {
104104 _settingsService = ServiceRepository . Default . GetService < SettingsService > ( ) ;
105+ _vsObserver = ServiceRepository . Default . GetService < VsObserver > ( ) ;
105106
106107 var applicationId = _settingsService . Read < string > ( SettingsKeys . ApplicationID ) ;
107108
@@ -152,6 +153,8 @@ public void Initialize()
152153 {
153154 nest . Changed += OnNestChanged ;
154155 }
156+
157+ _vsObserver . TextEditorLineChanged += OnTextEditorLineChanged ;
155158 }
156159
157160 public void Dispose ( )
@@ -168,6 +171,8 @@ public void Dispose()
168171 _sendingThreadCancellation = true ;
169172 _discordRpcClient . Dispose ( ) ;
170173 }
174+
175+ _vsObserver . TextEditorLineChanged -= OnTextEditorLineChanged ;
171176 }
172177
173178 public void SetPlug < TNest > ( BasePlug plug ) where TNest : BaseNest
@@ -214,6 +219,12 @@ private void OnNestChanged()
214219 SetDirty ( ) ;
215220 }
216221
222+ private void OnTextEditorLineChanged ( EnvDTE . TextPoint startPoint , EnvDTE . TextPoint endPoint , int hint )
223+ {
224+ if ( _enabled && _isIdling )
225+ SetDirty ( ) ;
226+ }
227+
217228 public void RefreshAll ( )
218229 {
219230 foreach ( BaseNest nest in Nests )
0 commit comments