From 9b5c885b40c385b726f70627c7957c2e1436aa0e Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Thu, 4 May 2017 10:36:10 +0200 Subject: [PATCH] make host implement getScriptKind, #203 --- src/worker.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/worker.ts b/src/worker.ts index c03b3ff0..a6fc8b20 100644 --- a/src/worker.ts +++ b/src/worker.ts @@ -93,6 +93,19 @@ export class TypeScriptWorker implements ts.LanguageServiceHost { }; } + getScriptKind?(fileName: string): ts.ScriptKind { + const suffix = fileName.substr(fileName.lastIndexOf('.') + 1); + switch (suffix) { + case 'ts': return ts.ScriptKind.TS; + case 'tsx': return ts.ScriptKind.TSX; + case 'js': return ts.ScriptKind.JS; + case 'jsx': return ts.ScriptKind.JSX; + default: return this.getCompilationSettings().allowJs + ? ts.ScriptKind.JS + : ts.ScriptKind.TS; + } + } + getCurrentDirectory(): string { return ''; }