99using System . Runtime . CompilerServices ;
1010using System . Windows . Interop ;
1111using Microsoft . CodeAnalysis . Editor . Implementation . InlineRename ;
12+ using Microsoft . CodeAnalysis . InlineRename ;
13+ using Microsoft . CodeAnalysis . Options ;
1214using Microsoft . CodeAnalysis . Rename ;
1315using Microsoft . VisualStudio . PlatformUI . OleComponentSupport ;
1416
@@ -26,11 +28,11 @@ public InlineRenameAdornmentViewModel(InlineRenameSession session)
2628 _session = session ;
2729 _session . ReplacementTextChanged += OnReplacementTextChanged ;
2830
29- _previewChangesFlag = _session . OptionSet . GetOption ( RenameOptions . PreviewChanges ) ;
30- _renameFileFlag = _session . OptionSet . GetOption ( RenameOptions . RenameFile ) ;
31- _renameInStringsFlag = _session . OptionSet . GetOption ( RenameOptions . RenameInStrings ) ;
32- _renameInCommentsFlag = _session . OptionSet . GetOption ( RenameOptions . RenameInComments ) ;
33- _renameOverloadsFlag = _session . OptionSet . GetOption ( RenameOptions . RenameOverloads ) ;
31+ _previewChangesFlag = _session . PreviewChanges ;
32+ _renameFileFlag = _session . Options . RenameFile ;
33+ _renameInStringsFlag = _session . Options . RenameInStrings ;
34+ _renameInCommentsFlag = _session . Options . RenameInComments ;
35+ _renameOverloadsFlag = _session . Options . RenameOverloads ;
3436
3537 RegisterOleComponent ( ) ;
3638 }
@@ -66,7 +68,8 @@ public bool RenameInCommentsFlag
6668 {
6769 if ( Set ( ref _renameInCommentsFlag , value ) )
6870 {
69- _session . RefreshRenameSessionWithOptionsChanged ( RenameOptions . RenameInComments , value ) ;
71+ _session . RenameService . GlobalOptions . SetGlobalOption ( new OptionKey ( InlineRenameSessionOptionsStorage . RenameInComments ) , value ) ;
72+ _session . RefreshRenameSessionWithOptionsChanged ( _session . Options with { RenameInComments = value } ) ;
7073 }
7174 }
7275 }
@@ -79,7 +82,8 @@ public bool RenameInStringsFlag
7982 {
8083 if ( Set ( ref _renameInStringsFlag , value ) )
8184 {
82- _session . RefreshRenameSessionWithOptionsChanged ( RenameOptions . RenameInStrings , value ) ;
85+ _session . RenameService . GlobalOptions . SetGlobalOption ( new OptionKey ( InlineRenameSessionOptionsStorage . RenameInStrings ) , value ) ;
86+ _session . RefreshRenameSessionWithOptionsChanged ( _session . Options with { RenameInStrings = value } ) ;
8387 }
8488 }
8589 }
@@ -92,7 +96,8 @@ public bool RenameFileFlag
9296 {
9397 if ( Set ( ref _renameFileFlag , value ) )
9498 {
95- _session . RefreshRenameSessionWithOptionsChanged ( RenameOptions . RenameFile , value ) ;
99+ _session . RenameService . GlobalOptions . SetGlobalOption ( new OptionKey ( InlineRenameSessionOptionsStorage . RenameFile ) , value ) ;
100+ _session . RefreshRenameSessionWithOptionsChanged ( _session . Options with { RenameFile = value } ) ;
96101 }
97102 }
98103 }
@@ -105,7 +110,8 @@ public bool PreviewChangesFlag
105110 {
106111 if ( Set ( ref _previewChangesFlag , value ) )
107112 {
108- _session . RefreshRenameSessionWithOptionsChanged ( RenameOptions . PreviewChanges , value ) ;
113+ _session . RenameService . GlobalOptions . SetGlobalOption ( new OptionKey ( InlineRenameSessionOptionsStorage . PreviewChanges ) , value ) ;
114+ _session . SetPreviewChanges ( value ) ;
109115 }
110116 }
111117 }
@@ -118,7 +124,8 @@ public bool RenameOverloadsFlag
118124 {
119125 if ( Set ( ref _renameOverloadsFlag , value ) )
120126 {
121- _session . RefreshRenameSessionWithOptionsChanged ( RenameOptions . RenameOverloads , value ) ;
127+ _session . RenameService . GlobalOptions . SetGlobalOption ( new OptionKey ( InlineRenameSessionOptionsStorage . RenameOverloads ) , value ) ;
128+ _session . RefreshRenameSessionWithOptionsChanged ( _session . Options with { RenameOverloads = value } ) ;
122129 }
123130 }
124131 }
0 commit comments