From 2c60cf96dd8a76fd0e8302b2213b174fd7805e94 Mon Sep 17 00:00:00 2001 From: steveluc Date: Mon, 16 Mar 2015 15:10:58 -0700 Subject: [PATCH] Add use of host-configured format options to additional code site. --- src/server/session.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/server/session.ts b/src/server/session.ts index 99176323831..012c7ad6ae4 100644 --- a/src/server/session.ts +++ b/src/server/session.ts @@ -465,8 +465,9 @@ module ts.server { var compilerService = project.compilerService; var position = compilerService.host.lineColToPosition(file, line, col); + var formatOptions = this.projectService.getFormatCodeOptions(); var edits = compilerService.languageService.getFormattingEditsAfterKeystroke(file, position, key, - this.projectService.getFormatCodeOptions()); + formatOptions); // Check whether we should auto-indent. This will be when // the position is on a line containing only whitespace. // This should leave the edits returned from @@ -482,8 +483,8 @@ module ts.server { if (lineText.search("\\S") < 0) { // TODO: get these options from host var editorOptions: ts.EditorOptions = { - IndentSize: 4, - TabSize: 4, + IndentSize: formatOptions.IndentSize, + TabSize: formatOptions.TabSize, NewLineCharacter: "\n", ConvertTabsToSpaces: true, };