File tree 1 file changed +7
-11
lines changed
src/client/activation/node
1 file changed +7
-11
lines changed Original file line number Diff line number Diff line change @@ -44,23 +44,19 @@ export class NodeLanguageServerAnalysisOptions extends LanguageServerAnalysisOpt
44
44
45
45
private async isAutoIndentEnabled ( ) {
46
46
const editorConfig = this . getPythonSpecificEditorSection ( ) ;
47
- let formatOnTypeEffectiveValue = editorConfig . get ( FORMAT_ON_TYPE_CONFIG_SETTING ) ;
48
47
const formatOnTypeInspect = editorConfig . inspect ( FORMAT_ON_TYPE_CONFIG_SETTING ) ;
49
48
const formatOnTypeSetForPython = formatOnTypeInspect ?. globalLanguageValue !== undefined ;
50
49
51
50
const inExperiment = await this . isInAutoIndentExperiment ( ) ;
52
-
53
- if ( inExperiment !== formatOnTypeSetForPython ) {
54
- if ( inExperiment ) {
55
- await NodeLanguageServerAnalysisOptions . setPythonSpecificFormatOnType ( editorConfig , true ) ;
56
- } else if ( formatOnTypeInspect ?. globalLanguageValue !== false ) {
57
- await NodeLanguageServerAnalysisOptions . setPythonSpecificFormatOnType ( editorConfig , undefined ) ;
58
- }
59
-
60
- formatOnTypeEffectiveValue = this . getPythonSpecificEditorSection ( ) . get ( FORMAT_ON_TYPE_CONFIG_SETTING ) ;
51
+ // only explicitly enable formatOnType for those who are in the experiment
52
+ // but have not explicitly given a value for the setting
53
+ if ( ! formatOnTypeSetForPython && inExperiment ) {
54
+ await NodeLanguageServerAnalysisOptions . setPythonSpecificFormatOnType ( editorConfig , true ) ;
61
55
}
62
56
63
- return inExperiment && formatOnTypeEffectiveValue ;
57
+ const formatOnTypeEffectiveValue = this . getPythonSpecificEditorSection ( ) . get ( FORMAT_ON_TYPE_CONFIG_SETTING ) ;
58
+
59
+ return formatOnTypeEffectiveValue ;
64
60
}
65
61
66
62
private async isInAutoIndentExperiment ( ) : Promise < boolean > {
You can’t perform that action at this time.
0 commit comments