@@ -29,11 +29,11 @@ export function readEquivalentVsCodeConfiguration(serverSideOptionName: string):
2929}
3030
3131function readTabSize ( configuration : WorkspaceConfiguration ) : string {
32- return readValueIfDetectIndentationIsOff ( configuration , 'editor.tabSize' , '4 ') ;
32+ return readVsCodeConfigurations < string > ( configuration , 'editor.tabSize' ) ;
3333}
3434
3535function readIndentSize ( configuration : WorkspaceConfiguration ) : string {
36- const indentSize = readValueIfDetectIndentationIsOff < string > ( configuration , 'editor.indentSize' , '4 ') ;
36+ const indentSize = readVsCodeConfigurations < string > ( configuration , 'editor.indentSize' ) ;
3737 // indent size could be a number or 'tabSize'. If it is 'tabSize', read the 'tabSize' section from config.
3838 if ( indentSize == 'tabSize' ) {
3939 return readTabSize ( configuration ) ;
@@ -43,7 +43,7 @@ function readIndentSize(configuration: WorkspaceConfiguration): string {
4343}
4444
4545function readInsertSpaces ( configuration : WorkspaceConfiguration ) : string {
46- const insertSpace = readValueIfDetectIndentationIsOff < boolean > ( configuration , 'editor.insertSpaces' , true ) ;
46+ const insertSpace = readVsCodeConfigurations < boolean > ( configuration , 'editor.insertSpaces' ) ;
4747 return insertSpace ? 'space' : 'tab' ;
4848}
4949
@@ -62,21 +62,6 @@ function readInsertFinalNewline(configuration: WorkspaceConfiguration): string {
6262 return readVsCodeConfigurations < string > ( configuration , 'files.insertFinalNewline' ) ;
6363}
6464
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-
8065function readVsCodeConfigurations < T > ( configuration : WorkspaceConfiguration , vscodeConfigName : string ) : T {
8166 const configValue = configuration . get < T > ( vscodeConfigName ) ;
8267 if ( configValue === undefined ) {
0 commit comments