@@ -29,11 +29,11 @@ export function readEquivalentVsCodeConfiguration(serverSideOptionName: string):
29
29
}
30
30
31
31
function readTabSize ( configuration : WorkspaceConfiguration ) : string {
32
- return readValueIfDetectIndentationIsOff ( configuration , 'editor.tabSize' , '4 ') ;
32
+ return readVsCodeConfigurations < string > ( configuration , 'editor.tabSize' ) ;
33
33
}
34
34
35
35
function readIndentSize ( configuration : WorkspaceConfiguration ) : string {
36
- const indentSize = readValueIfDetectIndentationIsOff < string > ( configuration , 'editor.indentSize' , '4 ') ;
36
+ const indentSize = readVsCodeConfigurations < string > ( configuration , 'editor.indentSize' ) ;
37
37
// indent size could be a number or 'tabSize'. If it is 'tabSize', read the 'tabSize' section from config.
38
38
if ( indentSize == 'tabSize' ) {
39
39
return readTabSize ( configuration ) ;
@@ -43,7 +43,7 @@ function readIndentSize(configuration: WorkspaceConfiguration): string {
43
43
}
44
44
45
45
function readInsertSpaces ( configuration : WorkspaceConfiguration ) : string {
46
- const insertSpace = readValueIfDetectIndentationIsOff < boolean > ( configuration , 'editor.insertSpaces' , true ) ;
46
+ const insertSpace = readVsCodeConfigurations < boolean > ( configuration , 'editor.insertSpaces' ) ;
47
47
return insertSpace ? 'space' : 'tab' ;
48
48
}
49
49
@@ -62,21 +62,6 @@ function readInsertFinalNewline(configuration: WorkspaceConfiguration): string {
62
62
return readVsCodeConfigurations < string > ( configuration , 'files.insertFinalNewline' ) ;
63
63
}
64
64
65
- function readValueIfDetectIndentationIsOff < T > (
66
- configuration : WorkspaceConfiguration ,
67
- vscodeConfigName : string ,
68
- defaultValue : T
69
- ) : T {
70
- // If detectIndentation is on, tabSize, indentSize and insertSpaces would be overridden by vscode based on the file's content.
71
- // The values in settings become meaningless, so ask the server to fall back to default value.
72
- // TODO: Both 'editor.detectIndentation' and.editorconfig provided the same functions here, we need to find a graceful way to handle them.
73
- if ( configuration . get < boolean > ( 'editor.detectIndentation' ) ) {
74
- return defaultValue ;
75
- }
76
-
77
- return readVsCodeConfigurations ( configuration , vscodeConfigName ) ;
78
- }
79
-
80
65
function readVsCodeConfigurations < T > ( configuration : WorkspaceConfiguration , vscodeConfigName : string ) : T {
81
66
const configValue = configuration . get < T > ( vscodeConfigName ) ;
82
67
if ( configValue === undefined ) {
0 commit comments