Skip to content

Commit 282c1d2

Browse files
committed
Merge pull request #3016 from zhengbli/fixFormatConfigurationIssue
Fix host formatting configuration issues
2 parents 4cc1848 + d580063 commit 282c1d2

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/server/editorServices.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@ module ts.server {
424424

425425
getFormatCodeOptions(file?: string) {
426426
if (file) {
427-
var info = this.filenameToScriptInfo[file];
427+
var info = this.filenameToScriptInfo[file];
428428
if (info) {
429429
return info.formatCodeOptions;
430430
}
@@ -750,6 +750,7 @@ module ts.server {
750750
if (content !== undefined) {
751751
var indentSize: number;
752752
info = new ScriptInfo(this.host, fileName, content, openedByClient);
753+
info.setFormatOptions(this.getFormatCodeOptions());
753754
this.filenameToScriptInfo[fileName] = info;
754755
if (!info.isOpen) {
755756
info.fileWatcher = this.host.watchFile(fileName, _ => { this.watchedFileChanged(fileName); });

src/server/session.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,7 @@ module ts.server {
519519
IndentSize: formatOptions.IndentSize,
520520
TabSize: formatOptions.TabSize,
521521
NewLineCharacter: "\n",
522-
ConvertTabsToSpaces: true,
522+
ConvertTabsToSpaces: formatOptions.ConvertTabsToSpaces,
523523
};
524524
var indentPosition =
525525
compilerService.languageService.getIndentationAtPosition(file, position, editorOptions);

0 commit comments

Comments
 (0)