18
18
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19
19
*/
20
20
21
- using System ;
22
21
using System . ComponentModel . Composition ;
23
- using System . Diagnostics ;
24
22
using SonarLint . VisualStudio . Core ;
25
23
using SonarLint . VisualStudio . Core . Synchronization ;
26
24
using SonarLint . VisualStudio . SLCore . Core ;
@@ -109,26 +107,26 @@ public void SetCurrentConfigScope(string id, string connectionId = null, string
109
107
{
110
108
configurationScopeService . DidUpdateBinding ( new DidUpdateBindingParams ( id , GetBinding ( connectionId , sonarProjectKey ) ) ) ;
111
109
currentConfigScope = currentConfigScope with { ConnectionId = connectionId , SonarProjectId = sonarProjectKey } ;
112
- OnCurrentConfigurationScopeChanged ( ) ;
113
- return ;
114
110
}
115
-
116
- configurationScopeService . DidAddConfigurationScopes ( new DidAddConfigurationScopesParams ( [
117
- new ConfigurationScopeDto ( id , id , true , GetBinding ( connectionId , sonarProjectKey ) ) ] ) ) ;
118
- currentConfigScope = new ConfigurationScope ( id , connectionId , sonarProjectKey ) ;
119
- OnCurrentConfigurationScopeChanged ( ) ;
111
+ else
112
+ {
113
+ configurationScopeService . DidAddConfigurationScopes ( new DidAddConfigurationScopesParams ( [
114
+ new ConfigurationScopeDto ( id , id , true , GetBinding ( connectionId , sonarProjectKey ) ) ] ) ) ;
115
+ currentConfigScope = new ConfigurationScope ( id , connectionId , sonarProjectKey ) ;
116
+ }
120
117
}
118
+
119
+ OnCurrentConfigurationScopeChanged ( ) ;
121
120
}
122
121
123
122
public void Reset ( )
124
123
{
125
124
threadHandling . ThrowIfOnUIThread ( ) ;
126
-
127
125
using ( asyncLock . Acquire ( ) )
128
126
{
129
127
currentConfigScope = null ;
130
- OnCurrentConfigurationScopeChanged ( ) ;
131
128
}
129
+ OnCurrentConfigurationScopeChanged ( ) ;
132
130
}
133
131
134
132
public void RemoveCurrentConfigScope ( )
@@ -150,8 +148,9 @@ public void RemoveCurrentConfigScope()
150
148
configurationScopeService . DidRemoveConfigurationScope (
151
149
new DidRemoveConfigurationScopeParams ( currentConfigScope . Id ) ) ;
152
150
currentConfigScope = null ;
153
- OnCurrentConfigurationScopeChanged ( ) ;
154
151
}
152
+
153
+ OnCurrentConfigurationScopeChanged ( ) ;
155
154
}
156
155
157
156
public bool TryUpdateRootOnCurrentConfigScope ( string id , string root )
@@ -164,9 +163,9 @@ public bool TryUpdateRootOnCurrentConfigScope(string id, string root)
164
163
}
165
164
166
165
currentConfigScope = currentConfigScope with { RootPath = root } ;
167
- OnCurrentConfigurationScopeChanged ( ) ;
168
- return true ;
169
166
}
167
+ OnCurrentConfigurationScopeChanged ( ) ;
168
+ return true ;
170
169
}
171
170
172
171
public bool TryUpdateAnalysisReadinessOnCurrentConfigScope ( string id , bool isReady )
@@ -179,9 +178,9 @@ public bool TryUpdateAnalysisReadinessOnCurrentConfigScope(string id, bool isRea
179
178
}
180
179
181
180
currentConfigScope = currentConfigScope with { isReadyForAnalysis = isReady } ;
182
- OnCurrentConfigurationScopeChanged ( ) ;
183
- return true ;
184
181
}
182
+ OnCurrentConfigurationScopeChanged ( ) ;
183
+ return true ;
185
184
}
186
185
187
186
public event EventHandler CurrentConfigurationScopeChanged ;
0 commit comments