@@ -51,19 +51,19 @@ public async Task DidChangeConfiguration(JToken token, CancellationToken cancell
51
51
}
52
52
53
53
var autoComplete = pythonSection [ "autoComplete" ] ;
54
- settings . completion . showAdvancedMembers = GetSetting ( autoComplete , "showAdvancedMembers" , true ) ;
55
- settings . completion . addBrackets = GetSetting ( autoComplete , "addBrackets" , false ) ;
54
+ settings . completion . showAdvancedMembers = GetSetting ( autoComplete , "showAdvancedMembers" , defaultValue : true ) ;
55
+ settings . completion . addBrackets = GetSetting ( autoComplete , "addBrackets" , defaultValue : false ) ;
56
56
57
57
var analysis = pythonSection [ "analysis" ] ;
58
- settings . symbolsHierarchyDepthLimit = GetSetting ( analysis , "symbolsHierarchyDepthLimit" , 10 ) ;
59
- settings . symbolsHierarchyMaxSymbols = GetSetting ( analysis , "symbolsHierarchyMaxSymbols" , 1000 ) ;
58
+ settings . symbolsHierarchyDepthLimit = GetSetting ( analysis , "symbolsHierarchyDepthLimit" , defaultValue : 10 ) ;
59
+ settings . symbolsHierarchyMaxSymbols = GetSetting ( analysis , "symbolsHierarchyMaxSymbols" , defaultValue : 1000 ) ;
60
60
61
61
_logger . LogLevel = GetLogLevel ( analysis ) . ToTraceEventType ( ) ;
62
62
63
63
var userConfiguredPaths = GetUserConfiguredPaths ( pythonSection ) ;
64
64
65
65
HandleUserConfiguredPathsChanges ( userConfiguredPaths ) ;
66
- HandlePathWatchChanges ( GetSetting ( analysis , "watchSearchPaths" , true ) ) ;
66
+ HandlePathWatchChanges ( GetSetting ( analysis , "watchSearchPaths" , defaultValue : true ) ) ;
67
67
HandleDiagnosticsChanges ( pythonSection , settings ) ;
68
68
69
69
_server . DidChangeConfiguration ( new DidChangeConfigurationParams { settings = settings } , cancellationToken ) ;
@@ -73,23 +73,23 @@ public async Task DidChangeConfiguration(JToken token, CancellationToken cancell
73
73
private void HandleDiagnosticsChanges ( JToken pythonSection , LanguageServerSettings settings ) {
74
74
var analysis = pythonSection [ "analysis" ] ;
75
75
76
- settings . diagnosticPublishDelay = GetSetting ( analysis , "diagnosticPublishDelay" , 1000 ) ;
76
+ settings . diagnosticPublishDelay = GetSetting ( analysis , "diagnosticPublishDelay" , defaultValue : 1000 ) ;
77
77
var ds = _services . GetService < IDiagnosticsService > ( ) ;
78
78
ds . PublishingDelay = settings . diagnosticPublishDelay ;
79
79
80
80
ds . DiagnosticsSeverityMap = new DiagnosticsSeverityMap (
81
- GetSetting ( analysis , "errors" , Array . Empty < string > ( ) ) ,
82
- GetSetting ( analysis , "warnings" , Array . Empty < string > ( ) ) ,
83
- GetSetting ( analysis , "information" , Array . Empty < string > ( ) ) ,
84
- GetSetting ( analysis , "disabled" , Array . Empty < string > ( ) ) ) ;
81
+ GetSetting ( analysis , "errors" , defaultValue : Array . Empty < string > ( ) ) ,
82
+ GetSetting ( analysis , "warnings" , defaultValue : Array . Empty < string > ( ) ) ,
83
+ GetSetting ( analysis , "information" , defaultValue : Array . Empty < string > ( ) ) ,
84
+ GetSetting ( analysis , "disabled" , defaultValue : Array . Empty < string > ( ) ) ) ;
85
85
86
86
var linting = pythonSection [ "linting" ] ;
87
- HandleLintingOnOff ( _services , GetSetting ( linting , "enabled" , true ) ) ;
87
+ HandleLintingOnOff ( _services , GetSetting ( linting , "enabled" , defaultValue : true ) ) ;
88
88
89
89
var memory = analysis [ "memory" ] ;
90
90
var optionsProvider = _services . GetService < IAnalysisOptionsProvider > ( ) ;
91
- optionsProvider . Options . KeepLibraryLocalVariables = GetSetting ( memory , "keepLibraryLocalVariables" , false ) ;
92
- optionsProvider . Options . KeepLibraryAst = GetSetting ( memory , "keepLibraryAst" , false ) ;
91
+ optionsProvider . Options . KeepLibraryLocalVariables = GetSetting ( memory , "keepLibraryLocalVariables" , defaultValue : false ) ;
92
+ optionsProvider . Options . KeepLibraryAst = GetSetting ( memory , "keepLibraryAst" , defaultValue : false ) ;
93
93
optionsProvider . Options . AnalysisCachingLevel = GetAnalysisCachingLevel ( analysis ) ;
94
94
95
95
_logger ? . Log ( TraceEventType . Information , Resources . AnalysisCacheLevel . FormatInvariant ( optionsProvider . Options . AnalysisCachingLevel ) ) ;
@@ -135,10 +135,10 @@ private ImmutableArray<string> GetUserConfiguredPaths(JToken pythonSection) {
135
135
// The values of these may not be null even if the value is "unset", depending on
136
136
// what the client uses as a default. Use null as a default anyway until the
137
137
// extension uses a null default (and/or extraPaths is dropped entirely).
138
- var autoCompleteExtraPaths = GetSetting < IReadOnlyList < string > > ( autoComplete , "extraPaths" , null ) ;
139
- var analysisSearchPaths = GetSetting < IReadOnlyList < string > > ( analysis , "searchPaths" , null ) ;
140
- var analysisUsePYTHONPATH = GetSetting ( analysis , "usePYTHONPATH" , true ) ;
141
- var analayisAutoSearchPaths = GetSetting ( analysis , "autoSearchPaths" , true ) ;
138
+ var autoCompleteExtraPaths = GetSetting < IReadOnlyList < string > > ( autoComplete , "extraPaths" , defaultValue : null ) ;
139
+ var analysisSearchPaths = GetSetting < IReadOnlyList < string > > ( analysis , "searchPaths" , defaultValue : null ) ;
140
+ var analysisUsePYTHONPATH = GetSetting ( analysis , "usePYTHONPATH" , defaultValue : true ) ;
141
+ var analayisAutoSearchPaths = GetSetting ( analysis , "autoSearchPaths" , defaultValue : true ) ;
142
142
143
143
if ( analysisSearchPaths != null ) {
144
144
set = true ;
@@ -181,7 +181,7 @@ private ImmutableArray<string> GetUserConfiguredPaths(JToken pythonSection) {
181
181
}
182
182
183
183
private AnalysisCachingLevel GetAnalysisCachingLevel ( JToken analysisKey ) {
184
- var s = GetSetting ( analysisKey , "cachingLevel" , "None" ) ;
184
+ var s = GetSetting ( analysisKey , "cachingLevel" , defaultValue : "None" ) ;
185
185
if ( s . EqualsIgnoreCase ( "System" ) ) {
186
186
return AnalysisCachingLevel . System ;
187
187
}
0 commit comments