Merge pull request #3016 from zhengbli/fixFormatConfigurationIssue

Fix host formatting configuration issues
This commit is contained in:
Zhengbo Li
2015-05-03 23:03:06 -07:00
2 changed files with 3 additions and 2 deletions

View File

@@ -424,7 +424,7 @@ module ts.server {
getFormatCodeOptions(file?: string) {
if (file) {
var info = this.filenameToScriptInfo[file];
var info = this.filenameToScriptInfo[file];
if (info) {
return info.formatCodeOptions;
}
@@ -750,6 +750,7 @@ module ts.server {
if (content !== undefined) {
var indentSize: number;
info = new ScriptInfo(this.host, fileName, content, openedByClient);
info.setFormatOptions(this.getFormatCodeOptions());
this.filenameToScriptInfo[fileName] = info;
if (!info.isOpen) {
info.fileWatcher = this.host.watchFile(fileName, _ => { this.watchedFileChanged(fileName); });

View File

@@ -519,7 +519,7 @@ module ts.server {
IndentSize: formatOptions.IndentSize,
TabSize: formatOptions.TabSize,
NewLineCharacter: "\n",
ConvertTabsToSpaces: true,
ConvertTabsToSpaces: formatOptions.ConvertTabsToSpaces,
};
var indentPosition =
compilerService.languageService.getIndentationAtPosition(file, position, editorOptions);