From e76a4ef55098309b76d57c0fcb89e5a69e12463f Mon Sep 17 00:00:00 2001
From: chemzqm <chemzqm@gmail.com>
Date: Fri, 5 Apr 2019 11:37:43 +0800
Subject: [PATCH] fix status item not shown with javascript document

---
 src/server/typescriptServiceClient.ts | 2 +-
 src/server/utils/versionStatus.ts     | 9 +++++++--
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/server/typescriptServiceClient.ts b/src/server/typescriptServiceClient.ts
index b533ec4..bb06b33 100644
--- a/src/server/typescriptServiceClient.ts
+++ b/src/server/typescriptServiceClient.ts
@@ -105,7 +105,7 @@ export default class TypeScriptServiceClient implements ITypeScriptServiceClient
     this.versionProvider = new TypeScriptVersionProvider(this._configuration)
     this._apiVersion = API.defaultVersion
     this.tracer = new Tracer(this.logger)
-    this.versionStatus = new VersionStatus(this.normalizePath.bind(this))
+    this.versionStatus = new VersionStatus(this.normalizePath.bind(this), this.fileConfigurationManager.enableJavascript())
     pluginManager.onDidUpdateConfig(update => {
       this.configurePlugin(update.pluginId, update.config)
     }, null, this.disposables)
diff --git a/src/server/utils/versionStatus.ts b/src/server/utils/versionStatus.ts
index 646e401..2b0bf70 100644
--- a/src/server/utils/versionStatus.ts
+++ b/src/server/utils/versionStatus.ts
@@ -8,7 +8,8 @@ export default class VersionStatus {
   private readonly _versionBarEntry: StatusBarItem
 
   constructor(
-    private readonly _normalizePath: (resource: Uri) => string | null
+    private readonly _normalizePath: (resource: Uri) => string | null,
+    private readonly enableJavascript: boolean
   ) {
     this._versionBarEntry = workspace.createStatusBarItem(99)
     this._onChangeEditorSub = events.on('BufEnter', this.showHideStatus, this)
@@ -33,8 +34,12 @@ export default class VersionStatus {
       this._versionBarEntry.hide()
       return
     }
+    let filetypes = ['typescript', 'typescriptreact']
+    if (this.enableJavascript) {
+      filetypes.push('javascript', 'javascriptreact')
+    }
 
-    if (['typescript', 'typescriptreact'].indexOf(document.filetype) !== -1) {
+    if (filetypes.indexOf(document.filetype) !== -1) {
       if (this._normalizePath(Uri.parse(document.uri))) {
         this._versionBarEntry.show()
       } else {