From a20bda9d4993e133a6f7f865eb1220489cc66f1b Mon Sep 17 00:00:00 2001 From: Jeffrey Morlan Date: Tue, 24 Jul 2018 17:30:49 -0700 Subject: [PATCH] Fix getEmitOutput not honoring compile settings getCompilationSettings needs to return a flat object. getEmitOutput uses the spread operator, so it won't pick up settings from a prototype. --- manifest.mf | 2 +- server/main.ts | 17 +++++++++-------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/manifest.mf b/manifest.mf index 7f5be85..ff9385d 100644 --- a/manifest.mf +++ b/manifest.mf @@ -3,4 +3,4 @@ AutoUpdate-Show-In-Client: true OpenIDE-Module: netbeanstypescript OpenIDE-Module-Layer: netbeanstypescript/resources/layer.xml OpenIDE-Module-Localizing-Bundle: netbeanstypescript/Bundle.properties -OpenIDE-Module-Specification-Version: 3.0.0 +OpenIDE-Module-Specification-Version: 3.0.1 diff --git a/server/main.ts b/server/main.ts index 2940a7e..f4b2634 100644 --- a/server/main.ts +++ b/server/main.ts @@ -39,19 +39,14 @@ class HostImpl implements ts.LanguageServiceHost { parseError: ts.Diagnostic; pcl: ts.ParsedCommandLine; raw: any; + settings: ts.CompilerOptions; } = null; constructor(public path: string, public isConfig: boolean) {} log(s: string) { process.stdout.write('L' + JSON.stringify(s) + '\n'); } getCompilationSettings() { - var options = this.configUpToDate().pcl.options; - var settings: ts.CompilerOptions = Object.create(options); - if (options.noImplicitAny == null) { - // report implicit-any errors anyway, but only as warnings (see getDiagnostics) - settings.noImplicitAny = true; - } - return settings; + return this.configUpToDate().settings; } getNewLine() { return ts.getNewLineCharacter(this.configUpToDate().pcl.options); @@ -112,7 +107,13 @@ class HostImpl implements ts.LanguageServiceHost { || (ts).parseConfigFile; const dir = this.path.substring(0, this.path.lastIndexOf('/') + 1); const pcl = parse(config || {}, ts.sys, dir); - this.cachedConfig = { parseError: error, pcl: pcl, raw: pcl.raw || config || {} }; + this.cachedConfig = { + parseError: error, + pcl: pcl, + raw: pcl.raw || config || {}, + // if noImplicitAny unset, report errors anyway, but only as warnings (see getDiagnostics) + settings: { noImplicitAny: true, ...pcl.options } + }; } return this.cachedConfig; }